Quellcode durchsuchen

[init] bail out in case the db access fails (#123)

* [init] bail out in case the db access fails

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [misc] bail out in case any command in an init_script failed

NOTE: sh does not support `-o pipefail`.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
Jakob Ackermann vor 6 Jahren
Ursprung
Commit
3170a27fb5

+ 2 - 0
server-ce/init_scripts/00_make_sharelatex_data_dirs.sh

@@ -1,4 +1,6 @@
 #!/bin/sh
 #!/bin/sh
+set -e
+
 mkdir -p /var/lib/sharelatex/data
 mkdir -p /var/lib/sharelatex/data
 chown www-data:www-data /var/lib/sharelatex/data
 chown www-data:www-data /var/lib/sharelatex/data
 
 

+ 2 - 1
server-ce/init_scripts/00_regen_sharelatex_secrets.sh

@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+set -e -o pipefail
 
 
 # generate secrets and defines them as environment variables
 # generate secrets and defines them as environment variables
 # https://github.com/phusion/baseimage-docker#centrally-defining-your-own-environment-variables
 # https://github.com/phusion/baseimage-docker#centrally-defining-your-own-environment-variables

+ 4 - 2
server-ce/init_scripts/00_set_docker_host_ipaddress.sh

@@ -1,3 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+set -e -o pipefail
+
 # See the bottom of http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
 # See the bottom of http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
-echo "`route -n | awk '/UG[ \t]/{print $2}'` dockerhost" >> /etc/hosts
+echo "`route -n | awk '/UG[ \t]/{print $2}'` dockerhost" >> /etc/hosts

+ 2 - 0
server-ce/init_scripts/98_check_db_access.sh

@@ -1,4 +1,6 @@
 #!/bin/sh
 #!/bin/sh
+set -e
+
 echo "Checking can connect to mongo and redis"
 echo "Checking can connect to mongo and redis"
 cd /var/www/sharelatex && grunt check:redis
 cd /var/www/sharelatex && grunt check:redis
 cd /var/www/sharelatex && grunt check:mongo
 cd /var/www/sharelatex && grunt check:mongo

+ 2 - 0
server-ce/init_scripts/99_migrate.sh

@@ -1,4 +1,6 @@
 #!/bin/sh
 #!/bin/sh
+set -e
+
 which node
 which node
 which grunt
 which grunt
 ls -al /var/www/sharelatex/migrations
 ls -al /var/www/sharelatex/migrations