From 0a392f4cc0c3fdb08cfa1995a4f7894afebb3fbb Mon Sep 17 00:00:00 2001 From: whitney Date: Fri, 27 Dec 2024 01:01:01 -0800 Subject: [PATCH] Update gitea & add immich --- gitea/README.md | 76 ++++++++++++-------------------- gitea/docker-compose.yml.blanked | 35 ++++++++++----- immich/.gitignore | 2 + immich/README.md | 9 ++++ 4 files changed, 62 insertions(+), 60 deletions(-) create mode 100644 immich/.gitignore create mode 100644 immich/README.md diff --git a/gitea/README.md b/gitea/README.md index 4f1e4ae..d3cda71 100644 --- a/gitea/README.md +++ b/gitea/README.md @@ -1,60 +1,40 @@ # Gitea - -Self hosted Git - +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 port 3000 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/` - -Also modify the following: - -`ROOT_URL = https://git.whitney.rip` - -`SSH_DOMAIN = git.whitney.rip` - -Then start containers again. - -5. Go to xxx.xxx.xx.xxx:3000 and fill out initial config. Everything should match up to default values. - - -Some things that were weird: - +`docker exec -it gitea_db bash` +`psql -h 127.0.0.1 -p 5432 -U olomana_readwrite -d gitea` +4. Go to xxx.xxx.xx.xxx:3000 and fill out initial config. Everything should match up to default value. +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". - -6. Enable SSH on the server - -- install openssh-server - -- follow `https://wiki.archlinux.org/title/Gitea#Enable_SSH_Support` - -Should be able to clone via HTTPS at this point. - +- had to make sure to specify database container by the right name. Removed custom name and used just "databasei". +Additionally, you must provision the first admin user in the initial config. +5. Provision new users +You can do that from the "Site Administration" view from the first admin user. +6. Configure SSH +Via Traefik: +- Add another entrypoint in `traefik.toml`: +``` +entryPoints: + gitea: + address: ":2222" +``` +- Configure similar traefik labels to what we normally do for containers: +``` +- traefik.tcp.routers.gitea_ssh.rule=HostSNI(`*`) +- traefik.tcp.routers.gitea_ssh.entrypoints=ssh +- traefik.tcp.routers.gitea_ssh.service=gitea_ssh +- traefik.tcp.services.gitea_ssh.loadbalancer.server.port=22 +``` 7. Handle user authentication like you'd do on Github by generating new ssh keys and adding them to the SSH Keys section. - -Settings > SSH/GPG Keys > Manage SSH Keys - +Settings > SSH/GPG Keys > Manage SSH Keys Now should also be able to clone with SSH. + +### References +`https://docs.gitea.com/next/administration/config-cheat-sheet` diff --git a/gitea/docker-compose.yml.blanked b/gitea/docker-compose.yml.blanked index 31adfcb..3d45b80 100644 --- a/gitea/docker-compose.yml.blanked +++ b/gitea/docker-compose.yml.blanked @@ -1,7 +1,7 @@ networks: gitea_network: external: false - [TRAEFIK_NETWORK]: + TRAEFIK_NETWORK: external: true services: @@ -12,24 +12,35 @@ services: depends_on: - database environment: - - USER_UID=[GITEA_USER_ID] - - USER_GID=[GITEA_USER_GROUP_ID] - - DOMAIN=[SUBDOMAIN_URL] + - USER_UID=GITEA_USER_ID + - USER_GID=GITEA_USER_GROUP_ID + - DOMAIN=SUBDOMAIN_URL - PROTOCOL=http - GITEA__database__DB_TYPE=postgres - GITEA__database__HOST=database:5432 - - GITEA__database__NAME=[GITEA_DB_NAME] - - GITEA__database__USER=[GITEA_DB_USER] - - GITEA__database__PASSWD=[GITEA_DB_PASS] + - GITEA__database__NAME=GITEA_DB_NAME + - GITEA__database__USER=GITEA_DB_USER + - GITEA__database__PASSWD=GITEA_DB_PASS + - GITEA__service__DISABLE_REGISTRATION=true + - GITEA__openid__ENABLE_OPENID_SIGNUP=DISABLE_REGISTRATION + - GITEA__openid__ENABLE_OPENID_SIGNIN=false + - GITEA__server__ROOT_URL=SUBDOMAIN_URL + - GITEA__server__LOCAL_ROOT_URL=HTTP_SUBDOMAIN_URL + - GITEA__server__SSH_DOMAIN=SUBDOMAIN_URL + - GITEA__server__SSH_PORT=HOST_SSH_PORT + - GITEA__server__SSH_LISTEN_PORT=HOST_SSH_PORT + - GITEA__server__START_SSH_SERVER=true networks: - gitea_network - - [TRAEFIK_NETWORK] + - TRAEFIK_NETWORK + ports: + - "HOST_SSH_PORT:22" volumes: - /pwspool/software/gitea/gitea:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro labels: - - traefik.http.routers.gitea.rule=Host(`[SUBDOMAIN_URL]`) + - traefik.http.routers.gitea.rule=Host(`SUBDOMAIN_URL`) - traefik.http.routers.gitea.tls=true - traefik.http.routers.gitea.tls.certresolver=lets-encrypt - traefik.http.services.gitea.loadbalancer.server.port=3000 @@ -40,9 +51,9 @@ services: - gitea_network restart: unless-stopped environment: - - POSTGRES_USER=[GITEA_DB_USER] - - POSTGRES_PASSWORD=[GITEA_DB_PASS] - - POSTGRES_DB=[GITEA_DB_NAME] + - POSTGRES_USER=GITEA_DB_USER + - POSTGRES_PASSWORD=GITEA_DB_PASS + - POSTGRES_DB=GITEA_DB_NAME volumes: - /pwspool/software/gitea/database:/var/lib/postgresql/data labels: diff --git a/immich/.gitignore b/immich/.gitignore new file mode 100644 index 0000000..2bb202b --- /dev/null +++ b/immich/.gitignore @@ -0,0 +1,2 @@ +docker-compose.yml +.env diff --git a/immich/README.md b/immich/README.md new file mode 100644 index 0000000..4bb6696 --- /dev/null +++ b/immich/README.md @@ -0,0 +1,9 @@ +# Immich +Self hosted photography server. + +## Setup +1. Setup is easy. Follow `https://immich.app/docs/install/docker-compose` to download the `dockerfile` and `.env` config files. +2. Add custom values to `.env` where applicable (data/upload locations, and set custom DB pw) +3. Customize the dockerfile for Traefik things. +3a. Networks, add traefik network and make a new immach bridge network so things can continue to communicate after you add traefik. Make sure all containers use it. +3b. Traefik tags, add the default ones.