Files
2025-05-07 14:34:07 +02:00

41 lines
2.5 KiB
Markdown

# 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://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-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.