From 2120ac81ad2b2d5b737fb023b7667313d6588296 Mon Sep 17 00:00:00 2001 From: bee8333 Date: Sat, 15 Feb 2025 14:40:23 -0800 Subject: [PATCH] Initial commit of gitea-docker configuration --- .gitignore | 26 +++++++++++++++++++++++ README.md | 40 ++++++++++++++++++++++++++++++++++ docker-compose.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81aac0e --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# Gitea data directory +data/ + +# Database files +*.db +*.sqlite + +# Log files +*.log + +# Environment files +.env + +# System files +.DS_Store +Thumbs.db + +# Docker volumes +volumes/ +gitea/ +db-data/ + +# Temporary files +*.tmp +*.temp +*~ diff --git a/README.md b/README.md new file mode 100644 index 0000000..ec1f16a --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Gitea Docker Setup + +This is a Docker Compose configuration for running Gitea with PostgreSQL. + +## Prerequisites + +- Docker Desktop for Windows +- Docker Compose + +## Configuration + +The setup includes: +- Gitea running on port 3000 (http://localhost:3000) +- SSH access on port 222 +- PostgreSQL database +- Persistent data storage for both Gitea and PostgreSQL + +## Getting Started + +1. Make sure Docker Desktop is running +2. Open a terminal in this directory +3. Run `docker-compose up -d` +4. Access Gitea at http://localhost:3000 +5. During first-time setup: + - Database settings are pre-configured + - Set your domain to `localhost` or your IP (`192.168.0.33`) + - Set SSH port to 222 + +## Stopping the Services + +To stop the services, run: +``` +docker-compose down +``` + +## Data Persistence + +All data is stored in: +- `./gitea/` - Gitea data +- `./postgres/` - PostgreSQL data \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..963e8df --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,53 @@ +version: "3" + +networks: + gitea: + external: false + +volumes: + gitea-data: + postgres-data: + +services: + server: + image: gitea/gitea:latest + container_name: gitea + environment: + - USER_UID=1000 + - USER_GID=1000 + - GITEA__database__DB_TYPE=postgres + - GITEA__database__HOST=db:5432 + - GITEA__database__NAME=gitea + - GITEA__database__USER=gitea + - GITEA__database__PASSWD=gitea + # SSH Configuration + - GITEA__server__DOMAIN=bee8333.ddns.net + - GITEA__server__SSH_DOMAIN=bee8333.ddns.net + - GITEA__server__ROOT_URL=http://bee8333.ddns.net:3000/ + - GITEA__server__SSH_PORT=222 + - GITEA__server__SSH_LISTEN_PORT=22 + restart: always + networks: + - gitea + volumes: + - gitea-data:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" # Web UI: Host port 3000 -> Container port 3000 + - "222:22" # SSH: Host port 222 -> Container port 22 + depends_on: + - db + + db: + image: postgres:14 + container_name: gitea-db + restart: always + environment: + - POSTGRES_USER=gitea + - POSTGRES_PASSWORD=gitea + - POSTGRES_DB=gitea + networks: + - gitea + volumes: + - postgres-data:/var/lib/postgresql/data \ No newline at end of file