docker-compose ()
{
docker-compose $(find -name 'docker-compose*.yml' -type f -printf '%p\t%d\n' 2>/dev/null | sort -n -k2 | cut -f 1 | awk '{print "-f "$0}') $@
}
SITE=tom.moulard.org docker-compose up -d
Now you have my own server configuration.
To be a little more consistent with the management, you can use a .env
file
and do:
cp .env.default .env
And edit the file to use the correct site URL.
The docker-compose
function gather all docker-compose files in order to have
the whole configuration in one place (see docker-compose config
).
docker-compose down
There should be only one service by folder:
For example, le folder traefik/
contains all the necessary configuration to
run the traefik
service.
Thus each folder represent an available service.
The directory must follow the following architecture:
service/
├── conf
│ └── ...
├── data
│ └── ...
├── docker-compose.servicename.yml
├── logs
│ ├── access.log
│ └── error.log
└── README.md
If the service you are adding can use volumes:
data/
, is where to store to service dataconf/
, is where to store to service configurationlogs/
, is where to store to service logs (others than Docker logs)
Feel free to do a Pull Request to add your ideas.
Don't forget to change:
- db passwords (might not be needed since they are beyond the reverse proxy)
- VPN secrets (if none provided, they are generated directly).
Configuration files are: docker-compose.yml
, nginx.conf
To set the password:
echo "USERS=$(htpasswd -nB $USER)" >> .env
You can add a new set of credentials by editing the .env file like
USERS=toto:pass,tata:pass, ...
The .env.default
is generated using this command:
grep '${' **/docker-compose.*.yml | sed "s/.*\${\(.*\)}.*/\1/g" | cut -d":" -f 1 | sort -u | sort | xargs -I % echo "%=" >> .env.default
Edit the file /etc/hosts
to provide the reverse proxy with good URLs.
For example, adding this in your /etc/hosts
will allow to run and debug the
Traefik service locally:
127.0.0.1 traefik.moulard.org
docker-compose scale nginx=2
Main author:
Gitlab helper:
Discord MusicBot/minecraft: