Commit d2ebcd281a6218315ea784c30da978c170e087b9

Authored by Chloé Azria
1 parent 7056e291
Exists in master

add a parameter for container name

Showing 3 changed files with 17 additions and 12 deletions   Show diff stats
@@ -6,6 +6,9 @@ GITREPO_INSTITUTION=PADC @@ -6,6 +6,9 @@ GITREPO_INSTITUTION=PADC
6 GITREPO_SERVER=voparis-tap-example 6 GITREPO_SERVER=voparis-tap-example
7 7
8 8
  9 +
  10 +#########Be careful, the .env parameters have priority on gavo.rc from gitlab
  11 +
9 #Following parameters will take default values if commented : 12 #Following parameters will take default values if commented :
10 DACHS_PORT=81 13 DACHS_PORT=81
11 #default 80 14 #default 80
@@ -14,9 +17,10 @@ APACHE_PORT=8081 @@ -14,9 +17,10 @@ APACHE_PORT=8081
14 SERVERNAME=localhost 17 SERVERNAME=localhost
15 #name of the host machine - default to localhost, for dev 18 #name of the host machine - default to localhost, for dev
16 DOMAIN= 19 DOMAIN=
17 -#default to "" 20 +#default to empty string for localhost
18 PROTOCOL=http 21 PROTOCOL=http
19 #default to http 22 #default to http
  23 +CONTAINER_NAME=dachs_voparis
20 24
21 #note the default ports inside the container will be binded to DACHS_PORT and AWSTATS_PORT of the host machine 25 #note the default ports inside the container will be binded to DACHS_PORT and AWSTATS_PORT of the host machine
22 26
conf/dachs-dockerfile
@@ -66,7 +66,7 @@ RUN cp -r $HOMEPATH/services/* /var/gavo/inputs/ @@ -66,7 +66,7 @@ RUN cp -r $HOMEPATH/services/* /var/gavo/inputs/
66 ###### 66 ######
67 67
68 ##Adapt 000-default.conf ports and maintainer (taken from gavo.rc) 68 ##Adapt 000-default.conf ports and maintainer (taken from gavo.rc)
69 -RUN export maintainerAddress=`grep "^maintainerAddress:" /etc/gavo.rc | cut -d ":" -f 2` && sed -i "s/webmaster@localhost/${maintainerAddress}/g" /etc/apache2/sites-enabled/000-default.conf && less /etc/apache2/sites-enabled/000-default.conf 69 +RUN export maintainerAddress=`grep "^maintainerAddress:" /etc/gavo.rc | cut -d ":" -f 2` && sed -i "s/webmaster@localhost/${maintainerAddress}/g" /etc/apache2/sites-enabled/000-default.conf
70 RUN sed -i "s/8080/${APACHE_PORT}/g" /etc/apache2/sites-enabled/000-default.conf 70 RUN sed -i "s/8080/${APACHE_PORT}/g" /etc/apache2/sites-enabled/000-default.conf
71 71
72 ##Adapt ports.conf with APACHE PORT 72 ##Adapt ports.conf with APACHE PORT
@@ -85,12 +85,17 @@ RUN sed -i "/serverPort/c\serverPort:${DACHS_PORT}" /etc/gavo.rc @@ -85,12 +85,17 @@ RUN sed -i "/serverPort/c\serverPort:${DACHS_PORT}" /etc/gavo.rc
85 RUN sed -i "/corsOriginPat/c\corsOriginPat:${PROTOCOL}.*" /etc/gavo.rc 85 RUN sed -i "/corsOriginPat/c\corsOriginPat:${PROTOCOL}.*" /etc/gavo.rc
86 86
87 RUN if [ "$SERVERNAME" = "localhost" ]; then \ 87 RUN if [ "$SERVERNAME" = "localhost" ]; then \
  88 + less /etc/gavo.rc &&\
88 sed -i "/serverURL/c\serverURL:" /etc/gavo.rc &&\ 89 sed -i "/serverURL/c\serverURL:" /etc/gavo.rc &&\
89 - echo "############################ WARNING gavo.rc overwrite -- localhost for dev only ###############################" \ 90 + echo "############################ WARNING gavo.rc overwrite -- use localhost for dev only ###############################" \
  91 + less /etc/gavo.rc \
90 ; else \ 92 ; else \
  93 + less /etc/gavo.rc &&\
91 sed -i "/serverURL/c\serverURL:${PROTOCOL}://${SERVERNAME}.${DOMAIN}:${DACHS_PORT}" /etc/gavo.rc &&\ 94 sed -i "/serverURL/c\serverURL:${PROTOCOL}://${SERVERNAME}.${DOMAIN}:${DACHS_PORT}" /etc/gavo.rc &&\
92 - echo "Warning : gavo.rc overwritten by .env servername, domain, protocol and port values" \ 95 + echo "Warning : gavo.rc overwritten by .env servername, domain, protocol and port values" &&\
  96 + less /etc/gavo.rc \
93 ; fi 97 ; fi
  98 +
94 99
95 ### 100 ###
96 #dachs configuration 101 #dachs configuration
conf/docker-compose.yml
@@ -2,8 +2,8 @@ version: "3.5" @@ -2,8 +2,8 @@ version: "3.5"
2 services: 2 services:
3 3
4 dachs: 4 dachs:
5 - container_name: dachs-voparis  
6 - image: dachs-voparis 5 + container_name: ${CONTAINER_NAME}
  6 + image: ${CONTAINER_NAME}
7 7
8 tty: true 8 tty: true
9 expose: 9 expose:
@@ -27,12 +27,8 @@ services: @@ -27,12 +27,8 @@ services:
27 - "DOMAIN=${DOMAIN}" 27 - "DOMAIN=${DOMAIN}"
28 - "PROTOCOL=${PROTOCOL}" 28 - "PROTOCOL=${PROTOCOL}"
29 volumes: 29 volumes:
30 - #- ../apache/cgi-bin:/home/dachsroot/apache/cgi-bin  
31 - ../apache/logapache:/var/log/apache2 30 - ../apache/logapache:/var/log/apache2
32 - ../apache/dachslogs:/var/gavo/logs 31 - ../apache/dachslogs:/var/gavo/logs
33 -  
34 # example if you need to mount volumes (e.g if your service needs to parse files or if you want to upload it through dachs) 32 # example if you need to mount volumes (e.g if your service needs to parse files or if you want to upload it through dachs)
35 - #- paht/to/data:/var/gavo/inputs/service/data  
36 -  
37 -### To uncomment for production :  
38 -# restart: always 33 + #- path/to/data:/var/gavo/inputs/<<service>>/data
  34 + restart: always