From 5b93ec812b2ea20ca425788eda3d3ff188312787 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 5 Dec 2016 01:45:10 +0100 Subject: [PATCH] Fix many pathsi and args, fix doc --- app/{scripts => bin}/app.sh | 6 +++--- app/{scripts => bin}/wait.sh | 0 app/manage.py | 0 bin/pull.sh | 2 +- bin/push.sh | 2 +- doc/src/install.rst | 16 +++++----------- doc/src/maintenance.rst | 8 +++----- docker-compose.yml | 14 +++++++------- env/dev.yml | 2 +- env/eve.yml | 5 ++--- env/prestashop.yml | 3 +-- etc/nginx/conf.d/default.conf | 2 +- 12 files changed, 25 insertions(+), 35 deletions(-) rename app/{scripts => bin}/app.sh (94%) mode change 100644 => 100755 rename app/{scripts => bin}/wait.sh (100%) mode change 100644 => 100755 mode change 100644 => 100755 app/manage.py diff --git a/app/scripts/app.sh b/app/bin/app.sh old mode 100644 new mode 100755 similarity index 94% rename from app/scripts/app.sh rename to app/bin/app.sh index 7c27d30c..38b695ba --- a/app/scripts/app.sh +++ b/app/bin/app.sh @@ -7,6 +7,7 @@ wsgi=$app'/wsgi.py' static='/srv/static/' media='/srv/media/' src='/srv/src/' +log='/var/log/uwsgi/app.log' # uwsgi params port=8000 @@ -15,8 +16,7 @@ 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' +# patterns='*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.svg;*.ttf;*.eot;*.woff;*.woff2' # Staging # pip install xlrd @@ -30,7 +30,7 @@ pip install django-querysetsequence==0.6.1 django==1.9.11 chown -R $uid:$gid $media # waiting for other services -sh $app/scripts/wait.sh +sh $app/bin/wait.sh # django setup python $manage wait-for-db diff --git a/app/scripts/wait.sh b/app/bin/wait.sh old mode 100644 new mode 100755 similarity index 100% rename from app/scripts/wait.sh rename to app/bin/wait.sh diff --git a/app/manage.py b/app/manage.py old mode 100644 new mode 100755 diff --git a/bin/pull.sh b/bin/pull.sh index 69c38832..f8e118e5 100755 --- a/bin/pull.sh +++ b/bin/pull.sh @@ -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 diff --git a/bin/push.sh b/bin/push.sh index 872d2eba..710b0fdd 100755 --- a/bin/push.sh +++ b/bin/push.sh @@ -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" diff --git a/doc/src/install.rst b/doc/src/install.rst index 18906ccb..a7088c2e 100644 --- a/doc/src/install.rst +++ b/doc/src/install.rst @@ -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) diff --git a/doc/src/maintenance.rst b/doc/src/maintenance.rst index 4e90e257..9c7b038a 100644 --- a/doc/src/maintenance.rst +++ b/doc/src/maintenance.rst @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 5aeb4d4d..e081a594 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/env/dev.yml b/env/dev.yml index 2293a025..4eedc10c 100644 --- a/env/dev.yml +++ b/env/dev.yml @@ -20,7 +20,7 @@ app: - command: /bin/sh scripts/app.sh --runserver + command: /bin/sh bin/app.sh --runserver volumes: - ./app/:/srv/app ports: diff --git a/env/eve.yml b/env/eve.yml index 3bce54cc..dffbc255 100644 --- a/env/eve.yml +++ b/env/eve.yml @@ -22,15 +22,14 @@ 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 diff --git a/env/prestashop.yml b/env/prestashop.yml index d371047d..b64717cf 100644 --- a/env/prestashop.yml +++ b/env/prestashop.yml @@ -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 diff --git a/etc/nginx/conf.d/default.conf b/etc/nginx/conf.d/default.conf index 1b1a9283..9fca538b 100644 --- a/etc/nginx/conf.d/default.conf +++ b/etc/nginx/conf.d/default.conf @@ -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 / { -- 2.39.5