Giter Site home page Giter Site logo

kgdocks's Introduction

docker config for persistent server setup

This is my setup for a docker environment hosted on a single machine (I started this in 2016 as a way to learn a bit about docker).

Features :

  • docker-compose with splitted config files (base, dev, prod, admin)
  • wrapper script (compose.sh) to ease the overriding of config files and avoid mistakes
  • docker volumes for data persistence
  • one nginx container for the web frontend
  • each php app in its own container (based on php:5-fpm)
  • nginx communicate with each php-fpm container via port 9000
  • each php app resides in a docker volume, that is also shared wih the nginx container, so that non php assets can be served by nginx

First start

  • Networks and volumes are created outside of compose's project environment, so you have to create them "by hand".
  • Then, take care of setting up all the required "*.env" files referenced in the docker-compose..file (env = prod | dev).
  • Hmm, have to admit I haven't tested this much in a "clean state". Assumption of existing database or file may need to be fixed.

network creation

sudo docker network create back
sudo docker network create front

volume creation

sudo docker volume create --name odoo-etc
sudo docker volume create --name odoo-addons
sudo docker volume create --name odoo-var
sudo docker volume create --name pgstore
sudo docker volume create --name mariadbstore
sudo docker volume create --name openvpndata
sudo docker volume create --name xibodata
sudo docker volume create --name redminedata
sudo docker volume create --name bookeddata

start in dev environment

  • First, take care of assessing environment variables
  • each container has its own .env file in its own folder
  • private settings are to be put in non versioned env files
  • docker.priv.env (see docker.priv.env-dist)
  • common.priv.env (see common.priv.env-dist)
./compose.sh build nginx
./compose.sh up -d nginx

start in prod environment

  • Environment variables are placed in dedicated files, in /etc/docker
./compose.sh build nginx
./compose.sh up -d nginx

backup & restore

backup of the volumes is simple

./compose.sh backup

restore is a bit more involved. Suppose we want to restore the content of mariadbstore

sudo docker-compose -f docker-compose.yml -f docker-compose.$ENV.yml -f docker-compose.admin.yml run --rm backup

then

cd /
rm -Rf /volumes/mariadbstore/*
tar -xvzf /backup/vps-volumes-back.tgz volumes/mariadbstore

Credits

Xibo image by Spring Signage

Giles Hall / vishnubob for its wait-for-it bash script

And many others I just don't remember of

kgdocks's People

Contributors

kermorgant avatar

Watchers

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