Skip to content

Prod#18

Merged
eloiberlinger1 merged 6 commits intomainfrom
prod
Apr 7, 2026
Merged

Prod#18
eloiberlinger1 merged 6 commits intomainfrom
prod

Conversation

@eloiberlinger1
Copy link
Copy Markdown
Member

This pull request updates the production Docker Compose configuration to improve network naming consistency, simplify environment variable usage, and add Traefik reverse proxy labels for the frontend service. The changes enhance deployment reliability and make the configuration easier to manage.

Docker Compose configuration improvements:

  • Changed the Docker network name default from proxy-tier to default in .env.example to align with typical Docker conventions and reduce confusion.
  • Simplified env_file usage by specifying .env directly for all services, and streamlined required environment variable error messages for clarity. [1] [2]
  • Renamed internal Docker networks from setrsoft_network and proxy-tier to internal_bridge and public_gateway for clearer separation of internal and external traffic, and updated network references throughout the Compose file. [1] [2]

Traefik reverse proxy integration:

  • Added Traefik labels to the web (frontend) service to enable automatic HTTPS, HTTP-to-HTTPS redirection, and integration with Let's Encrypt for TLS certificates. This improves security and simplifies external access configuration.
  • Set the frontend service to automatically restart unless stopped, increasing reliability in production deployments.

…or network and environment variable improvements

- Changed Docker network name in .env.example to 'default'.
- Updated docker-compose.prod.yml to use the new internal_bridge and public_gateway networks.
- Simplified environment variable references for PostgreSQL and other services.
- Added Traefik labels for the frontend service to enable routing.
Copilot AI review requested due to automatic review settings April 7, 2026 06:09
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the production Docker Compose configuration to integrate Traefik for automated HTTP-to-HTTPS redirection and TLS termination. It also renames internal networks for clarity and simplifies environment variable error messages. Feedback focuses on improving the robustness of the network configuration by avoiding the reserved name 'default' for external networks, ensuring fallback values for network variables to prevent deployment failures, and using the existing SERVER_IP variable instead of hardcoded domain names in Traefik routing rules.

Comment thread docker-compose.prod.yml Outdated
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.docker.network=${DOCKER_NETWORK_NAME:-}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Providing an empty fallback for the Traefik network label can lead to routing issues if the container is attached to multiple networks (as it is here with internal_bridge and public_gateway). Traefik needs to know explicitly which network to use to reach the container. This should have a sensible default that matches the network definition at the bottom of the file.

      - "traefik.docker.network=${DOCKER_NETWORK_NAME:-proxy-tier}"

Comment thread docker-compose.prod.yml Outdated
public_gateway:
external: true
name: ${DOCKER_NETWORK_NAME:-proxy-tier}
name: ${DOCKER_NETWORK_NAME} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Removing the default value for the external network name makes the configuration brittle. If DOCKER_NETWORK_NAME is not defined in the environment, Docker Compose will fail to find the external network. It is safer to keep a default value (e.g., proxy-tier or proxy).

    name: ${DOCKER_NETWORK_NAME:-proxy-tier}

Comment thread .env.example
# Docker
DOCKER_NETWORK_NAME=proxy-tier
#Docker
DOCKER_NETWORK_NAME=default
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using default as the name for an external network is highly discouraged. In Docker Compose, default is a reserved name for the network automatically created for each project. Setting DOCKER_NETWORK_NAME=default for an external: true network will likely cause conflicts or lead to the container connecting to the wrong network. It is recommended to use a more descriptive name like proxy or traefik-public to avoid confusion with Docker's internal networking.

Comment thread docker-compose.prod.yml
- "traefik.enable=true"
- "traefik.docker.network=${DOCKER_NETWORK_NAME:-}"
# HTTP → redirect HTTPS
- "traefik.http.routers.setrsoft-http.rule=Host(`setrsoft.com`) || Host(`www.setrsoft.com`)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The domain name is hardcoded, which limits the flexibility of the production configuration. It is better to use the ${SERVER_IP} variable defined in the environment to ensure consistency and easier deployment to different environments.

      - "traefik.http.routers.setrsoft-http.rule=Host(`${SERVER_IP}`) || Host(`www.${SERVER_IP}`)"

