diff --git a/gitea/README.md b/gitea/README.md new file mode 100644 index 0000000..02254aa --- /dev/null +++ b/gitea/README.md @@ -0,0 +1,40 @@ +# Gitea + +Self hosted Git + +Followed instructions on Gitea page: https://docs.gitea.com/next/installation/install-with-docker + +### Steps + +1. Create a new user to own the gitea folder. + +`sudo groupadd gitea && sudo useradd giteauser && sudo usermod -a -G gitea giteauser && chown -r gitea:giteauser .` + +2. Run via Docker Compose + +`docker-compose up -d` + +3. Test postgresql + +`docker exec -it gitea_database bash` + +`psql -h 127.0.0.1 -p 5432 -U gitea` + +4. Stop server and set value in app.ini. + +Add magic line to /data/persistent/gitea/gitea/gitea/conf/app.ini because local workers will otherwise assume they can use our custom port 3300 to reach services locally. Have to specify local url here. + +This goes in the [server] section. (https://docs.gitea.com/next/administration/config-cheat-sheet) + +`LOCAL_ROOT_URL = http://localhost:3000/` + +Then start containers again. + +5. Go to xxx.xxx.xx.xxx:3300 and fill out initial config. + +Some things that were weird: + +- could not use any port that wasnt default postgresql (5432) + +- had to make sure to specify database container by the right name. Removed custom name and used just "database". + diff --git a/gitea/docker-compose.yml b/gitea/docker-compose.yml new file mode 100644 index 0000000..2281cf4 --- /dev/null +++ b/gitea/docker-compose.yml @@ -0,0 +1,41 @@ +networks: + gitea_network: + external: false + +services: + server: + image: gitea/gitea:latest + container_name: gitea + depends_on: + - database + environment: + - USER_UID=1001 + - USER_GID=1001 + - GITEA__database__DB_TYPE=postgres + - GITEA__database__HOST=database:5432 + - GITEA__database__HAME=gitea + - GITEA__database__USER=gitea + - GITEA__database__PASSWD=gitea + restart: always + networks: + - gitea_network + volumes: + - /data/persistent/gitea/gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3300:3000" + - "222:22" + + database: + image: postgres:14 + restart: always + networks: + - gitea_network + environment: + - POSTGRES_USER=gitea + - POSTGRES_PASSWORD=gitea + - POSTGRES_DB=gitea + volumes: + - /data/persistent/gitea/database:/var/lib/postgresql/data +