Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Traefik Reverse Proxy with Let's Encrypt and Centralized Environment Configuration into docker-compose.yaml #414

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

electrosenpai
Copy link
Contributor

@electrosenpai electrosenpai commented Sep 27, 2024

Description

This pull request introduces several key updates and improvements to the repository, including:

  1. Addition of Traefik Configuration:

    • Traefik is configured as a reverse proxy, with Let's Encrypt support for automatic certificate management.
    • Enables secure access through HTTPS on port 443, with automated redirection from HTTP.
    • Adds traefik with customizable entry points for HTTP and HTTPS and new certificate resolvers for better security.
  2. Improved docker-compose.yml Setup:

    • Updated the services section to support the new Traefik configuration.
    • Centralized common environment variables for the API and frontend under shared configurations (x-common-environment, x-api-environment, and x-front-environment), improving readability and maintainability.
    • The API and frontend services are now configured to work under a single domain, distinguishing paths by /api for API calls.
    • The configuration for Redis, PostgreSQL, and new sub-services has been enhanced with optimized health checks and environment variables.
  3. Enhanced Routing and Domain Management:

    • Configured Traefik routing rules to allow the frontend and API to coexist on a single domain. The path prefix /api routes to the API, while the root path routes to the frontend.
    • Introduced a new .env file template for customizable environment variables, facilitating deployments in different environments.
    • All necessary updates to the docker-compose.yml and .env files to support domain templating and the new routing structure are included.
  4. Additional Documentation and Configurations:

    • A new docker-compose-old.yml file was introduced for reference, documenting previous configurations and allowing easier migration to the new setup.

Changes

  • docker-compose.yml: Reorganized services with Traefik integration, added shared environment configurations, and enhanced health checks.
  • New .env File: Added for centralized configuration management, supporting easier setup across various environments.
  • New Docker Compose Template (docker-compose-old.yml): Provides a backup of the previous configuration for reference and testing.

Motivation and Context

This PR is intended to simplify and secure the deployment of the Lago services, leveraging Traefik for reverse proxy management and Let's Encrypt for SSL certificate handling. It also aims to streamline the environment configuration process, allowing easier setup and customizability for different deployment scenarios.

Types of changes

Breaking change with the current docker-compose, moving it into docker-compose-old.yaml for the moment

electrosenpai and others added 8 commits September 30, 2024 15:44
…dling for services; remove container_name from db, redis, and api-worker
…main templating

- Enable Let's Encrypt support with ACME resolver 'myresolver'
- Update Traefik rules to support templated DOMAIN variable
- Remove unnecessary port mappings from API and frontend services
- Secure Traefik dashboard and disable 'exposedbydefault' for improved security
…er a single domain

- Update Traefik rules to use a single domain with path prefixes
- Add middleware to strip '/api' prefix for the API service
- Set router priorities to resolve routing conflicts
@electrosenpai electrosenpai changed the title WIP refactor(docker-compose): extract environment variables to .env file Add Traefik Reverse Proxy with Let's Encrypt and Centralized Environment Configuration into docker-compose.yaml Oct 7, 2024
@electrosenpai electrosenpai marked this pull request as ready for review October 7, 2024 13:18
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.

1 participant