]> git.parisson.com Git - mezzo.git/commitdiff
no pre-start anymore for the db (hack: waiting for valid syncdb)
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 26 Jan 2016 12:26:45 +0000 (13:26 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 26 Jan 2016 12:26:45 +0000 (13:26 +0100)
README.rst
app/deploy/start_app.sh
app/wait.py [new file with mode: 0644]

index d05c182ac1159fc86b7ec36ea325e7ccddf75f6b..2632dfa3acbab24ededbfa9d36e326cdd7429fd8 100644 (file)
@@ -18,10 +18,6 @@ Run these commands in a terminal::
 
     git clone --recursive git://git.forge.ircam.fr/Manifeste.git
     cd Manifeste
-    docker-compose up db
-
-The last command is needed to initialize the database. Leave the session with CTRL+C and then finally do::
-
     docker-compose up
 
 To restore the backuped database, in another terminal::
@@ -41,10 +37,6 @@ Run these commands in a terminal::
     docker-machine ip manifeste
     git clone --recursive git://git.forge.ircam.fr/Manifeste.git
     cd Manifeste
-    docker-compose up db
-
-The last command is needed to initialize the database. Leave the session with CTRL+C and then finally do::
-
     docker-compose up
 
 Then, in another terminal::
@@ -53,6 +45,6 @@ Then, in another terminal::
     cd Manifeste
     docker-compose run db /srv/backup/restore_db.sh
 
-The 3rd command should give you the IP of the VM. For example, if IP is 192.168.59.103, you should be able to browse the site at http://192.168.59.103:8010/
 
 `More info <https://docs.docker.com/>`_ about using docker and related tools.
+The 3rd command should give you the IP of the VM. For example, if IP is 192.168.59.103, you should be able to browse the site at http://192.168.59.103:8010/
index 634c0ab202d240234d86859c8cb8e519ed16aece..84b21476a47cdd0fb574cc6d016f6a85b5700ff9 100644 (file)
@@ -23,6 +23,9 @@ chown -R $uid:$gid $media
 # waiting for other services
 sh $app/deploy/wait.sh
 
+# waiting for available database
+python $app/wait.py
+
 # django init
 python $manage syncdb --noinput
 python $manage migrate --noinput
diff --git a/app/wait.py b/app/wait.py
new file mode 100644 (file)
index 0000000..eead53c
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import os, time
+from django.core.management import call_command
+
+up = False
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sandbox.settings")
+
+while not up:
+    try:
+        call_command('syncdb', interactive=False)
+        up = True
+    except:
+        time.sleep(1)