diff --git a/_toc.yml b/_toc.yml index 6986902c..858a01a2 100644 --- a/_toc.yml +++ b/_toc.yml @@ -170,6 +170,7 @@ chapters: - file: engineering-guide/lxweb00 - file: engineering-guide/gitea - file: engineering-guide/gitea-dmz + - file: engineering-guide/webhosting - file: engineering-guide/infrastructure_administration - file: engineering-guide/troubleshooting - file: engineering-guide/accounts-and-groups diff --git a/engineering-guide/webhosting.md b/engineering-guide/webhosting.md new file mode 100644 index 00000000..761323c1 --- /dev/null +++ b/engineering-guide/webhosting.md @@ -0,0 +1,40 @@ +# Webhosting with Docker-Compose +The server setup is done with SysDB and Hiera/Puppet. See the respective documentation there. +lx-docker-01.psi.ch can be used for quick deployments which only need to be available inside PSI network, or as test stage for lx-docker-dmz-01.psi.ch. + +SysDB: +``` +lx-docker-01.psi.ch lx local ipxe_installer=rhel9install network=static puppet_env=prod puppet_role=role::server +lx-docker-dmz-01.psi.ch lx local ipxe_installer=rhel9install network=static puppet_env=prod puppet_group=default puppet_role=role::server +``` +Their respective hiera configurations: +https://git.psi.ch/linux-infra/hiera/data-lx/-/blob/master/default/lx-docker-01.psi.ch.yaml +https://git.psi.ch/linux-infra/hiera/data-lx/-/blob/master/default/lx-docker-dmz-01.psi.ch.yaml + +Docker Compose and Nginx reverse proxy configuration +https://gitea.psi.ch/linux/WebHosting +https://gitea.psi.ch/linux/WebHosting_DMZ + +## Functionality +The docker-compose file holds the configuration of all containers that should be deployed as well as the Nginx. +On both servers there are symlinks from `/opt/WebHosting/nginx.conf -> /etc/nginx/nginx.conf` and `/opt/WebHosting/conf.d/ -> /etc/nginx/conf.d/`. For now a `git pull` is configured with HTTPS and prompts for a login. + +### Docker Compose +The docker network is segmented with docker networks. These can be seen at the bottom of the compose file. It is concidered best practice to put a DB that is only used by one service into its own "backend". An example can be gathered from hedgedoc. + +### Deployment lx-docker-01.psi.ch +1. To deploy a new app, create a new key and csr in `/etc/pki/tls/{misc,private}` and request a new certificate on Digicert. +2. Edit the docker-compose.yaml with your docker configurations +3. Create a new conf.d nginx config +4. Push the changes +5. Login to lx-docker-01.psi.ch, `cd /opt/WebHosting` and git pull +6. docker compose up -d + +### Deployment on lx-docker-dmz-01.psi.ch +Skip step 1, since the Nginx is using a single certificate to communicate with the WAF. +Create a group chat in MS Teams with Sem Bühlmann and the person requesting the service and inform Sem about the FQDN and configuration. + +### Update containers +Since this server do not have internet access, the Nginx and PostgreSQL need to be available on https://gitea.psi.ch/images/. +Update the version numbers in docker-compose.yaml and `docker compose up -d` or if you want to prepare all the images for a future update `docker compose pull` . You can add a service name defined in docker-compose.yaml to just pull a single containers update. +