This is my current server setup where I deploy self-hosted applications.
My dead simple setup for self-hosting applications with docker-compose (and traefik).
This config self-sign new applications automatically and make them available to the URL of your choice.
Type Name Value
A @ <VPS_IP>
This record tells that the URL example.com
should point to the VPS IP.
Type Name Value
A * <VPS_IP>
This record tells that the URLs *.example.com
should point to the VPS IP.
acme.json
file.env.example
files to .env
.env
files with your configdocker compose up
apps/newapp/newapp.yml
version: "3.3"
services:
newapp:
image: <DOCKER_IMAGE>
container_name: "newapp"
labels:
- "traefik.enable=true"
- "traefik.http.services.newapp.loadBalancer.server.port=<EXPOSED_PORT_BY_CONTAINER>"
- "traefik.http.routers.newapp.rule=Host(`newapp.${BASE_DOMAIN}`)"
- "traefik.http.routers.newapp.entrypoints=websecure"
- "traefik.http.routers.newapp.tls.certresolver=myresolver"
Replace <DOCKER_IMAGE> and <EXPOSED_PORT_BY_CONTAINER>.
docker-compose.yml
:newapp:
extends:
file: apps/newapp/newapp.yml
service: newapp
docker compose pull app
docker compose up -d --force-recreate --no-deps --build app