Files
stoat_role_bot/docs/GITEA-SETUP.md
T
Dawnsorrow 0a57be59f4
Build and Push Image / build (push) Has been cancelled
Clean up: remove build-for-nas.sh, update deploy docs and push script
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 21:02:02 -06:00

8.9 KiB
Raw Blame History

Simple Gitea setup for Stoat Role Bot

This guide assumes you have a Gitea server (e.g. https://gitea.yourdomain.com) and want the bots Docker image to be built and stored there so your NAS can pull it.


Your exact values (copy-paste)

What Value
Gitea URL http://brassnet.ddns.net:33983
Username Dawnsorrow
Registry host (for Docker/Podman) brassnet.ddns.net:33983
Full image name (after workflow runs) brassnet.ddns.net:33983/Dawnsorrow/stoat-role-bot:latest

Git remote (from your PC, in the bot project folder):

git remote add origin http://brassnet.ddns.net:33983/Dawnsorrow/stoat-role-bot.git

On your NAS in .env add:

GITEA_IMAGE=brassnet.ddns.net:33983/Dawnsorrow/stoat-role-bot:latest

Gitea repo Settings → Secrets create:

  • REGISTRY_USER = Dawnsorrow
  • REGISTRY_PASSWORD = your Gitea password (or a Personal Access Token)

Manual push from PC (if youre not using Actions):

export GITEA_REGISTRY=brassnet.ddns.net:33983
export GITEA_OWNER=Dawnsorrow
./push-to-gitea.sh

What youre doing in one sentence

Youll put this bots code in a Gitea repository, add two secrets (username + password), and then every time you push to the repo, Gitea will build the Docker image and publish it to its built-in container registry. Your NAS will pull that image and run it.


Part 1: Create the repository in Gitea

  1. Log in to your Gitea in the browser.
  2. Click “+” (or New) → New Repository.
  3. Fill in:
    • Repository name: stoat-role-bot (or any name you like).
    • Visibility: Private or Public (your choice).
    • Leave “Initialize repository” unchecked if you already have the code on your PC.
  4. Click Create Repository.

Youll see an empty repo (or a page with clone/push instructions). Thats your “home” for this bots code.


Part 2: Push this projects code to that repository

From your PC, in the folder where the bot code lives (the one with bot/, Dockerfile, .gitea/, etc.):

  1. If this folder is not a git repo yet:
    cd "/home/jorg/Documents/Cursor Projects/Role Bot"
    git init
    git add .
    git commit -m "Initial commit: Stoat Role Bot"
    
  2. Add Gitea as the remote (replace with your Gitea URL and username):
    git remote add origin https://gitea.yourdomain.com/YOUR_USERNAME/stoat-role-bot.git
    
    Example: if your Gitea is https://git.myserver.com and your username is jorg:
    git remote add origin https://git.myserver.com/jorg/stoat-role-bot.git
    
  3. Push the code:
    git push -u origin main
    
    If your branch is named master instead of main, use:
    git push -u origin master
    

After this, the bots code (including the Dockerfile and the workflow file) is in Gitea.


Part 3: Turn on Gitea Actions (if your instance has it)

  1. In Gitea, open your user menu (top right) → Site Administration (only if youre an admin).
  2. Or ask your Gitea admin: “Is Actions enabled for this instance?”
  3. For this repo: go to the repo → Settings → check for an Actions or Workflows section. If you see “Actions” or “Workflows” and theyre enabled, youre good.

If Actions are not available, you can skip the automated build and use the manual push method at the end instead.


Part 4: Add the two “secrets” (so Gitea can push to its own registry)

Gitea needs to log in to its container registry to push the image. You give it your credentials as secrets (so theyre not written in the code).

  1. In your repo on Gitea, go to Settings (repo menu or top tabs).
  2. In the left sidebar, click Secrets (or Secrets and Variables).
  3. Add two secrets:
Name Value Notes
REGISTRY_USER Your Gitea username The one you use to log in.
REGISTRY_PASSWORD Your Gitea password Or a Personal Access Token (see below).

Using a token instead of password (recommended):

  1. In Gitea: your profile icon (top right) → SettingsApplicationsGenerate New Token.
  2. Name it e.g. stoat-bot-registry, enable write:package (or “packages”) if you see it, then create the token.
  3. Copy the token and use it as the value for REGISTRY_PASSWORD (leave REGISTRY_USER as your username).

After saving both secrets, the workflow can log in to the registry when it runs.


Part 5: What happens when you push

  • The workflow file is in .gitea/workflows/docker.yml.
  • When you push to main (or master), Gitea runs that workflow:
    1. It builds the Docker image from the Dockerfile in the repo.
    2. It logs in to Giteas container registry using the two secrets.
    3. It pushes the image as: {your-gitea-host}/{your-username}/stoat-role-bot:latest

Example: if your Gitea URL is https://git.myserver.com and your username is jorg, the image will be:

git.myserver.com/jorg/stoat-role-bot:latest

(no https:// in the image name)


If you see “No matching online runner with label: ubuntu-latest”

Gitea does not provide hosted runners like GitHub. The workflow only runs if a self-hosted runner is registered with your Gitea instance and has the label ubuntu-latest.

Options:

  1. Use the manual build and push (no runner needed): see “If Gitea Actions arent available: manual push” below. Run ./push-to-gitea.sh from your PC after a one-time podman login brassnet.ddns.net:33983.
  2. Set up a self-hosted runner: in Gitea go to Settings → Actions → Runners, add a new runner on a machine that has Docker, and give it the label ubuntu-latest so the workflow can use it.

Part 6: Use that image on your NAS

  1. On the NAS, create a folder for the bot (e.g. stoat-role-bot) and put there:
    • config/ (with your roles.json).
    • .env with at least:
      • STOAT_BOT_TOKEN=your_bot_token
      • GITEA_IMAGE=git.myserver.com/jorg/stoat-role-bot:latest
        (use your Gitea host and username).
  2. Copy into that folder the file docker-compose.pull.yml from this repo.
  3. In that folder, run:
    docker compose -f docker-compose.pull.yml pull
    docker compose -f docker-compose.pull.yml up -d
    

If your Gitea is only reachable on your LAN, the NAS must be able to reach that host (e.g. git.myserver.com or your servers IP). If the registry is private, you may need to run docker login git.myserver.com on the NAS once (with your Gitea username and password/token).

HTTP (no HTTPS): If your Gitea is at http://... (like http://brassnet.ddns.net:33983), Docker may treat the registry as “insecure.” On the NAS you might need to add that host to Dockers insecure registries (e.g. in /etc/docker/daemon.json: "insecure-registries": ["brassnet.ddns.net:33983"]) and restart Docker, then run docker login brassnet.ddns.net:33983 with your Gitea username and password.


If Gitea Actions arent available (or “No matching runner”): manual push

You can build and push the image from your PC instead of using Actions:

  1. Allow HTTP registry (if your Gitea is http://). One-time, on your PC:

    mkdir -p ~/.config/containers
    printf '%s\n' '[[registry]]' 'location = "brassnet.ddns.net:33983"' 'insecure = true' > ~/.config/containers/registries.conf
    

    (If you already have a registries.conf, add the [[registry]] block for brassnet.ddns.net:33983 instead of overwriting.)

  2. Log in to the registry (one-time per machine):

    podman login brassnet.ddns.net:33983
    

    Use your Gitea username and password (or token).

  3. Build and push from the bot project folder:

    cd "/path/to/Role Bot"
    ./push-to-gitea.sh
    

    Defaults are brassnet.ddns.net:33983 and Dawnsorrow; the script lowercases the owner for the image name (e.g. dawnsorrow/stoat-role-bot:latest).

  4. On the NAS, use image brassnet.ddns.net:33983/dawnsorrow/stoat-role-bot:latest (lowercase dawnsorrow) and run the same docker compose -f docker-compose.pull.yml commands.


Quick checklist

  • Repo created in Gitea.
  • Code pushed to that repo (git push origin main).
  • Actions enabled (if available).
  • Secrets REGISTRY_USER and REGISTRY_PASSWORD added in repo Settings.
  • After a push, the workflow runs and the image appears under the repos Packages (or Container registry).
  • On the NAS: GITEA_IMAGE set in .env, then docker compose -f docker-compose.pull.yml pull && up -d.

If you tell me your Gitea URL and username (e.g. git.myserver.com and jorg), I can give you the exact commands and .env line with those values filled in.