Skip to content

A docker-compose.yml that exposes a Traefik instance for local development

Notifications You must be signed in to change notification settings

leviy/workspace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leviy logo

Leviy Workspace

Build Status

The Docker Compose file in this repository contains an instance of Traefik for development purposes. It allows you to access microservices through your browser using a hostname (such as accounts.leviy.localhost) and to run multiple microservices at the same time without port binding conflicts.

Getting started

Prerequisites

Installation

git clone [email protected]:leviy/workspace.git
cd workspace
docker-compose up -d

The Docker Compose file contains the restart: always directive so Docker will restart the container every time you boot your machine. If for some reason you need to start another container or project that needs to bind to port 80, you can stop the containers using:

docker-compose stop

Usage

When the containers are running, the Traefik dashboard can be found at http://localhost:8080/dashboard/. Other microservices can register themselves to Traefik by adding the following to their docker-compose.yml:

version: '3'

services:
  microservice-name:
    image: nginx
    networks:
      - workspace
      - default
    labels:
      traefik.frontend.rule: Host:subdomain.leviy.localhost
      traefik.enable: 'true'

networks:
  workspace:
    external:
      name: workspace_default

Web server services that should be reverse proxied should be linked to both the workspace network and the default network of that Docker Compose project. Non-web services (such as databases, etc.) should only be linked to the default network.

When started, Traefik will automatically detect this service and start routing traffic to it. To see it in action simply open http://subdomain.leviy.localhost in a browser.

About

A docker-compose.yml that exposes a Traefik instance for local development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published