what would be the most confortable and less overhead aproach to deployingconstantly new sites to a server with docker-compose/swarm
(im not very brilliant so please bear with me also engllish is not my first language sorry if the prose feels weird) what would be the most confortable and less overhead aproach to deploying constantly new sites to a server with docker currently i was following a tutorial ( youtube.com/watch ) which uses docker swarm with treafik and lets encrypt to handle a lot of the annoying stuff (load balancing, https certificate, ports exposing and binding to the domain names) so from the traefik official docs ( doc.traefik.io/traefik/setup/swarm ) i ended up with this `yaml secrets: cloudflare-token: file: "./secrets/cloudflare-token.secret" traefik-credentials: file: "./secrets/traefik-credentials.secret" services: traefik: image: traefik:v3.7 networks: - traefik_proxy ports: - target: 80 published: 80 protocol: tcp mode: host - target: 443 published: 443 protocol: tcp mode: host environment: TRAEFIK_DASHBOARD_CREDENTIALS: /run/secrets/traefik-credentials CF_DNS_API_TOKEN_FILE: /run/secrets/cloudflare-token volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./letsencrypt:/letsencrypt secrets: - cloudflare-token command: # HTTP EntryPoint - "--entrypoints.web.address=:80" # Configure HTTP to HTTPS Redirection - "--entrypoints.web.http.redirections.entrypoint.to=websecure" - "--entrypoints.web.http.redirections.entrypoint.scheme=https" - "--entrypoints.web.http.redirections.entrypoint.permanent=true" # HTTPS EntryPoint - "--entrypoints.websecure.address=:443" - "--entrypoints.websecure.http.tls=true" # TLS - "--entrypoints.https.http.tls=true" - "--entrypoints.https.http.tls.certResolver=letsencrypt" - "--entrypoints.https.http.tls.domains[0].main=cooldomainname.com" - "--entrypoints.https.http.tls.domains[0].sans=*.cooldomainname.com" # Let's Encrypt DNS challenge with Cloudflare - "--certificatesresolvers.letsencrypt.acme.dnschallenge=true" - "--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare" - "--certificatesResolvers.letsencrypt.acme.dnschallenge.resolvers=1.1.1.1:53,1.0.0.1:53" - "--certificatesresolvers.letsencrypt.acme.dnschallenge.propagation.delayBeforeChecks=20" - "--certificatesresolvers.letsencrypt.acme.email=xxxxxxxxx@yyyyy.com" - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json" - "--certificatesresolvers.letsencrypt.acme.certificatesDuration=1080" # Providers # Enable the Docker Swarm provider (instead of Docker provider) - "--providers.swarm.endpoint=unix:///var/run/docker.sock" # Watch for Swarm service changes (requires socket access) - "--providers.swarm.watch=true" # Recommended: Don't expose services by default; require explicit labels - "--providers.swarm.exposedbydefault=false" # Specify the default network for Traefik to connect to services - "--providers.swarm.network=traefik_proxy" # API & Dashboard - "--api.dashboard=true" # Enable the dashboard - "--api.insecure=false" # Explicitly disable insecure API mod # Observability - "--log.level=INFO" # Set the Log Level e.g INFO, DEBUG - "--accesslog=true" # Enable Access Logs - "--metrics.prometheus=true" # Enable Prometheus deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager labels: - "traefik.enable=true" # Dashboard router - "traefik.http.routers.dashboard.rule=Host(dashboard.cooldomainname.com)" - "traefik.http.routers.dashboard.entrypoints=websecure" - "traefik.http.routers.dashboard.service=api@internal" - "traefik.http.routers.dashboard.tls=true" # Basic‑auth middleware - "traefik.http.routers.dashboard.middlewares=dashboard-auth@swarm" - "traefik.http.middlewares.dashboard-auth.basicauth.users=${TRAEFIK_DASHBOARD_CREDENTIALS}" # Service hint - "traefik.http.services.traefik.loadbalancer.server.port=8080" # Define the overlay network for Swarm networks: traefik_proxy: name: traefik_proxy driver: overlay attachable: true and then changing the docker context from my local machine into an ssh pointing into my server, i thought i could just append a new service into the stack when writing a new yaml file, and update it when i wanted (all from my local machine, later i would like to put it into codeberg's version of github actions) example: yaml services: whoami: image: traefik/whoami networks: - traefik_proxy labels: # Enable Service discovery for Traefik - "traefik.enable=true" # Define the WHoami router rule - "traefik.http.routers.whoami.rule=Host(whoami.cooldomainname.com)" # Expose Whoami on the HTTPS entrypoint - "traefik.http.routers.whoami.entrypoints=websecure" # Enable TLS - "traefik.http.routers.whoami.tls=true" # Expose the whoami port number to Traefik - "traefik.http.services.whoami.loadbalancer.server.port=80" networks: traefik_proxy: external: true but this doesn't work, i could not find a way to add stuff into the current stack using a compose file the only way i found was this one docker service create \ --name whoami \ --label traefik.enable="true" \ --label traefik.http.routers.whoami.rule='Host(whoami.cooldomainname.com`)' \ --label traefik.http.routers.whoami.entrypoints="websecure" \ --label traefik.http.routers.whoami.tls="true" \ --label traefik.http.services.whoami.loadbalancer.server.port="80" \ --network traefik_proxy \ traefik/whoami which is kinda okay but as far as i know this cannot use a compose.yaml file (my guess would be because this is just one service, and the compose ones are for more than one, and is not suitable for my use case, because there would be another web apps that have their own db service, so this is not good for me and doesn't feel that ergonomic) so basically all i want is an easy way to deploy more apps into my server, update them when i want (like pushing into the main branch) with or without swarm, whatever fits my needs, but i would really like to know why would swarm be the right tool for this (like doing some tech debt prevention when my services are more complicated)