Skip to content

gnud/multi-env-docker-compose-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions

This is a demonstration of a Multi Docker Compose.

The purpose of this repositoy is ongoing research on "Docker compose" architecture design for easier and elegant control over the services, without duplication.

Create a new project environment aka sample platform

To create a new environment

mkdir platform-new
touch platform-new/.env
ln -s docker-compose.base.yml platform-new/docker-compose.yml
touch platform-new/docker-compose.override.yml

Tree view visualizing of the filesystem

platform-new/
├── data
│   └── backend1
│       └── config
│           └── main.yml
├── docker-compose.override.yml
└── docker-compose.yml -> ../docker-compose.base.yml

In short:

  • We link the original docker-compose.base.yml.

  • We create new .env file.

    • Each .env can configure the inside/outside ports and other user configurable options.

Each override has the example structure:

version: '3'

services:
    backend1:
        # add content here
        volumes:
            - ./data/backend3/config:/config

Note:

  • Each platform environment will not to be committed to GIT.

  • The platform environments will be created on the dev machine or production.

  • There can be an infinite number of environments on one machine/node as long as the ports are different in each .env file.

  • Having a data directory which can be mounted/binded to particular location inside the target service.

Environment keys:

  • PORT_BACKEND1 is the outside port

  • PORT_BACKEND1_IN is the inside port

  • BACKEND1_PORT is the listen port for the service

Commands

Rebuild

cd platform-dev  # sample env
docker-compose build
docker-compose up -d

Test: http://localhost:8003

Status

cd platform-dev  # sample env
docker-compose ps

Features (desired)

  • Multi environment docker compose

  • Building an image instructions

  • Controlling inside env vars

  • Controlling outside env vars in docker -compose

  • Structuring environment variables for easier control and maintaince

  • Multi stage Dockerfile builds

Reference

TODOS

Please check the Issues section for a complete list of pending features here.

About

Sample multi docker compose environment setup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published