Comment thread docker-compose.prod.yml
- "traefik.http.routers.setrsoft-http.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# HTTPS
- "traefik.http.routers.setrsoft-https.rule=Host(`setrsoft.com`) || Host(`www.setrsoft.com`)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The domain name is hardcoded here as well. Using the ${SERVER_IP} variable is recommended for better maintainability and consistency across the configuration.

      - "traefik.http.routers.setrsoft-https.rule=Host(`${SERVER_IP}`) || Host(`www.${SERVER_IP}`)"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the production Docker Compose stack to standardize network naming and environment loading, and to expose the frontend via Traefik with HTTPS support.

Changes:

  • Simplifies env_file declarations and tightens required env var messages in docker-compose.prod.yml.
  • Renames internal/external networks (internal_bridge, public_gateway) and wires services to the new networks.
  • Adds Traefik labels (routers, HTTPS redirect, Let’s Encrypt) and a restart policy for the web service; updates .env.example default network name.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
docker-compose.prod.yml Renames networks, simplifies env loading, and adds Traefik routing/TLS labels for the frontend service.
.env.example Updates the example external network name used by production compose/Traefik.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker-compose.prod.yml
Comment on lines +62 to +67
- "traefik.http.routers.setrsoft-https.rule=Host(`setrsoft.com`) || Host(`www.setrsoft.com`)"
- "traefik.http.routers.setrsoft-https.entrypoints=https"
- "traefik.http.routers.setrsoft-https.tls=true"
- "traefik.http.routers.setrsoft-https.tls.certresolver=letsencrypt"
# Service
- "traefik.http.services.setrsoft-web.loadbalancer.server.port=80"
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Traefik router labels don’t reference the explicitly defined service setrsoft-web, so traefik.http.services.setrsoft-web.loadbalancer.server.port=80 is likely unused and Traefik will fall back to its auto-generated service/port detection. Consider either (a) adding traefik.http.routers.<router>.service=setrsoft-web for both routers, or (b) renaming the service label to match the router/default service name so the configured port is actually applied.

Copilot uses AI. Check for mistakes.
Comment thread docker-compose.prod.yml Outdated
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.docker.network=${DOCKER_NETWORK_NAME:-}"
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public_gateway’s name requires DOCKER_NETWORK_NAME (${DOCKER_NETWORK_NAME}), but the Traefik label uses ${DOCKER_NETWORK_NAME:-} (empty-string fallback). If the variable is unset/mis-set, Compose and Traefik can silently diverge and Traefik may attach to the wrong network. Suggest making the label require the same variable (e.g., :?), or using the same default on both to keep them consistent.

Suggested change
- "traefik.docker.network=${DOCKER_NETWORK_NAME:-}"
- "traefik.docker.network=${DOCKER_NETWORK_NAME}"

Copilot uses AI. Check for mistakes.
Comment thread .env.example
# Docker
DOCKER_NETWORK_NAME=proxy-tier
#Docker
DOCKER_NETWORK_NAME=default
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env.example now sets DOCKER_NETWORK_NAME=default, but in docker-compose.prod.yml that value is used for an external network (public_gateway). Docker/Compose will not create an external network automatically, so using default is likely to fail unless a network with that exact name already exists. Consider reverting to a known Traefik network name (e.g. the previous proxy-tier) or updating the example/comment to instruct creating/choosing the correct external network name.

Suggested change
DOCKER_NETWORK_NAME=default
# Name of the pre-existing external Docker network shared with the reverse proxy (e.g. Traefik).
# Docker Compose will not create external networks automatically, so this must match an existing network.
DOCKER_NETWORK_NAME=proxy-tier

Copilot uses AI. Check for mistakes.
Comment thread .env.example

# Docker
DOCKER_NETWORK_NAME=proxy-tier
#Docker
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment header formatting is inconsistent with the rest of the file: #Docker is missing a space (# Docker).

Suggested change
#Docker
# Docker

Copilot uses AI. Check for mistakes.
@eloiberlinger1 eloiberlinger1 merged commit f84e0a9 into main Apr 7, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants