Browse Source

document installation for Debian

Victor Noël 7 years ago
parent
commit
a35bc14fd8
4 changed files with 41 additions and 53 deletions
  1. 34 39
      README.md
  2. 5 1
      docker-compose.yml
  3. 0 13
      homepage/README.md
  4. 2 0
      traefik/traefik.toml

+ 34 - 39
README.md

@@ -2,24 +2,36 @@
 
 [Pad](https://mypads.framapad.org/mypads/?/mypads/group/altermediatic-toulouse-deatm79d/pad/view/docker-atelier-acqwh7km)
 
-## Install on a clean Arch
+## Install
 
 ```
-# Set variables
-export LANG=en_US.UTF-8
-export DOMAIN=oxyta.net
-export MAIL=services@$DOMAIN
-export MYSQL_PASSWORD=$(openssl rand -base64 32)
-export MYSQL_ROOT_PASSWORD=$(openssl rand -base64 32)
-
-echo LANG="$LANG" > /etc/locale.conf
-mkdir -p /etc/nginx/sites-enabled/ /srv/letsencrypt ~/.ssh
-
-# Install packages
-pacman -Syu --noconfirm git docker docker-compose nginx certbot msmtp-mta
+# Install docker
+# See https://docs.docker.com/engine/installation/linux/docker-ce/debian/#install-using-the-repository
+apt install \
+     apt-transport-https \
+     ca-certificates \
+     curl \
+     gnupg2 \
+     software-properties-common
+
+curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
+
+echo \
+   "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
+   $(lsb_release -cs) \
+   stable" \
+   > /etc/apt/source.list.d/docker.list
+
+apt update && apt install docker-ce msmtp python-pip
+
+# install docker-compose
+pip install docker-compose
+
+# Start docker
 systemctl start docker
 systemctl enable docker
-systemctl enable nginx
+
+# Change SSH port (because 22 will be used by gitlab)
 echo 'Port 222' >> /etc/ssh/sshd_config
 systemctl restart sshd
 
@@ -35,35 +47,18 @@ cd
 git clone https://framagit.org/altermediatic/docker-atelier.git
 cd docker-atelier
 
-# Get main Lets Encrypt cert
-
-cp nginx.conf /etc/nginx
-systemctl restart nginx
-certbot certonly --email $MAIL --webroot -w /srv/letsencrypt/ --agree-tos -n -d  $(echo {,www.}{,pad.,git.,cloud.}$DOMAIN|tr ' ' ',')
-
-# Set environment configuration
-
-echo "MYSQL_PASSWORD=$MYSQL_PASSWORD" > cloud/.env
-echo "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD" >> cloud/.env
-echo "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD" > pad/.env
-echo "ETHERPAD_DB_PASSWORD=$MYSQL_ROOT_PASSWORD" >> pad/.env
+# Configure environment variables in setup.sh then run it
+./setup.sh
 
 # Deploy Services
-
-for service in pad git cloud homepage
-do
-    pushd $service
-    ln -s $PWD/nginx.conf /etc/nginx/sites-enabled/$service
-    docker-compose up -d
-    popd
-done
-
-# Restart nginx
-
-systemctl restart nginx
-
+# Note: docker-compose's traefik.docker.network contains references to the project's name (see https://github.com/containous/traefik/issues/2348)
+docker-compose -d -p oxyta up
 ```
 
 ## Configure mail
 
 [doc](mail)
+
+## Update homepage
+
+docker-compose build --no-cache

+ 5 - 1
docker-compose.yml

@@ -1,4 +1,4 @@
-version: '2'
+version: '3'
 
 services:
 
@@ -25,6 +25,7 @@ services:
       - traefik
     labels:
       - "traefik.backend=nextcloud"
+      # See README and https://github.com/containous/traefik/issues/2348 for network name
       - "traefik.docker.network=oxyta_traefik"
       - "traefik.frontend.rule=Host:cloud.${CHATONS_DOMAIN}"
       - "traefik.enable=true"
@@ -48,6 +49,7 @@ services:
     hostname: 'git.${CHATONS_DOMAIN}' # required by gitlab
     labels:
       - "traefik.backend=gitlab"
+      # See README and https://github.com/containous/traefik/issues/2348 for network name
       - "traefik.docker.network=oxyta_traefik"
       - "traefik.frontend.rule=Host:git.${CHATONS_DOMAIN}"
       - "traefik.enable=true"
@@ -71,6 +73,7 @@ services:
       - traefik
     labels:
       - "traefik.backend=homepage"
+      # See README and https://github.com/containous/traefik/issues/2348 for network name
       - "traefik.docker.network=oxyta_traefik"
       # note: www must also be present because we need its certificate
       # and it is required for traefik redirection to work too (in traefik.yml)
@@ -106,6 +109,7 @@ services:
       - ETHERPAD_TITLE=Bloc Note
     labels:
       - "traefik.backend=etherpad"
+      # See README and https://github.com/containous/traefik/issues/2348 for network name
       - "traefik.docker.network=oxyta_traefik"
       - "traefik.frontend.rule=Host:pad.${CHATONS_DOMAIN}"
       - "traefik.enable=true"

+ 0 - 13
homepage/README.md

@@ -1,13 +0,0 @@
-# Homepage in frontal_app
-
-## Install
-
-    cd homepage
-    ln -s $PWD/nginx.conf /etc/nginx/sites-enabled/frontal
-    docker-compose up -d
-
-## Update
-
-    cd homepage
-    docker-compose build --no-cache
-    docker-compose up -d

+ 2 - 0
traefik/traefik.toml

@@ -22,11 +22,13 @@ defaultEntryPoints = ["https","http"]
   [entryPoints.https.tls]
 
 [docker]
+# the domain is set on the command line
 endpoint = "unix:///var/run/docker.sock"
 watch = true
 exposedbydefault = false
 
 [acme]
+# the email is set on the command line
 storage = "acme.json"
 entryPoint = "https"
 OnHostRule = true