Update gitea & add immich

This commit is contained in:
whitney 2024-12-27 01:01:01 -08:00
parent 78b5a0f360
commit 0a392f4cc0
4 changed files with 62 additions and 60 deletions

View File

@ -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`

View File

@ -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:

2
immich/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
docker-compose.yml
.env

9
immich/README.md Normal file
View File

@ -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.