Home
Softono

One Traefik Multiple Projects

Open source MIT TypeScript
44
Stars
13
Forks
0
Issues
3
Watchers
1 year
Last Commit

 About One Traefik Multiple Projects

Repository for YouTube tutorial on how to use a single "Traefik" Docker container to host as many projects as you want in a single server.

Platforms

Web Self-hosted Docker

Languages

TypeScript

Need Help Installing One Traefik Multiple Projects?

We provide expert installation service for this software. Our team will install, configure, and secure One Traefik Multiple Projects on your server. plans start at just $30.

One Traefik Multiple Projects

View on GitHub

Screenshot (11)

one-traefik-multiple-projects

This repo demonstrates how to use a single Traefik Docker container as a reverse proxy for multiple projects, each with different domains. Instead of manually installing and configuring a reverse proxy for a server, you can deploy this pre-configured Traefik container and easily add as many projects with as many domains as you need.

root/
β”œβ”€β”€ traefik/
β”‚ β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ project-1/
β”‚ β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ project-2/
β”‚ β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ README.md
└── ... (additional projects)

Prerequisites

Before getting started, ensure you have the following installed on your system:

Getting Started

Follow these steps to set up the Traefik reverse proxy and deploy multiple projects.

1. Clone the Repository

git clone https://github.com/sesto-dev/one-traefik-multiple-projects.git

2. Create Docker Network

Traefik and the projects need to communicate over a shared Docker network.

docker network create traefik-public

3. Traefik Docker Container

Set up the necessary environment variables for Traefik and each project.

cd one-traefik-multiple-projects/traefik

Create a .env file inside the traefik directory:

cp .env.example .env
nano .env

Edit the .env file to set your domain and other necessary variables.

USERNAME=your_admin_username
PASSWORD=your_admin_password
DOMAIN=yourdomain.com
[email protected]

Note: To generate and set the hashed password in one command for Traefik's HTTP Basic Auth, you can use the following command:

export HASHED_PASSWORD=$(openssl passwd -apr1 $PASSWORD)

Then spin up your Traefik container:

docker compose up -d

4. Project Docker Containers

For each project, create a .env file based on the provided examples and enter the DOMAIN for that project.

cd ../project-1
cp .env.example .env
nano .env`
DOMAIN=project1.yourdomain.com

Then spin up the project container:

docker compose up -d

Repeat for project-2.

5. Verify the Setup

Open your browser and navigate to the domains you've configured. You should see the projects running correctly. You can also visit Traefik's dashboard at https://traefik.yourdomain.com.