gitea. Moving configuration with embedded PostgreSQL to the separate config. Default config is using external database and host network now.

This commit is contained in:
Alexey Skobkin 2022-03-02 02:44:19 +03:00
parent fe24bfb7bf
commit 9b25fe729f
3 changed files with 53 additions and 24 deletions

View file

@ -7,5 +7,13 @@ HOST_PG_DATA_DIR=./db
EXT_HTTP_PORT=3000
EXT_SSH_PORT=222
# Database settings
# Leave default for embedded database
DB_HOST=db
DB_PORT=5432
DB_NAME=gitea
DB_USER=gitea
DB_PASSWD=gitea
LOG_MAX_SIZE=5m
LOG_MAX_FILE=5

View file

@ -1,18 +1,11 @@
version: '3.7'
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
container_name: gitea
depends_on:
- db
restart: unless-stopped
networks:
- gitea
network_mode: host
ports:
- "${EXT_HTTP_PORT:-3000}:3000"
- "${EXT_SSH_PORT:-222}:22"
@ -22,19 +15,7 @@ services:
- /etc/localtime:/etc/localtime:ro
environment:
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=db:5432
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
db:
image: postgres:13
restart: unless-stopped
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=gitea
- POSTGRES_DB=gitea
networks:
- gitea
volumes:
- "${HOST_PG_DATA_DIR:-./db}:/var/lib/postgresql/data"
- "GITEA__database__HOST=${DB_HOST:-db}:${DB_PORT:-5432}"
- "GITEA__database__NAME=${DB_NAME:-gitea}"
- "GITEA__database__USER=${DB_USER:-gitea}"
- "GITEA__database__PASSWD=${DB_PASSWD:-gitea}"

View file

@ -0,0 +1,40 @@
version: '3.7'
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
container_name: gitea
depends_on:
- db
restart: unless-stopped
networks:
- gitea
ports:
- "${EXT_HTTP_PORT:-3000}:3000"
- "${EXT_SSH_PORT:-222}:22"
volumes:
- "${HOST_DATA_DIR:-./data}:/data"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- GITEA__database__DB_TYPE=postgres
- "GITEA__database__HOST=${DB_HOST:-db}:${DB_PORT:-5432}"
- "GITEA__database__NAME=${DB_NAME:-gitea}"
- "GITEA__database__USER=${DB_USER:-gitea}"
- "GITEA__database__PASSWD=${DB_PASSWD:-gitea}"
db:
image: postgres:13
restart: unless-stopped
environment:
- "POSTGRES_USER=${DB_USER:-gitea}"
- "POSTGRES_PASSWORD=${DB_PASSWD:-gitea}"
- "POSTGRES_DB=${DB_NAME:-gitea}"
networks:
- gitea
volumes:
- "${HOST_PG_DATA_DIR:-./db}:/var/lib/postgresql/data"