Commit 7eb59551d289b8d6335f6c763e36924f3008675c

Authored by Chloé Azria
1 parent 5a28b0c3
Exists in master

change parameters name + create parameters for ports + comment part of entrypoint procedure

Showing 3 changed files with 48 additions and 19 deletions   Show diff stats
.env
1 1 # enter here all key = value you need to path in docker-compose.yaml file
2 2 VERSION=11
3 3  
4   -#as it is in github path
5   -INSTITUTION=PADC
6   -SERVER=voparis-tap-example
7   -DOMAIN=obspm.fr
  4 +###########GITHUB PATH :as the repository is set in gitlab
  5 +GITREPO_INSTITUTION=PADC
  6 +GITREPO_SERVER=voparis-tap-example
  7 +
  8 +
  9 +#Following parameters will take default values if commented :
  10 +DACHS_PORT=80
  11 +#default 80
  12 +AWSTATS_PORT=8080
  13 +#default 8080
  14 +SERVERNAME=localhost
  15 +#name of the host machine - default to localhost, for dev
  16 +#DOMAIN=
  17 +#default to ""
  18 +
  19 +#note the default ports inside the container will be binded to DACHS_PORT and AWSTATS_PORT of the host machine
  20 +
... ...
dachs-dockerfile
... ... @@ -2,11 +2,21 @@ ARG VERSION
2 2 FROM debian:$VERSION
3 3  
4 4 ARG GITURL=https://voparis-gitlab.obspm.fr
5   -ARG SERVER
6   -ARG INSTITUTION
7 5  
  6 +ARG GITREPO_SERVER
  7 +ARG GITREPO_INSTITUTION
8 8 ARG HOMEPATH=/home/dachsroot
9 9  
  10 +###ARGUMENTS WITH ITS DEFAULT VALUES, SET IT IN .ENV IF you want other values
  11 +#RUN if [ -z "$DACHS_PORT" ]; then export DACHS_PORT=80; fi && echo "DACHS_PORT=$DACHS_PORT"
  12 +#ARG DACHS_PORT=$DACHS_PORT
  13 +#
  14 +#RUN if [ -z "$AWSTATS_PORT" ]; then export AWSTATS_PORT=8080; fi
  15 +#ARG AWSTATS_PORT=$AWSTATS_PORT
  16 +
  17 +#RUN if [ -z "$DOMAIN" ]; then export DOMAIN=""; fi
  18 +#ARG DOMAIN=$DOMAIN
  19 +
10 20  
11 21 RUN apt-get -y update
12 22 RUN apt-get -y upgrade
... ... @@ -32,17 +42,18 @@ RUN apt-get install -y openssh-server openssh-client apache2 w3m
32 42 COPY . $HOMEPATH
33 43  
34 44 #import dachs server configuration files from git
35   -RUN echo $GITURL/vespa/dachs/servers/$INSTITUTION/$SERVER.git
36   -RUN git clone $GITURL/vespa/dachs/servers/$INSTITUTION/$SERVER.git $HOMEPATH/server
  45 +RUN echo $GITURL/vespa/dachs/servers/$GITREPO_INSTITUTION/$GITREPO_SERVER.git
  46 +RUN git clone $GITURL/vespa/dachs/servers/$GITREPO_INSTITUTION/$GITREPO_SERVER.git $HOMEPATH/server
37 47  
38 48  
39 49 # copy files at the right path
40 50 RUN cp $HOMEPATH/000-default.conf /etc/apache2/sites-enabled/000-default.conf
41 51 RUN cp $HOMEPATH/ports.conf /etc/apache2/ports.conf
42 52 RUN cp $HOMEPATH/awstats.dachs.conf /etc/awstats/awstats.dachs.conf
43   -RUN cp $HOMEPATH/server/gavo.rc /etc/gavo.rc
44 53 RUN cp $HOMEPATH/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
45 54 RUN chmod +x /usr/bin/docker-entrypoint.sh
  55 +
  56 +RUN cp $HOMEPATH/server/gavo.rc /etc/gavo.rc
46 57 RUN cp $HOMEPATH/server/defaultmeta.txt /var/gavo/etc/defaultmeta.txt
47 58 RUN mkdir /var/gavo/web/nv_static/img/ -p
48 59 RUN cp $HOMEPATH/logos/* /var/gavo/web/nv_static/img/
... ... @@ -50,10 +61,14 @@ RUN cp $HOMEPATH/logos/* /var/gavo/web/nv_static/img/
50 61  
51 62 #import services from git
52 63 #clone all repositories from the group -- only if the gitlab project is Public
53   -RUN wget -O $HOMEPATH/group.json $GITURL'/api/v4/groups/vespa%2Fdachs%2Fservices%2F'$INSTITUTION'%2F'$SERVER
  64 +RUN wget -O $HOMEPATH/group.json $GITURL'/api/v4/groups/vespa%2Fdachs%2Fservices%2F'$GITREPO_INSTITUTION'%2F'$GITREPO_SERVER
54 65 RUN mkdir $HOMEPATH/services/ && cd $HOMEPATH/services/ && egrep -o 'https://[^"]+\.git' $HOMEPATH/group.json|xargs -n 1 -P 8 git clone
55 66 RUN cp -r $HOMEPATH/services/* /var/gavo/inputs/
56 67  
  68 +#extract parameters values from gavo.rc
  69 +
  70 +
  71 +
57 72 ###
58 73 #dachs configuration
59 74 ###
... ... @@ -82,8 +97,8 @@ RUN chgrp 755 /etc/cron.daily/awstats
82 97 ###
83 98 # script to set up services
84 99 ###
85   -RUN echo "cd $HOMEPATH/$SERVER/$GIT/" >> /usr/bin/docker-entrypoint.sh
86   -RUN echo "git pull" >> /usr/bin/docker-entrypoint.sh
  100 +#RUN echo "cd $HOMEPATH/$SERVER/$GIT/" >> /usr/bin/docker-entrypoint.sh
  101 +#RUN echo "git pull" >> /usr/bin/docker-entrypoint.sh
87 102  
88 103 # add to the script to maintain docker up
89 104 RUN echo "tail -f /dev/null" >> /usr/bin/docker-entrypoint.sh
... ...
docker-compose.yml
... ... @@ -12,18 +12,19 @@ services:
12 12 - "22"
13 13 ports:
14 14 - "2222:22"
15   - - "80:80"
16   - - "8080:8080"
  15 + - "${DACHS_PORT}:80"
  16 + - "${AWSTATS_PORT}:8080"
17 17 build:
18 18 context: .
19 19 dockerfile: dachs-dockerfile
20 20 args:
21 21 - "VERSION=${VERSION}"
22   - - "INSTITUTION=${INSTITUTION}"
23   - - "SERVER=${SERVER}"
24   -# 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)
  22 + - "GITREPO_INSTITUTION=${GITREPO_INSTITUTION}"
  23 + - "GITREPO_SERVER=${GITREPO_SERVER}"
  24 +
  25 +### 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)
25 26 # volumes:
26 27 # - ./data:/home/dachsroot/data
27 28  
28   -# uncomment for production
29   -# restart: always
  29 +### To uncomment for production :
  30 +# restart: always
... ...