]> git.parisson.com Git - mezzo.git/commitdiff
add scripts dir and full restore / backup scripts
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 29 Feb 2016 16:54:19 +0000 (17:54 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 29 Feb 2016 16:54:19 +0000 (17:54 +0100)
app/festival/templates/festival/artist_detail.html
docker-compose.yml
scripts/backup.sh [new file with mode: 0755]
scripts/backup_db.sh [new file with mode: 0755]
scripts/backup_db_eve.sh [new file with mode: 0755]
scripts/restore.sh [new file with mode: 0755]
scripts/restore_db.sh [new file with mode: 0755]
scripts/restore_db_eve.sh [new file with mode: 0755]

index 5e12a66b91e4f2c5f6535644d5b692f09446ec27..18fbda581b3776c2384b25ba109c56b7d1f5c0e2 100644 (file)
@@ -10,7 +10,9 @@
 
 <div class="artist-bio">
  <p>
-  <img class="{% if artist.photo_alignment == 'left' %}image-left{% elif artist.photo_alignment == 'right' %}image-right{% else %}image-center{% endif %}" src="{{ MEDIA_URL }}/{{ artist.photo }}" />
+  {% if artist.photo %}
+   <img class="{% if artist.photo_alignment == 'left' %}image-left{% elif artist.photo_alignment == 'right' %}image-right{% else %}image-center{% endif %}" src="{{ MEDIA_URL }}/{{ artist.photo }}" />
+  {% endif %}
   {{ artist.bio|safe }}
   <br style="clear: both;" />
  </p>
index aeff9eca31190a05ec54f4b44841cba84a4dabb4..cac1294c64d299f5a7f9f2f2a1f0d5af65401d89 100644 (file)
@@ -33,6 +33,7 @@ db:
     - data
   volumes:
     - ./data/var/lib/mysql/:/var/lib/mysql
+    - ./scripts/:/srv/scripts
   environment:
     - MYSQL_ROOT_PASSWORD=hyRob0otlaz4
     - MYSQL_DATABASE=manifeste
diff --git a/scripts/backup.sh b/scripts/backup.sh
new file mode 100755 (executable)
index 0000000..14175e7
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+docker-compose run db /srv/scripts/backup_db.sh
+git add data/media
+git commit -a -m "update DB and media"
+git push
diff --git a/scripts/backup_db.sh b/scripts/backup_db.sh
new file mode 100755 (executable)
index 0000000..d3d4d26
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+mysqldump -hdb -uroot -phyRob0otlaz4 manifeste | gzip > /srv/backup/manifeste.sql.gz
diff --git a/scripts/backup_db_eve.sh b/scripts/backup_db_eve.sh
new file mode 100755 (executable)
index 0000000..888a3c2
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+pg_dump -hpgdb -Upostgres eve | gzip > /srv/backup/eve.sql.gz
diff --git a/scripts/restore.sh b/scripts/restore.sh
new file mode 100755 (executable)
index 0000000..271fe77
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+sudo chown -R $USER ../data/media
+sudo chown -R $USER ../data/backup
+git pull
+docker-compose run db /srv/scripts/restore_db.sh
diff --git a/scripts/restore_db.sh b/scripts/restore_db.sh
new file mode 100755 (executable)
index 0000000..04a3f72
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+gunzip < /srv/backup/manifeste.sql.gz | mysql -hdb -uroot -phyRob0otlaz4 manifeste
+echo "Restore done!"
diff --git a/scripts/restore_db_eve.sh b/scripts/restore_db_eve.sh
new file mode 100755 (executable)
index 0000000..d29766d
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+export PGPASSWORD="mysecretpassword"
+db_exists=`psql -hpgdb -Upostgres -lqt  | cut -d \| -f 1 | grep -w eve | wc -l`
+
+if [ $db_exists == 0 ]; then
+    psql -hpgdb -Upostgres -c 'create role eve'
+else
+    psql -hpgdb -Upostgres  -c 'drop database eve'
+fi
+
+psql -hpgdb -Upostgres -c 'create database eve'
+gunzip -c /srv/backup/eve.sql.gz | psql -hpgdb -Upostgres -q eve