Giter Site home page Giter Site logo

cloud-services's Introduction

Cloud Services

Multiple docker-based services behind a Traefik reverse proxy.

Stages

Each service is located in a separate directory. Each service uses 3 stages:

Dev

Standalone service. Run via

docker-compose -f <service-name>.docker-compose.yaml -f compose.override.yaml

Ports are mapped to localhost and the service is reachable via localhost. No volume mounts are used, so data is volatile .

Test

Service which relies on traefik as a reverse proxy, which is reachable via localhost. Each service requires a hostname to be set via label in the docker-compose/override file:

...
labels:
    ...
    - traefik.http.routers.<router_name>.rule=Host(`$ENV-VAR`)

ENV-VAR must be set in traefik's .env file. This way, the host name can be kept secret when e.g. publishing on GitHub.

The test stage uses volume mounts, so data is persistent.

Prod

Production system with proper usage of TLS etc. Still WIP...

Service Structure

Each service is defined in service-root/dev/service-name.docker-compose.yaml. This docker-compose-file serves as the base definition. Each stage overrides or extends this base definition. Sensible data is kept in .env files. This creates the following directory structure:

service-root
    |-dev
        |-service-name.docker-compose.yaml
        |-override.docker-compose.yaml
    |-test
        |-service-name.docker-compose.yaml
        |-override.docker-compose.yaml
        |-.env
    |-prod
        |-service-name.docker-compose.yaml
        |-override.docker-compose.yaml
        |-.env

docker-compose-files in test and prod stages only need to include the service's base docker-compose file:

# e.g. service-root/test/service-name.docker-compose.yaml
version: "3"

include:
    - ../dev/service-name.docker-compose.yaml

Everything else is managed in a compose.override.yaml, which only specifies the necessary changes and additions compared to the base service definition.

cloud-services's People

Contributors

qworkz11 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.