Arvbox fixes: use 'postgres' database when testing if a user exists. Copy
authorPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 28 Jan 2016 19:22:23 +0000 (14:22 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 28 Jan 2016 19:22:23 +0000 (14:22 -0500)
gitolite.rc to the right place.  Print out what is being deleted when using
"reset" or "destroy". refs #8080

bin/arvbox
lib/arvbox/docker/service/api/run-service
lib/arvbox/docker/service/gitolite/run-service
lib/arvbox/docker/service/postgres/run-service
lib/arvbox/docker/service/sso/run-service
lib/arvbox/docker/waitforpostgres.sh

index 4f1d94a082716c68b0c929380dbbc5236c9adce2..d60c35497d2db565213703f4a65e5e129263e771 100755 (executable)
@@ -325,6 +325,7 @@ case "$subcmd" in
                     echo "Use destroy -f if you really mean it."
                     exit 1
                 fi
+                set -x
                 rm -rf "$ARVBOX_DATA"
             else
                 if test "$1" != -f ; then
@@ -333,6 +334,7 @@ case "$subcmd" in
                     echo "Use reset -f if you really mean it."
                     exit 1
                 fi
+                set -x
                 rm -rf "$ARVBOX_DATA/postgres"
                 rm -rf "$ARVBOX_DATA/var"
             fi
@@ -341,6 +343,7 @@ case "$subcmd" in
                 echo "WARNING!  This will delete your data container $ARVBOX_CONTAINER-data.  Use -f if you really mean it."
                 exit 1
             fi
+            set -x
             docker rm "$ARVBOX_CONTAINER-data"
         fi
         ;;
index 31f90d1101f8b487ef4bb70429fd5c95fbebb258..530a039079dc07f91a9b5b8fbeb511c14fc4e1df 100755 (executable)
@@ -69,9 +69,9 @@ if ! test -f /var/lib/arvados/api_database_pw ; then
 fi
 database_pw=$(cat /var/lib/arvados/api_database_pw)
 
-if ! (psql -c "\du" | grep "^ arvados ") >/dev/null ; then
-    psql -c "create user arvados with password '$database_pw'"
-    psql -c "ALTER USER arvados CREATEDB;"
+if ! (psql postgres -c "\du" | grep "^ arvados ") >/dev/null ; then
+    psql postgres -c "create user arvados with password '$database_pw'"
+    psql postgres -c "ALTER USER arvados CREATEDB;"
 fi
 
 sed "s/password:.*/password: $database_pw/" <config/database.yml.example >config/database.yml
index 8e6cb0ef244c80a3bb7489b16d3c77d0068a17aa..e0e8771c9392e6a3ad4623d0f17cc79d217ba829 100755 (executable)
@@ -40,7 +40,7 @@ if ! test -f /var/lib/arvados/gitolite-setup ; then
     ssh -o stricthostkeychecking=no git@localhost true
     rm .ssh/authorized_keys
 
-    cp -r /usr/local/lib/arvbox/gitolite.rc .
+    cp /usr/local/lib/arvbox/gitolite.rc .gitolite.rc
 
     gitolite setup -pk .ssh/id_rsa.pub
 
index ecb0aa69594e047bcdb0b065661fd8f0dd8032e2..a05be6292c568bc8bf988b6db40a4b3b9560391f 100755 (executable)
@@ -5,7 +5,7 @@ set -eux -o pipefail
 
 if ! test -d /var/lib/postgresql/9.4/main ; then
     /usr/lib/postgresql/9.4/bin/initdb -D /var/lib/postgresql/9.4/main
-    sh -c "while ! (psql -c'\du' | grep '^ arvbox ') >/dev/null ; do createuser -s arvbox ; sleep 1 ; done" &
+    sh -c "while ! (psql postgres -c'\du' | grep '^ arvbox ') >/dev/null ; do createuser -s arvbox ; sleep 1 ; done" &
 fi
 mkdir -p /var/run/postgresql/9.4-main.pg_stat_tmp
 
index 8a96d477e5768af8d60e0fcb5aee77eeacbebd42..2f501a4d2f6c827f3f8710823df311d6236b71ec 100755 (executable)
@@ -44,9 +44,9 @@ if ! test -f /var/lib/arvados/sso_database_pw ; then
 fi
 database_pw=$(cat /var/lib/arvados/sso_database_pw)
 
-if ! (psql -c "\du" | grep "^ arvados_sso ") >/dev/null ; then
-    psql -c "create user arvados_sso with password '$database_pw'"
-    psql -c "ALTER USER arvados_sso CREATEDB;"
+if ! (psql postgres -c "\du" | grep "^ arvados_sso ") >/dev/null ; then
+    psql postgres -c "create user arvados_sso with password '$database_pw'"
+    psql postgres -c "ALTER USER arvados_sso CREATEDB;"
 fi
 
 sed "s/password:.*/password: $database_pw/" <config/database.yml.example >config/database.yml
index a07fa8cfbb2fb8905ba7fb0d8a5c62b69c141c1b..84d9904093587378c1eb09d46cd59589a80af481 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
-while ! psql -c\\du >/dev/null 2>/dev/null ; do
+while ! psql postgres -c\\du >/dev/null 2>/dev/null ; do
     sleep 1
 done