Skip to content
Snippets Groups Projects
Commit 9307bb96 authored by Fabrice Gangler's avatar Fabrice Gangler :art:
Browse files

chore: add custom docker-compose

parent d742ff41
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ APP_SECRET=ThisTokenIsNotSoSecretChangeIt
##################################################################################################
# Database configuration (PostgreSQL)
DATABASE_URL="postgresql://tajine_pg_user:tajine_pg_password_ChangeIt@127.0.0.1:5432/tajine_pg_database?serverVersion=14&charset=utf8"
DATABASE_URL="postgresql://comptoir_pg_user:comptoir_pg_password_ChangeIt@127.0.0.1:5432/comptoir_pg_database?serverVersion=14&charset=utf8"
##################################################################################################
# you MUST configure your PostgreSQL server version.
# ----> "?serverVersion=<your-PostgreSQL-Server-Version>"
......
##############################################
# Copy .env.dist file to .env file
##############################################
# Host IP addresses
#################################################################################################################
MAILCATCHER_HOST_IP=127.0.0.1
POSTGRES_HOST_IP=127.0.0.1
############################################
# Only local IP address
# ---> by default without the .env file
# MAILCATCHER_HOST_IP=127.0.0.1
# POSTGRES_HOST_IP=127.0.0.1
#
# All network interfaces of the host machine
# MAILCATCHER_HOST_IP=0.0.0.0
# POSTGRES_HOST_IP=0.0.0.0
#
# Only an IP address of the host machine
# MAILCATCHER_HOST_IP=<IP>
# POSTGRES_HOST_IP=<IP>
############################################
# Host PORTS
#################################################################################################################
MAILCATCHER_HOST_SMTP_PORT=1025
MAILCATCHER_HOST_HTTP_PORT=1080
POSTGRES_HOST_PORT=5432
############################################
# By default without the .env file
# MAILCATCHER_HOST_SMTP_PORT=1025
# MAILCATCHER_HOST_HTTP_PORT=1080
# POSTGRES_HOST_PORT=5432
############################################
# Database server
#################################################################################################################
POSTGRES_VERSION="14"
############################################
# By default without the .env file
# POSTGRES_VERSION=14
############################################
# Database configuration
#################################################################################################################
POSTGRES_DB="comptoir_pg_database"
POSTGRES_PASSWORD="comptoir_pg_password_ChangeIt"
POSTGRES_USER="comptoir_pg_user"
############################################
# By default without the .env file
# POSTGRES_DB="comptoir_pg_database"
# POSTGRES_PASSWORD="comptoir_pg_password_ChangeIt"
# POSTGRES_USER="comptoir_pg_user"
############################################
# exclude custom Docker-Compose config
.env
# Dev tool - PostgreSQL and Mailcatcher via Docker
## Prerequisites
- [Docker](https://docs.docker.com/engine/install/) `19.03.0` (at least) is required
- [Docker Compose](https://docs.docker.com/compose/install/) `1.27.0` (at least) is required
## Ports, URL and credentials (user/password)
| Service | Port | URL | User | Password |
|----------|------|-----------------------------------------|------------------|----------------|
| Database | 5432 | `jdbc:postgresql://localhost:5432/comptoir_pg_database` | `comptoir_pg_user` | `comptoir_pg_password_ChangeIt` |
| SMTP | 1025 | `smtp://localhost:1025` | | |
| Webmail | 1080 | `http://localhost:1080` | | |
Tip:
if you copy [`.env.dist`](.env.dist) file to `.env` file,
you can change **port** numbers, **IP** adresses and **database** credentials.
### Option 1: uses same database, if it already exists
```shell
# build docker image + uses same database, if it already exists
docker-compose up --build
```
### Option 2: uses a new database
```shell
# build docker images + uses a new database
docker-compose rm -fsv
docker-compose up --build
```
version: '3'
volumes:
database_data:
services:
# PostgreSQL
###############################################################################################################
# by default:
# postgresql://comptoir_pg_user:comptoir_pg_password_ChangeIt@127.0.0.1:5432/comptoir_pg_database?serverVersion=14&charset=utf8
#
# if you use the .env configuration file
# postgresql://<db_user>:<db_pass>@<host_ip>:<host_port>/<db_name>?serverVersion=<pg_version>&charset=utf8
###############################################################################################################
database:
image: postgres:${POSTGRES_VERSION:-14}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-comptoir_pg_database}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-comptoir_pg_password_ChangeIt}
POSTGRES_USER: ${POSTGRES_USER:-comptoir_pg_user}
ports:
- "${POSTGRES_HOST_IP:-127.0.0.1}:${POSTGRES_HOST_PORT:-5432}:5432"
volumes:
- database_data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder
# to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
# Mailcatcher
###############################################################################################################
# SMTP server: smtp://localhost:1025 by default
# smtp://<host_ip>:<port> if you use the .env configuration file
#
# Webmail URL: http://localhost:1080 by default
# http://<host_ip>:<port> if you use the .env configuration file
###############################################################################################################
mailer:
image: schickling/mailcatcher
ports:
- "${MAILCATCHER_HOST_IP:-127.0.0.1}:${MAILCATCHER_HOST_SMTP_PORT:-1025}:1025"
- "${MAILCATCHER_HOST_IP:-127.0.0.1}:${MAILCATCHER_HOST_HTTP_PORT:-1080}:1080"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment