Template for Docker Compose Orchestrations.
- Clone the repository
git clone https://github.com/axioma-ai-labs/docker-compose-template.git
- Copy environment variables
cp .env.example .env
Warning
Configure the environment variables with your own values. Pay attention to the REDIS_PASSWORD in the .env file. It must be the same as the password in the redis.conf file and respective to the REDIS_PASSWORD_FILE in the docker-compose.yml file.
- Create the volumes
mkdir -p volumes/postgres/data
mkdir -p volumes/redis/data
mkdir -p volumes/pgadmin/data
Give right permissions to the volumes
chmod -R 777 volumes
- Create the secrets
echo db-password >secrets/db-password
echo pgadmin-password >secrets/pgadmin-password
Give the right permissions to the secrets:
chmod -R 777 secrets
Warning
Configure the secrets with your own values!
Note
The redis-password
must be the same as the password in the redis.conf file and REDIS_PASSWORD in the .env file. See next sections for more details.
- Setup the configuration
mkdir -p config/nginx
cp utils/nginx/nginx.conf config/nginx
mkdir -p config/pgadmin
cp utils/pgadmin/servers.json config/pgadmin
mkdir -p config/redis
cp utils/redis/redis.conf config/redis
Give the right permissions to the directories:
chmod -R 777 config
Note
The redis.conf
file is used to configure the redis database. The password must be the same as the password in the secrets/redis-password
file and REDIS_PASSWORD in the .env file.
- Copy the override file
cp docker-compose.override.yml.dev docker-compose.override.yml
Note
The docker-compose.override.yml.dev
file is used to run the docker compose in development mode.
The docker-compose.override.yml.prod
file is used to scale the backend and frontend.
Review the ports and other settings in the docker-compose.override.yml
file.
- Run the docker compose
docker-compose up -d
With the default configuration, you can access the services at the following ports:
- Postgres: http://localhost:3020
- Redis: http://localhost:3030
- pgAdmin: http://localhost:3041
- Redis Commander: http://localhost:3031