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
 # Ensure UTF-8
25
 # Ensure UTF-8
26
 RUN locale-gen en_US.UTF-8 en_us \
26
 RUN locale-gen en_US.UTF-8 en_us \
27
     && dpkg-reconfigure locales \
27
     && dpkg-reconfigure locales \
28
-    && dpkg-reconfigure locales \
29
     && locale-gen C.UTF-8 \
28
     && locale-gen C.UTF-8 \
30
     && /usr/sbin/update-locale LANG=C.UTF-8
29
     && /usr/sbin/update-locale LANG=C.UTF-8
31
 ENV LANG C.UTF-8
30
 ENV LANG C.UTF-8
39
      && cd /tracim \
38
      && cd /tracim \
40
      && pip3 install -r install/requirements.txt
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
 # Copy needed files
46
 # Copy needed files
43
-COPY uwsgi.ini /etc/uwsgi/apps-available/tracim.ini
47
+COPY uwsgi.ini /tracim/tracim/uwsgi.ini
44
 COPY wsgi.py /tracim/tracim/wsgi.py
48
 COPY wsgi.py /tracim/tracim/wsgi.py
45
 COPY entrypoint.sh /tracim/entrypoint.sh
49
 COPY entrypoint.sh /tracim/entrypoint.sh
46
 
50
 

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

5
 # TODO: Supporter le changement des variables d'environnement ? (actuellement utilisé pour générer le .ini)
5
 # TODO: Supporter le changement des variables d'environnement ? (actuellement utilisé pour générer le .ini)
6
 # TODO: Fichiers de config link ls -s dans un dossier pour VOLUME
6
 # TODO: Fichiers de config link ls -s dans un dossier pour VOLUME
7
 # TODO: README QQCH pour les ports ? 80, 3060 et 5333
7
 # TODO: README QQCH pour les ports ? 80, 3060 et 5333
8
+# TODO: generate cookie secrent (if not yet done)
8
 
9
 
9
 # Start PostgreSQL
10
 # Start PostgreSQL
10
 service postgresql start
11
 service postgresql start
17
 fi
18
 fi
18
 
19
 
19
 # Create config.ini file if no exist
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
 fi
23
 fi
24
+ln -s /etc/tracim/config.ini /tracim/tracim/config.ini
25
 
25
 
26
 # Create wsgidav.conf file if no exist
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
 fi
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
 # Start with uwsgi
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