Restart the server automatically when it fails

This commit is contained in:
Ophir LOJKINE 2019-03-21 22:37:13 +01:00
parent 6493478362
commit 87372e4f79
3 changed files with 2421 additions and 77 deletions

View file

@ -7,23 +7,7 @@ VOLUME /opt/app/server-data
RUN touch /usr/bin/start.sh # this is the script which will run on start
# if you need a build script, uncomment the line below
# RUN echo 'sh mybuild.sh' >> /usr/bin/start.sh
# if you need redis, uncomment the lines below
# RUN apk --update add redis
# RUN echo 'redis-server &' >> /usr/bin/start.sh
# daemon for cron jobs
# RUN echo 'echo will install crond...' >> /usr/bin/start.sh
# RUN echo 'crond' >> /usr/bin/start.sh
# Basic npm start verification
RUN echo 'nb=`cat package.json | grep start | wc -l` && if test "$nb" = "0" ; then echo "*** Boot issue: No start command found in your package.json in the scripts. See https://docs.npmjs.com/cli/start" ; exit 1 ; fi' >> /usr/bin/start.sh
RUN echo 'npm install --production' >> /usr/bin/start.sh
# npm start, make sure to have a start attribute in "scripts" in package.json
RUN echo 'npm start' >> /usr/bin/start.sh
RUN echo 'npx forever --minUptime 7000 --spinSleepTime 2000 -o out.log -e err.log ./server/server.js' >> /usr/bin/start.sh
CMD ["/bin/sh","/usr/bin/start.sh"]

2479
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,7 @@
"version": "1.0.22",
"license": "AGPL-3.0-or-later",
"dependencies": {
"forever": "^0.15.3",
"handlebars": "^4.1.1",
"node-static": "0.7.x",
"socket.io": "^2.2.0"