diff --git a/gitea/.env.dist b/gitea/.env.dist index 7d7cca5..42dae6a 100644 --- a/gitea/.env.dist +++ b/gitea/.env.dist @@ -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 diff --git a/gitea/docker-compose.yml b/gitea/docker-compose.yml index e37ea4a..043d694 100644 --- a/gitea/docker-compose.yml +++ b/gitea/docker-compose.yml @@ -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" \ No newline at end of file + - "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}" diff --git a/gitea/docker-compose_embedded_db.yml b/gitea/docker-compose_embedded_db.yml new file mode 100644 index 0000000..9e4c24f --- /dev/null +++ b/gitea/docker-compose_embedded_db.yml @@ -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" \ No newline at end of file