wtree Cloud

Compose example

Deploy a Next.js app from a compose file in a Git repository and serve it on your own domain with HTTPS.

This walkthrough deploys a compose repository and routes a domain to it with hand-written labels. For most stacks Settings › Domains is simpler: see Compose domains.

Before you start

  • A Git repository with a docker-compose.yml.
  • A domain whose A record points to your server.

Deploy

Create a project, click New and choose Compose, then set Compose type to Docker Compose.

Choose the provider (GitHub or Git), repository, and branch such as main.

Open Settings › Source and set Compose path to ./docker-compose.yml and save.

Compose source settings

Update the compose file: attach the service to w3panel-network and add Traefik labels.

docker-compose.yml
services:
  next-app:
    build:
      context: ./next-app
      dockerfile: prod.Dockerfile
      args:
        ENV_VARIABLE: ${ENV_VARIABLE}
        NEXT_PUBLIC_ENV_VARIABLE: ${NEXT_PUBLIC_ENV_VARIABLE}
    restart: always
    ports:
      - 3000
    networks:
      - w3panel-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.<unique-name>.rule=Host(`your-domain.com`)"
      - "traefik.http.routers.<unique-name>.entrypoints=websecure"
      - "traefik.http.routers.<unique-name>.tls.certResolver=letsencrypt"
      - "traefik.http.services.<unique-name>.loadbalancer.server.port=3000"

networks:
  w3panel-network:
    external: true

On Overview, click Deploy and wait for the deployment to finish.

Compose domain configuration

Don't set container_name on services. It breaks logs, metrics and other features.

Verify

Wait about 10 seconds for Traefik to issue the certificate, then open your domain.

Deployed application

Config notes

  • Router and service names must be unique across your stacks.
  • The service must be on w3panel-network.
  • Use websecure plus the letsencrypt resolver for HTTPS.
  • On Docker Stack, move the labels under deploy.labels.

Next steps

On this page