mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-07 09:02:29 +00:00
deploy: 5b33129fa0
This commit is contained in:
@@ -5,13 +5,14 @@ Gitea Actions# Gitea Actions have made it into the 1.19.0 release. This feature
|
||||
So what are they? If you’ve ever used GitHub Actions (and if you’re reading this, I imagine you have), these will look familiar. Gitea Actions essentially enable the ability to run github workflows on gitea. Workflows between gitea and github are not completely interopable, but a lot of the same workflow syntax is already compatible on gitea. You can find a documented list of unsupported workflows syntax.
|
||||
Actions work by using a custom fork of nekos/act. Workflows run in a new container for every job. If you specify an action such as actions/checkout@v4, it defaults to downloading the scripts from github.com. To avoid internet egress, you could always clone the required actions to your local gitea instance.
|
||||
Actions (gitea’s implementation) has me excited because it makes spinning up a network-isolated environment for workflow automation incredibly simple.
|
||||
Integration with Tailscale# So how does Tailscale help here? Well, more recently I’ve been exposing my self-hosted services through a combination of traefik and the tailscale (through the tailscale-traefik proxy integration described here). This allows for a nice looking dns name (i.e. gitea.my-tailnet-name.ts.net) and automatic tls certificate management. I can also share this tailscale node securely with other tailscale users without configuring any firewall rules on my router.
|
||||
Integration with Tailscale# 2024-02-10: I had originally written this post to include Tailscale-Traefik Proxy Integration, but I have since decided to remove it in favour of Tailscale Serve and Funnel after learning from this example. This simplifies the setup and reduces the number of moving parts.
|
||||
So how does Tailscale help here? Well, more recently I’ve been exposing my self-hosted services using Tailscale Serve and Funnel. This allows for a nice looking dns name (i.e. gitea.my-tailnet-name.ts.net), automatic tls certificate management, and optionally allowing the address to be publically accessible (using Funnel).
|
||||
Deploying Gitea, Traefik, and Tailscale# In my case, the following is already set up:
|
||||
docker-compose is installed tailscale is installed on the gitea host tailscale magic dns is enabled My preferred approach to deploying code in a homelab environment is with docker compose. I have deployed this in a proxmox lxc container based on debian with a hostname gitea. This could be deployed in any environment and with any hostname (as long you updated the tailscale machine name to your preferred subdomain for magic dns).
|
||||
docker-compose is installed tailscale magic dns is enabled My preferred approach to deploying code in a homelab environment is with docker compose. I have deployed this in a lxc container on Proxmox. You could run this on a virtual machine or a physical host as well.
|
||||
The docker-compose.yaml file looks like:
|
||||
version: "3.7" services: gitea: image: gitea/gitea:1.21.1 container_name: gitea environment: - USER_UID=1000 - USER_GID=1000 - GITEA__server__DOMAIN=gitea.my-tailnet-name.ts.net - GITEA__server__ROOT_URL=https://gitea.my-tailnet-name.ts.net - GITEA__server__HTTP_ADDR=0.0.0.0 - GITEA__server__LFS_JWT_SECRET=my-secret-jwt restart: always volumes: - ./data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro traefik: image: traefik:v3.0.0-beta4 container_name: traefik security_opt: - no-new-privileges:true restart: unless-stopped ports: - 80:80 - 443:443 volumes: - ./traefik/data/traefik.yaml:/traefik.yaml:ro - ./traefik/data/dynamic.yaml:/dynamic.yaml:ro - /var/run/tailscale/tailscaled.sock:/var/run/tailscale/tailscaled.sock traefik/data/traefik.yaml:
|
||||
entryPoints: https: address: ":443" providers: file: filename: dynamic.yaml certificatesResolvers: myresolver: tailscale: {} log: level: INFO and finally traefik/data/dynamic/dynamic.yaml:
|
||||
http: routers: gitea: rule: Host(\`gitea.my-tailnet-name.ts.net\`) entrypoints: - "https" service: gitea tls: certResolver: myresolver services: gitea: loadBalancer: servers: - url: "http://gitea:3000" Something to consider is whether or not you want to use ssh with git. One method to get this to work with containers is to use ssh container passthrough. I decided to keep it simple and not use ssh, since communicating over https is perfectly fine for my use case.
|
||||
version: "3.7" services: gitea: image: gitea/gitea:1.21.1 container_name: gitea network_mode: service:ts-gitea environment: - USER_UID=1000 - USER_GID=1000 - GITEA__server__DOMAIN=gitea.my-tailnet-name.ts.net - GITEA__server__ROOT_URL=https://gitea.my-tailnet-name.ts.net - GITEA__server__HTTP_ADDR=0.0.0.0 - GITEA__server__LFS_JWT_SECRET=my-secret-jwt restart: always volumes: - ./data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ts-gitea: image: tailscale/tailscale:v1.58 container_name: ts-gitea hostname: gitea environment: - TS_AUTHKEY=<FILL THIS IN> - TS_SERVE_CONFIG=/config/gitea.json - TS_STATE_DIR=/var/lib/tailscale volumes: - \${PWD}/state:/var/lib/tailscale - \${PWD}/config:/config - /dev/net/tun:/dev/net/tun cap_add: - net_admin - sys_module restart: unless-stopped Note that you must specify a TS_AUTHKEY in the ts-gitea service. You can generate an auth key here.
|
||||
config/gitea.json:
|
||||
{ "TCP": { "443": { "HTTPS": true } }, "Web": { "\${TS_CERT_DOMAIN}:443": { "Handlers": { "/": { "Proxy": "http://127.0.0.1:3000" } } }, }, "AllowFunnel": { "\${TS_CERT_DOMAIN}:443": true }, } Something to consider is whether or not you want to use ssh with git. One method to get this to work with containers is to use ssh container passthrough. I decided to keep it simple and not use ssh, since communicating over https is perfectly fine for my use case.
|
||||
After adding the above configuration, running docker compose up -d should be enough to get an instance up and running. It will be accessible at https://gitea.my-tailnet-name.ts.net from within the tailnet.
|
||||
Theming# I discovered some themes for gitea here and decided to try out gruvbox.
|
||||
I added the theme by cloning theme-gruvbox-auto.css into ./data/gitea/public/assets/css. I then added the following to environment in docker-compose.yml:
|
Reference in New Issue
Block a user