3 Commits

Author SHA1 Message Date
renovate[bot]
7888f50841 Merge 9be2905d09 into f7af260779 2024-02-21 08:10:57 +00:00
Dave Gallant
f7af260779 Add shell.nix with hugo 2024-02-20 07:22:54 -05:00
Dave Gallant
eb1136bf90 Update gitea blog post to use Tailscale Serve and Funnel 2024-02-10 10:55:20 -05:00
3 changed files with 18 additions and 7 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use_nix

View File

@@ -29,9 +29,9 @@ Actions (gitea's implementation) has me excited because it makes spinning up a n
## Integration with Tailscale
> **2024-02-10**: I had originally written this post to include [Tailscale-Traefik Proxy Integration](https://traefik.io/blog/exploring-the-tailscale-traefik-proxy-integration/), but I have since decided to remove it in favour of Tailscale Serve and Funnel after learning from this [example](https://github.com/tailscale-dev/docker-guide-code-examples). This simplifies the setup and reduces the number of moving parts.
> **2024-02-10**: I had originally written this post to include [Tailscale-Traefik Proxy Integration](https://traefik.io/blog/exploring-the-tailscale-traefik-proxy-integration/), but have since removed it in favour of Tailscale Serve after learning from this [example](https://github.com/tailscale-dev/docker-guide-code-examples). 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](https://tailscale.com/kb/1312/serve) and [Funnel](https://tailscale.com/kb/1223/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).
So how does Tailscale help here? Well, more recently I've been exposing my self-hosted services using Tailscale [Serve](https://tailscale.com/kb/1312/serve). 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 (by using [Funnel](https://tailscale.com/kb/1223/funnel)).
## Deploying Gitea, Traefik, and Tailscale
@@ -40,7 +40,7 @@ In my case, the following is already set up:
- [docker-compose is installed](https://docs.docker.com/compose/install/linux/)
- [tailscale magic dns is enabled](https://tailscale.com/kb/1081/magicdns/)
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.
My preferred approach to deploying code in a homelab environment is with docker compose. I have deployed this in a LXC on Proxmox. You could run this on a virtual machine or a physical host as well.
The `docker-compose.yaml` file looks like:
@@ -94,14 +94,14 @@ Note that you must specify a `TS_AUTHKEY` in the `ts-gitea` service. You can gen
"${TS_CERT_DOMAIN}:443":
{ "Handlers": { "/": { "Proxy": "http://127.0.0.1:3000" } } },
},
"AllowFunnel": { "${TS_CERT_DOMAIN}:443": true },
"AllowFunnel": { "${TS_CERT_DOMAIN}:443": false },
}
```
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](https://docs.gitea.com/installation/install-with-docker#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](https://gitea.my-tailnet-name.ts.net) from within the tailnet.
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](https://docs.gitea.com/installation/install-with-docker#ssh-container-passthrough). I decided to keep it simple and not use ssh, since communicating over https is perfectly fine for my use case.
## Theming
I discovered some themes for gitea [here](https://git.sainnhe.dev/sainnhe/gitea-themes) and decided to try out gruvbox.
@@ -117,7 +117,7 @@ After restarting the gitea instance, the default theme was applied.
## Connecting runners
I installed the runner by [following the docs](https://docs.gitea.com/usage/actions/quickstart#set-up-runner). I opted for installing it on a separate host (another lxc container) as recommended in the docs. I used the systemd unit file to ensure that the runner comes back online after system reboots. I installed tailscale on this gitea runner as well, so that it can have the same "networking privileges" as the main instance.
I installed the runner by [following the docs](https://docs.gitea.com/usage/actions/quickstart#set-up-runner). I opted for installing it on a separate host as recommended in the docs. I used the systemd unit file to ensure that the runner comes back online after system reboots. I installed tailscale on the gitea runner as well, so that it can be part of the same tailnet as the main instance.
After registering this runner and starting the daemon, the runner appeared in `/admin/actions/runners`. I added two other runners to help with parallelization.

10
shell.nix Normal file
View File

@@ -0,0 +1,10 @@
let
channel = "nixos-23.11";
pkgs = import <nixpkgs> { };
in
pkgs.mkShell {
name = "hugo site";
buildInputs = [
pkgs.hugo
];
}