From: Guillaume Pellerin Date: Mon, 28 Mar 2016 22:12:43 +0000 (+0200) Subject: fix backup/restore scripts, fix doc X-Git-Tag: 1.6b~1^2~6 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=70170ee41f16e6e716453af55400f159f74b6606;p=telemeta.git fix backup/restore scripts, fix doc --- diff --git a/README.rst b/README.rst index 2a564550..45d2814e 100644 --- a/README.rst +++ b/README.rst @@ -112,29 +112,54 @@ password: demo Install ======= -Thanks to Docker, Telemeta is now fully available as a docker image ready to work. The docker based composition bundles some powerfull applications and modern frameworks out-of-the-box like: Python, Numpy, Gstreamer, Django, Celery, Haystack, ElasticSearch, MySQL, RabbitMQ, uWSGI, Nginx and many more... +Thanks to Docker, Telemeta is now fully available as a docker composition ready to work. The docker based composition bundles some powerfull applications and modern frameworks out-of-the-box like: Python, Numpy, Gstreamer, Django, Celery, Haystack, ElasticSearch, MySQL, Redis, uWSGI, Nginx and many more. -First install `Git `_, `Docker `_ and `docker-compose `_, then run these commands in a terminal:: +On Linux, first install `Git `_, `Docker engine `_ and `docker-compose `_ and open a terminal. + +On MacOSX or Windows install the `Docker Toolbox `_ and open a Docker Quickstart Terminal. + +Then run these commands:: git clone --recursive https://github.com/Parisson/Telemeta.git cd Telemeta - docker-compose up + docker-compose up db + +Press CTRL-C to exit (the last command is needed to init the database). + +Start +===== + +For a production environment setup:: + + docker-compose up -You can now browse http://localhost:8000 +Then browse the app at http://localhost:8000/ (replacing 'localhost' by the IP given by the docker terminal on OSX or Windows) +For a development environment setup:: -Restore / backup + docker-compose -f docker-compose.yml -f env/dev.yml up + +Then browse the app at http://localhost:9000/ (replacing 'localhost' by the IP given by the docker terminal on OSX or Windows) + +To start the application in DEBUG mode:: + + docker-compose -f docker-compose.yml -f env/debug.yml up + + +Backup / Restore ================ -To restore a backuped database, put your backup file in data/backup, then in another terminal:: +To backup the database in the data/backup/ folder, run this in **another** terminal (or a Docker Quickstart Terminal):: + + docker-compose run db /srv/scripts/sql/backup_db.sh - docker-compose run db /srv/backup/restore_db.sh FILENAME +To restore the last backuped database from the data/backup/ folder, run this in **another** terminal (or a Docker Quickstart Terminal):: -where FILENAME is the backup filename (can be .sql or .sql.gz) + docker-compose run db /srv/scripts/sql/restore_db.sh -To backup the database, just run in another terminal:: +If the app is broken after a restore script, restart the composition with:: - docker-compose run db /srv/backup/backup_db.sh + docker-compose restart API / Documentation @@ -205,7 +230,6 @@ Twitter: * https://twitter.com/telemeta * https://twitter.com/parisson_studio -* https://twitter.com/yomguy License diff --git a/scripts/sql/backup_db.sh b/scripts/sql/backup_db.sh index d18a0579..28bc08db 100755 --- a/scripts/sql/backup_db.sh +++ b/scripts/sql/backup_db.sh @@ -1,6 +1,5 @@ #!/bin/bash -PASSWORD=$1 NOW=$(date +"%Y-%m-%d-%T") -mysqldump -hdb -uroot -p$PASSWORD telemeta | gzip > /srv/backup/telemeta-$NOW.sql.gz +mysqldump -hdb -uroot -p$MYSQL_ROOT_PASSWORD telemeta | gzip > /srv/backup/telemeta-$NOW.sql.gz diff --git a/scripts/sql/restore_db.sh b/scripts/sql/restore_db.sh index be4cd5ba..a0689baa 100755 --- a/scripts/sql/restore_db.sh +++ b/scripts/sql/restore_db.sh @@ -1,13 +1,12 @@ #!/bin/bash -PASSWORD=$1 DIR=/srv/backup/ FILE=`ls -t $DIR/*.sql* | head -1` if [[ $FILE == *".gz" ]]; then - gunzip < $FILE | mysql -hdb -uroot -p$PASSWORD telemeta + gunzip < $FILE | mysql -hdb -uroot -p$MYSQL_ROOT_PASSWORD telemeta else - mysql -hdb -uroot -p$PASSWORD telemeta < $FILE + mysql -hdb -uroot -p$MYSQL_ROOT_PASSWORD telemeta < $FILE fi echo "backup restored : "$FILE diff --git a/telemeta/templates/telemeta/inc/module_searches.html b/telemeta/templates/telemeta/inc/module_searches.html index 39772437..b4c21145 100644 --- a/telemeta/templates/telemeta/inc/module_searches.html +++ b/telemeta/templates/telemeta/inc/module_searches.html @@ -20,7 +20,6 @@ {% elif s.search_key == 'advanced' %} {% with s.user_query|build_pattern_dict as queries %} - {% for k, v in queries.items %} {% if v %}
  • {{ k }}: {{ v }}
  • {% endif %} {% endfor %}