Git Product home page Git Product logo

example-localdev-network's Introduction

Example Localdev Network

This is a simple docker compose based ingress/DNS stack for local dev.

Usage

First ensure you have docker and docker compose installed.

To start the network in the background, simply clone this repo and run docker compose up -d.

Once the network has been started you can point your workstation's DNS at 127.0.0.1 which will resolve any *.dev.local domain to the local traefik proxy running as part of this stack.

Other applications can be exposed via this proxy by running their containers on the localdev docker network with the following label:

  • "traefik.http.routers.examplefastapi.rule=Host(<APPNAME>.dev.local)"

Where is the name of the service you're exposing. This will route any requests to your workstation on port 80 with the hostname .dev.local to the labeled container, which when combined with the local DNS server, allow host based routing for multiple HTTP containers on the same workstation.

Example Service with Docker Compose

The following docker-compose.yml file can be added to an existing application to run it alongside this localdev networking stack. Replace example-app with the name of the application.

version: '3.8'
name: pizzacorp
services:
  example-app:
    networks:
      - localdev
    build: .
    labels:
      - "traefik.http.routers.examplefastapi.rule=Host(`example-app.dev.local`)"
    ports:
      - 80
networks:
  localdev:
    external: true

example-localdev-network's People

Contributors

nalbury avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.