# Webhosting with Docker-Compose The server setup is done with SysDB and Hiera/Puppet. See the respective documentation [here](https://gitea.psi.ch/puppet/data-lx/src/branch/master/default/lx-docker-01.psi.ch.yaml) and [here](https://gitea.psi.ch/puppet/data-lx/src/branch/master/default/lx-docker-dmz-01.psi.ch.yaml). lx-docker-01.psi.ch is used for 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://gitea.psi.ch/puppet/data-lx/src/branch/master/default/lx-docker-01.psi.ch.yaml]() - [https://gitea.psi.ch/puppet/data-lx/src/branch/master/default/lx-docker-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 considered 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, request an initial ACME key and csr via the `get-cert.sh` in the root folder of the machine. ``` get-cert.sh ``` 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.