]> git.parisson.com Git - mezzo.git/commitdiff
Fix many pathsi and args, fix doc
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 5 Dec 2016 00:45:10 +0000 (01:45 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 5 Dec 2016 00:45:10 +0000 (01:45 +0100)
14 files changed:
app/bin/app.sh [new file with mode: 0755]
app/bin/wait.sh [new file with mode: 0755]
app/manage.py [changed mode: 0644->0755]
app/scripts/app.sh [deleted file]
app/scripts/wait.sh [deleted file]
bin/pull.sh
bin/push.sh
doc/src/install.rst
doc/src/maintenance.rst
docker-compose.yml
env/dev.yml
env/eve.yml
env/prestashop.yml
etc/nginx/conf.d/default.conf

diff --git a/app/bin/app.sh b/app/bin/app.sh
new file mode 100755 (executable)
index 0000000..38b695b
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# paths
+app='/srv/app'
+manage=$app'/manage.py'
+wsgi=$app'/wsgi.py'
+static='/srv/static/'
+media='/srv/media/'
+src='/srv/src/'
+log='/var/log/uwsgi/app.log'
+
+# uwsgi params
+port=8000
+processes=8
+threads=16
+autoreload=3
+uid='www-data'
+gid='www-data'
+# patterns='*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.svg;*.ttf;*.eot;*.woff;*.woff2'
+
+# Staging
+# pip install xlrd
+# pip install -U https://forge.ircam.fr/p/django-eve/source/download/dev/
+# pip install https://forge.ircam.fr/p/django-prestashop/source/download/master/ --src /srv/lib
+# pip install -U https://github.com/stephenmcd/grappelli-safe/archive/dynamic_stacked.zip
+pip install django-querysetsequence==0.6.1 django==1.9.11
+#pip install django-autocomplete-light django-querysetsequence
+#/usr/bin/yes | pip uninstall django-orderable
+
+chown -R $uid:$gid $media
+
+# waiting for other services
+sh $app/bin/wait.sh
+
+# django setup
+python $manage wait-for-db
+# python $manage migrate --noinput
+# python $manage bower_install -- --allow-root
+python $manage create-admin-user
+# @todo searching every fixtures file in each folder
+python $manage loaddata $app/organization/job/fixtures/organization-job.json
+python $manage loaddata $app/organization/projects/fixtures/organization-projects-repositorysystems.json
+
+# app start
+if [ "$1" = "--runserver" ]; then
+    python $manage runserver 0.0.0.0:8000
+else
+    # static files auto update
+    # watchmedo shell-command --patterns="$patterns" --recursive \
+    #     --command='python '$manage' collectstatic --noinput' $app &
+
+    python $manage collectstatic --noinput
+
+    uwsgi --socket :$port --wsgi-file $wsgi --chdir $app --master \
+    --processes $processes --threads $threads \
+    --uid $uid --gid $gid --logto $log \
+    --py-autoreload $autoreload
+fi
diff --git a/app/bin/wait.sh b/app/bin/wait.sh
new file mode 100755 (executable)
index 0000000..202c4d1
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+host=$(env | grep _TCP_ADDR | cut -d = -f 2)
+port=$(env | grep _TCP_PORT | cut -d = -f 2)
+
+echo -n "waiting for TCP connection to $host:$port..."
+
+while ! nc -w 1 $host $port 2>/dev/null
+do
+  echo -n .
+  sleep 1
+done
+
+echo 'ok'
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/app/scripts/app.sh b/app/scripts/app.sh
deleted file mode 100644 (file)
index 7c27d30..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-# paths
-app='/srv/app'
-manage=$app'/manage.py'
-wsgi=$app'/wsgi.py'
-static='/srv/static/'
-media='/srv/media/'
-src='/srv/src/'
-
-# uwsgi params
-port=8000
-processes=8
-threads=16
-autoreload=3
-uid='www-data'
-gid='www-data'
-patterns='*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.svg;*.ttf;*.eot;*.woff;*.woff2'
-log='/var/log/uwsgi/app.log'
-
-# Staging
-# pip install xlrd
-# pip install -U https://forge.ircam.fr/p/django-eve/source/download/dev/
-# pip install https://forge.ircam.fr/p/django-prestashop/source/download/master/ --src /srv/lib
-# pip install -U https://github.com/stephenmcd/grappelli-safe/archive/dynamic_stacked.zip
-pip install django-querysetsequence==0.6.1 django==1.9.11
-#pip install django-autocomplete-light django-querysetsequence
-#/usr/bin/yes | pip uninstall django-orderable
-
-chown -R $uid:$gid $media
-
-# waiting for other services
-sh $app/scripts/wait.sh
-
-# django setup
-python $manage wait-for-db
-# python $manage migrate --noinput
-# python $manage bower_install -- --allow-root
-python $manage create-admin-user
-# @todo searching every fixtures file in each folder
-python $manage loaddata $app/organization/job/fixtures/organization-job.json
-python $manage loaddata $app/organization/projects/fixtures/organization-projects-repositorysystems.json
-
-# app start
-if [ "$1" = "--runserver" ]; then
-    python $manage runserver 0.0.0.0:8000
-else
-    # static files auto update
-    # watchmedo shell-command --patterns="$patterns" --recursive \
-    #     --command='python '$manage' collectstatic --noinput' $app &
-
-    python $manage collectstatic --noinput
-
-    uwsgi --socket :$port --wsgi-file $wsgi --chdir $app --master \
-    --processes $processes --threads $threads \
-    --uid $uid --gid $gid --logto $log \
-    --py-autoreload $autoreload
-fi
diff --git a/app/scripts/wait.sh b/app/scripts/wait.sh
deleted file mode 100644 (file)
index 202c4d1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-set -e
-
-host=$(env | grep _TCP_ADDR | cut -d = -f 2)
-port=$(env | grep _TCP_PORT | cut -d = -f 2)
-
-echo -n "waiting for TCP connection to $host:$port..."
-
-while ! nc -w 1 $host $port 2>/dev/null
-do
-  echo -n .
-  sleep 1
-done
-
-echo 'ok'
index 69c38832af92dace23e88486d47ab627e77214d3..f8e118e5a7e01b8c0a500474c30dbe32a3f19c56 100755 (executable)
@@ -4,5 +4,5 @@ sudo chown -R $USER var/media
 sudo chown -R $USER var/backup
 git pull
 git submodule foreach git pull
-docker-compose run db /srv/scripts/restore_db.sh
+docker-compose run db /srv/bin/restore_db.sh
 gulp build
index 872d2eba739a2ea4db653e930be98fb9ab8cbe54..710b0fdd8618d1c1aabff1a8ae9db1068fefd732 100755 (executable)
@@ -2,7 +2,7 @@
 
 echo "----------------------------"
 echo `date +\%Y\%m\%d-\%H-\%M-\%S`
-docker-compose run db /srv/scripts/backup_db.sh
+docker-compose run db /srv/bin/backup_db.sh
 cd var
 git add .
 git commit -a -m "update DB and media"
index 18906ccb7d0d9246776fb96b19a1611436da03e5..a7088c2ede0b109cc248dfe8a2ae97005fa19cb2 100644 (file)
@@ -64,24 +64,18 @@ Then browse the app at http://localhost:8020/
 On MacOS or Windows, we need to replace 'localhost' by the IP given by the docker terminal.
 
 
-Install as a daemon
-+++++++++++++++++++++
-
-Run daemon install script::
-
-    sudo ./install.py
-
-Run daemon and install cron::
+Daemonize
++++++++++++
 
-    sudo ./install.py --user=$USER --cron
+The install the entire composition so that it will be automatically run at boot and in the background::
 
-    You can find logs at /var/log/mezzanine-organization
+    sudo bin/install.py
 
 options::
 
     --uninstall : uninstall the daemon
     --cron : install cron backup rule (every 6 hours)
-    --user : specify user
+    --user : specify user for cron rule
     --systemd : use systemd
     --composition_file : the path of the YAML composition file to use (optional)
 
index 4e90e257b081b0d3202471dba1b32301164b6678..9c7b038a73b04a9ed2d623e910b30f478bb7014c 100644 (file)
@@ -22,13 +22,11 @@ Upgrade application, all dependencies, data from master branch and also recompil
 Backup & restore DB
 ++++++++++++++++++++
 
-To backup the database, in **another** terminal (or a Docker Quickstart Terminal)::
+To backup the database and push it to the var (data) own repository (**only** prod!)::
 
-    bin/push.sh #(only prod !)
+    bin/push.sh
 
-giving your user password if asked...
-
-To restore the backuped database, in another terminal (or a Docker Quickstart Terminal)::
+To restore the backuped database and rebuild front::
 
     bin/pull.sh
 
index 5aeb4d4d65d0dff464d18cfaf2aa38a8eb172aef..e081a5945c67c08345a775d07215fcd81a744ac7 100644 (file)
@@ -23,9 +23,13 @@ var:
   volumes:
     - ./var/media:/srv/media
     - ./var/backup:/srv/backup
-    - /srv/static
-    - /srv/bower
+    - ./var/log/uwsgi:/var/log/uwsgi
+    - ./var/log/nginx:/var/log/nginx
+    - ./var/log/app:/var/log/app
+    - ./bin:/srv/bin
     - ./doc:/srv/doc
+    - /srv/bower
+    - /srv/static
   command: "true"
 
 db:
@@ -33,24 +37,21 @@ db:
   volumes_from:
     - var
   volumes:
-    - ./scripts:/srv/scripts
     - ./var/lib/postgresql/data:/var/lib/postgresql/data
   environment:
     - POSTGRES_PASSWORD=hyRob0otlaz4
 
 app:
   build: .
-  command: /bin/bash scripts/app.sh
+  command: /bin/bash bin/app.sh
   volumes:
     - ./app:/srv/app
-    - ./var/log/uwsgi:/var/log/uwsgi
     - ./lib/grappelli-safe:/srv/lib/grappelli-safe
     - ./lib/mezzanine-agenda:/srv/lib/mezzanine-agenda
     - ./lib/django-eve:/srv/lib/django-eve
     - ./lib/django-prestashop:/srv/lib/django-prestashop
     # - ./lib/mezzanine/:/srv/lib/mezzanine
     # - ./lib/cartridge/:/srv/lib/cartridge
-    - ./doc:/srv/doc
   volumes_from:
     - var
   expose:
@@ -66,7 +67,6 @@ nginx:
     - "8020:80"
   volumes:
     - ./etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
-    - ./var/log/nginx/:/var/log/nginx
   volumes_from:
     - var
   links:
index 2293a025c17b0730879f7addeacee4efdee93383..4eedc10cce59f27a009fefb2a1d14b424362ab48 100644 (file)
@@ -20,7 +20,7 @@
 
 
 app:
-  command: /bin/sh scripts/app.sh --runserver
+  command: /bin/sh bin/app.sh --runserver
   volumes:
     - ./app/:/srv/app
   ports:
index 3bce54cc25b9d5bcdd4ddaa0427560c03c15cafa..dffbc255d3de19593da4eab38c331b32715d166d 100644 (file)
 evedb:
   image: postgres:9.5
   volumes_from:
-    - data
+    - var
   volumes:
-    - ./scripts/:/srv/scripts
     - ./data/external/eve/postgresql/data/:/var/lib/postgresql/data
   environment:
     - POSTGRES_USER=eve
     - POSTGRES_DB=eve
     - POSTGRES_PASSWORD=q2nqzt0WGnwWé,256
-    
+
 app:
   links:
     - db
index d371047db42927c52be206e7d5b7f4035c70c7ec..b64717cf25365c6938e40b473bbda4d6b640e4e6 100644 (file)
@@ -22,9 +22,8 @@
 prestadb:
   image: mariadb
   volumes_from:
-    - data
+    - var
   volumes:
-    - ./scripts/:/srv/scripts
     - ./data/external/prestashop/mysql/:/var/lib/mysql
   environment:
     - MYSQL_ROOT_PASSWORD=mysecretpassword
index 1b1a92833984a52960e21c1899d50aed4857bb2b..9fca538ba0689cc62d1f3a990be89c4e3a79ac56 100644 (file)
@@ -22,7 +22,7 @@ server {
 
        # Django static
        location /doc {
-               alias /srv/doc; # your Django project's static files - amend as required
+               alias /srv/doc/build/html; # your Django project's static files - amend as required
        }
 
        location / {