gitea compose and env example

This commit is contained in:
Christian Lempa 2024-11-25 13:33:44 +01:00
parent 8dfadf5a79
commit e46d5cfefc
2 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,16 @@
# Environment Variable Example File
# ---
# Add internal database credentials here...
# POSTGRES_HOST = "your-database-host"
# POSTGRES_PORT = "your-database-port"
POSTGRES_DB = "your-database-name"
POSTGRES_USER = "your-database-user"
POSTGRES_PASSWORD = "your-database-password"
# Add mailer credentials here...
MAILER_FROM = "your-mailer-from-address"
MAILER_SMTP_ADDR = "your-mailer-smtp"
MAILER_SMTP_PORT = "your-mailer-smtp-port"
MAILER_USER = "your-mailer-user"
MAILER_PASSWORD = "your-mailer-password"

View File

@ -0,0 +1,99 @@
---
services:
server:
image: gitea/gitea:1.22.1
container_name: gitea-server
environment:
- USER_UID=1000
- USER_GID=1000
# -- Change your database settings here...
# --> PostgreSQL
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=${POSTGRES_HOST:-db}:${POSTGRES_PORT:-5432}
- GITEA__database__NAME=${POSTGRES_DB:?POSTGRES_DB not set}
- GITEA__database__USER=${POSTGRES_USER:?POSTGRES_USER not set}
- GITEA__database__PASSWD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD not set}
# <--
# --> OR MySQL
# - GITEA__database__DB_TYPE=mysql
# - GITEA__database__HOST=db:3306
# - GITEA__database__NAME=${MYSQL_DATABASE:?MYSQL_DATABASE not set}
# - GITEA__database__USER=${MYSQL_USER:?MYSQL_USER not set}
# - GITEA__database__PASSWD=${MYSQL_PASSWORD:?MYSQL_PASSWORD not set}
# <--
# -- (Optional) Change your server settings here...
- GITEA__server__SSH_PORT=2221 # <-- (Optional) Replace with your desired SSH port
- GITEA__server__ROOT_URL=http://your-fqdn # <-- Replace with your FQDN
# --> (Optional) Change mailer settings here...
# - GITEA__mailer__ENABLED=true
# - GITEA__mailer__FROM=${MAILER_FROM:?MAILER_FROM not set}
# - GITEA__mailer__PROTOCOL=smtps
# - GITEA__mailer__SMTP_ADDR=${MAILER_SMTP_ADDR:?MAILER_SMTP_ADDR not set}
# - GITEA__mailer__SMTP_PORT=${MAILER_SMTP_PORT:?MAILER_SMTP_PORT not set}
# - GITEA__mailer__USER=${MAILER_USER:-apikey}
# - GITEA__mailer__PASSWD="""${MAILER_PASSWORD:?MAILER_PASSWORD not set}"""
# <--
# --> (Optional) When using traefik...
# networks:
# - frontend
# <--
# --> (Optional) When using an internal database...
# - backend
# <--
volumes:
- gitea-data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
# --> (Optional) Remove when using traefik...
- "3000:3000"
# <--
- "2221:22" # <-- (Optional) Replace with your desired SSH port
# --> (Optional) When using internal database...
# depends_on:
# - db
# <--
# --> (Optional) When using traefik...
# labels:
# - traefik.enable=true
# - traefik.http.services.gitea.loadbalancer.server.port=3000
# - traefik.http.services.gitea.loadbalancer.server.scheme=http
# - traefik.http.routers.gitea-https.entrypoints=websecure
# - traefik.http.routers.gitea-https.rule=Host(`your-fqdn`) # <-- Replace with your FQDN
# - traefik.http.routers.gitea-https.tls=true
# - traefik.http.routers.gitea-https.tls.certresolver=your-certresolver # <-- Replace with your certresolver
# <--
restart: unless-stopped
# --> When using internal database
# db:
# image: postgres:14
# container_name: gitea-db
# environment:
# - POSTGRES_USER=${POSTGRES_USER:?POSTGRES_USER not set}
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD not set}
# - POSTGRES_DB=${POSTGRES_DB:?POSTGRES_DB not set}
# networks:
# - backend
# volumes:
# - gitea-db:/var/lib/postgresql/data
# restart: unless-stopped
# <--
volumes:
gitea-data:
driver: local
# --> When using internal database
# gitea-db:
# driver: local
# <--
# --> (Optional) When using traefik...
# networks:
# frontend:
# external: true
# <--
# --> (Optional) When using an internal database...
# backend:
# external: true
# <--