Browse Source

prepare working with volumes

Bastien Sevajol (Algoo) 8 years ago
parent
commit
ec9f711d8d

+ 6 - 2
docker/Debian_Uwsgi_PostgreSQL/Dockerfile View File

@@ -25,7 +25,6 @@ RUN apt-get update -q \
25 25
 # Ensure UTF-8
26 26
 RUN locale-gen en_US.UTF-8 en_us \
27 27
     && dpkg-reconfigure locales \
28
-    && dpkg-reconfigure locales \
29 28
     && locale-gen C.UTF-8 \
30 29
     && /usr/sbin/update-locale LANG=C.UTF-8
31 30
 ENV LANG C.UTF-8
@@ -39,8 +38,13 @@ RUN git clone https://github.com/tracim/tracim.git \
39 38
      && cd /tracim \
40 39
      && pip3 install -r install/requirements.txt
41 40
 
41
+# Prepare volumes
42
+RUN mkdir /etc/tracim
43
+VOLUME ["/etc/tracim"]
44
+VOLUME  ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
45
+
42 46
 # Copy needed files
43
-COPY uwsgi.ini /etc/uwsgi/apps-available/tracim.ini
47
+COPY uwsgi.ini /tracim/tracim/uwsgi.ini
44 48
 COPY wsgi.py /tracim/tracim/wsgi.py
45 49
 COPY entrypoint.sh /tracim/entrypoint.sh
46 50
 

+ 17 - 7
docker/Debian_Uwsgi_PostgreSQL/entrypoint.sh View File

@@ -5,6 +5,7 @@
5 5
 # TODO: Supporter le changement des variables d'environnement ? (actuellement utilisé pour générer le .ini)
6 6
 # TODO: Fichiers de config link ls -s dans un dossier pour VOLUME
7 7
 # TODO: README QQCH pour les ports ? 80, 3060 et 5333
8
+# TODO: generate cookie secrent (if not yet done)
8 9
 
9 10
 # Start PostgreSQL
10 11
 service postgresql start
@@ -17,16 +18,25 @@ if ! [ "$( su - postgres -s /bin/bash -c "psql -tAc \"SELECT 1 FROM pg_database
17 18
 fi
18 19
 
19 20
 # Create config.ini file if no exist
20
-if [ ! -f /tracim/tracim/config.ini ]; then
21
-    cp /tracim/tracim/development.ini.base /tracim/tracim/config.ini
22
-    sed -i "s/\(sqlalchemy.url *= *\).*/\1postgresql:\/\/tracim:tracim@127.0.0.1:5432\/tracim?client_encoding=utf8/" /tracim/tracim/config.ini
23
-    # TODO: ENV VAR
21
+if [ ! -f /etc/tracim/config.ini ]; then
22
+    cp /tracim/tracim/development.ini.base /etc/tracim/config.ini
24 23
 fi
24
+ln -s /etc/tracim/config.ini /tracim/tracim/config.ini
25 25
 
26 26
 # Create wsgidav.conf file if no exist
27
-if [ ! -f /tracim/tracim/wsgidav.conf ]; then
28
-    cp /tracim/tracim/wsgidav.conf.sample /tracim/tracim/wsgidav.conf
27
+if [ ! -f /etc/tracim/wsgidav.conf ]; then
28
+    cp /tracim/tracim/wsgidav.conf.sample /etc/tracim/wsgidav.conf
29 29
 fi
30
+ln -s /etc/tracim/wsgidav.conf /tracim/tracim/wsgidav.conf
31
+
32
+# Create uwsgi file if no exist
33
+if [ ! -f /etc/tracim/uwsgi.ini ]; then
34
+    cp /tracim/tracim/uwsgi.ini /etc/tracim/uwsgi.ini
35
+fi
36
+
37
+# Update config with ENV
38
+# TODO Manage other ENV vars
39
+sed -i "s/\(sqlalchemy.url *= *\).*/\1postgresql:\/\/tracim:tracim@127.0.0.1:5432\/tracim?client_encoding=utf8/" /etc/tracim/config.ini
30 40
 
31 41
 # Start with uwsgi
32
-uwsgi --http-socket 0.0.0.0:80 /etc/uwsgi/apps-available/tracim.ini
42
+uwsgi --http-socket 0.0.0.0:80 /etc/tracim/uwsgi.ini