init: ai-prompts repo with project briefings and onboarding prompts
This commit is contained in:
57
gitea-server/client-ssh-setup.md
Normal file
57
gitea-server/client-ssh-setup.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Client SSH Setup — Desktop / Laptop
|
||||
|
||||
Give this prompt to an AI on a desktop or laptop that needs SSH git access
|
||||
to this Gitea server.
|
||||
|
||||
---
|
||||
|
||||
## Prompt
|
||||
|
||||
```
|
||||
I need to set up SSH key authentication so I can push and pull git repos
|
||||
from a self-hosted Gitea server.
|
||||
|
||||
SERVER DETAILS
|
||||
--------------
|
||||
Gitea URL: https://g.pozi.co.za
|
||||
Admin user: gadmin
|
||||
SSH (LAN): git@192.168.0.126 port 22
|
||||
SSH (external): git@g.pozi.co.za port 2222
|
||||
|
||||
STEPS
|
||||
-----
|
||||
1. Generate SSH key (skip if ~/.ssh/id_gitea already exists):
|
||||
ssh-keygen -t ed25519 -C "richard@teacup.co.za" -f ~/.ssh/id_gitea
|
||||
|
||||
2. Display the public key to add to Gitea:
|
||||
cat ~/.ssh/id_gitea.pub
|
||||
Add it at: https://g.pozi.co.za/user/settings/keys
|
||||
Give it a descriptive name (e.g. "Desktop-hostname" or "Laptop-hostname")
|
||||
|
||||
3. Add to ~/.ssh/config:
|
||||
|
||||
# Gitea — LAN access (same network)
|
||||
Host gitea-lan
|
||||
HostName 192.168.0.126
|
||||
User git
|
||||
Port 22
|
||||
IdentityFile ~/.ssh/id_gitea
|
||||
|
||||
# Gitea — external access (via port-forward)
|
||||
Host g.pozi.co.za
|
||||
HostName g.pozi.co.za
|
||||
User git
|
||||
Port 2222
|
||||
IdentityFile ~/.ssh/id_gitea
|
||||
|
||||
4. Test connection:
|
||||
ssh -T git@192.168.0.126 (LAN)
|
||||
ssh -T git@g.pozi.co.za (external)
|
||||
Expected: "Hi gadmin! You've successfully authenticated..."
|
||||
|
||||
5. Clone a repo:
|
||||
git clone git@192.168.0.126:gadmin/REPONAME.git (LAN)
|
||||
git clone git@g.pozi.co.za:gadmin/REPONAME.git (external)
|
||||
|
||||
NOTE: The public key must be added to Gitea before the SSH test will work.
|
||||
```
|
||||
84
gitea-server/new-server-onboarding.md
Normal file
84
gitea-server/new-server-onboarding.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# New Server Onboarding — Connect to Gitea
|
||||
|
||||
Give this prompt to an AI on any new server that needs to connect to this
|
||||
Gitea instance and create/push a repository.
|
||||
|
||||
---
|
||||
|
||||
## Prompt
|
||||
|
||||
```
|
||||
I need to initialise a git repository on this server and connect it to a
|
||||
self-hosted Gitea instance on my LAN. Please help me with the full setup.
|
||||
|
||||
GITEA SERVER DETAILS
|
||||
--------------------
|
||||
Public URL: https://g.pozi.co.za
|
||||
LAN URL: http://192.168.0.126:3000
|
||||
Admin user: gadmin
|
||||
API token: (request from owner)
|
||||
|
||||
SSH ACCESS (use LAN since we are on the same network)
|
||||
------------------------------------------------------
|
||||
Host: 192.168.0.126
|
||||
Port: 22
|
||||
User: git
|
||||
Clone format: git@192.168.0.126:gadmin/REPONAME.git
|
||||
|
||||
WHAT I NEED YOU TO DO
|
||||
----------------------
|
||||
1. Check if git is installed:
|
||||
git --version
|
||||
If not, install it (Debian/Ubuntu):
|
||||
apt-get install -y git
|
||||
|
||||
2. Identify this server:
|
||||
hostname && cat /etc/os-release | head -5
|
||||
|
||||
3. Generate an SSH key for this server:
|
||||
ssh-keygen -t ed25519 -C "$(hostname)@gitea" -f ~/.ssh/id_gitea -N ""
|
||||
cat ~/.ssh/id_gitea.pub
|
||||
|
||||
4. Register this server's SSH key with Gitea:
|
||||
curl -X POST http://192.168.0.126:3000/api/v1/user/keys \
|
||||
-H "Authorization: token API_TOKEN_HERE" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"key\":\"$(cat ~/.ssh/id_gitea.pub)\",\"read_only\":false,\"title\":\"$(hostname)-server\"}"
|
||||
|
||||
5. Add ~/.ssh/config entry:
|
||||
mkdir -p ~/.ssh && cat >> ~/.ssh/config << 'EOF'
|
||||
|
||||
Host gitea-lan
|
||||
HostName 192.168.0.126
|
||||
User git
|
||||
Port 22
|
||||
IdentityFile ~/.ssh/id_gitea
|
||||
EOF
|
||||
chmod 600 ~/.ssh/config
|
||||
|
||||
6. Test the connection:
|
||||
ssh -T git@192.168.0.126
|
||||
Expected: "Hi gadmin! You've successfully authenticated..."
|
||||
|
||||
7. Ask me what to name the repo, then create it and push:
|
||||
|
||||
Create on Gitea:
|
||||
curl -X POST http://192.168.0.126:3000/api/v1/user/repos \
|
||||
-H "Authorization: token API_TOKEN_HERE" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"REPONAME","private":true,"auto_init":false,"default_branch":"main"}'
|
||||
|
||||
Init and push local code:
|
||||
cd /path/to/code
|
||||
git init
|
||||
git remote add origin git@192.168.0.126:gadmin/REPONAME.git
|
||||
git add .
|
||||
git commit -m "init: initial commit from $(hostname)"
|
||||
git push -u origin main
|
||||
|
||||
NOTES
|
||||
-----
|
||||
- Use LAN address 192.168.0.126:22 (not external g.pozi.co.za:2222)
|
||||
- Never commit the API token to git
|
||||
- Repo visibility defaults to private — confirm with owner before making public
|
||||
```
|
||||
160
gitea-server/server-briefing.md
Normal file
160
gitea-server/server-briefing.md
Normal file
@@ -0,0 +1,160 @@
|
||||
# Gitea Server — Context Briefing
|
||||
|
||||
Use this file at the start of any AI session that involves managing this
|
||||
Gitea server. Paste its contents to give the AI full context.
|
||||
|
||||
---
|
||||
|
||||
## Server Identity
|
||||
|
||||
| Item | Value |
|
||||
|------|-------|
|
||||
| Hostname | GITREPO |
|
||||
| IP | 192.168.0.126 |
|
||||
| OS | Debian GNU/Linux 12 (bookworm) |
|
||||
| Role | Self-hosted Gitea git server |
|
||||
| Public domain | g.pozi.co.za |
|
||||
| Platform | Proxmox LXC container |
|
||||
| Disk | 500GB ZFS volume |
|
||||
|
||||
---
|
||||
|
||||
## Gitea Installation
|
||||
|
||||
| Item | Value |
|
||||
|------|-------|
|
||||
| Version | 1.25.4 |
|
||||
| Binary | /usr/local/bin/gitea |
|
||||
| Config | /etc/gitea/app.ini |
|
||||
| Repo storage | /srv/git |
|
||||
| Data/logs | /var/lib/gitea |
|
||||
| Service | systemd — gitea.service |
|
||||
| Run as user | git (uid 999) |
|
||||
| Web port | localhost:3000 (internal only) |
|
||||
|
||||
---
|
||||
|
||||
## Network / TLS Architecture
|
||||
|
||||
```
|
||||
Internet
|
||||
└── OPNsense router (public IP)
|
||||
├── Port 80/443 → Nginx SNI proxy (another LAN server)
|
||||
│ └── g.pozi.co.za (SNI) → 192.168.0.126:443
|
||||
└── Port 2222 → 192.168.0.126:22 (SSH git access, external)
|
||||
|
||||
192.168.0.126
|
||||
├── Nginx :80 — ACME challenge + redirect to HTTPS
|
||||
├── Nginx :443 — TLS termination (Let's Encrypt cert) + proxy → :3000
|
||||
└── Gitea :3000 — internal only
|
||||
```
|
||||
|
||||
- TLS cert: Let's Encrypt via Certbot, auto-renews
|
||||
- Cert path: /etc/letsencrypt/live/g.pozi.co.za/
|
||||
- Nginx config: /etc/nginx/sites-available/g.pozi.co.za
|
||||
|
||||
---
|
||||
|
||||
## Access Methods
|
||||
|
||||
### Web UI
|
||||
```
|
||||
https://g.pozi.co.za
|
||||
```
|
||||
|
||||
### API
|
||||
```
|
||||
Base URL: https://g.pozi.co.za/api/v1
|
||||
LAN URL: http://192.168.0.126:3000/api/v1
|
||||
Token: (request from owner — stored securely, not in this file)
|
||||
Docs: https://g.pozi.co.za/api/swagger
|
||||
```
|
||||
|
||||
### SSH (git operations)
|
||||
```
|
||||
LAN: git@192.168.0.126:gadmin/REPO.git (port 22)
|
||||
WAN: git@g.pozi.co.za:gadmin/REPO.git (port 2222)
|
||||
|
||||
~/.ssh/config entry for external access:
|
||||
Host g.pozi.co.za
|
||||
Port 2222
|
||||
User git
|
||||
IdentityFile ~/.ssh/id_gitea
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Admin Account
|
||||
|
||||
| Item | Value |
|
||||
|------|-------|
|
||||
| Username | gadmin |
|
||||
| Email | richard@teacup.co.za |
|
||||
| Name | Richard Brandon |
|
||||
| Role | Admin |
|
||||
|
||||
---
|
||||
|
||||
## Existing Repositories
|
||||
|
||||
| Repo | Visibility | Purpose |
|
||||
|------|------------|---------|
|
||||
| gadmin/multiplan | Private | Multiplan PHP ERP deployment pipeline |
|
||||
| gadmin/ai-prompts | Public | AI prompt and rules files (this repo) |
|
||||
|
||||
---
|
||||
|
||||
## Key File Locations
|
||||
|
||||
```
|
||||
/etc/gitea/app.ini Gitea config
|
||||
/etc/nginx/sites-available/g.pozi.co.za Nginx vhost
|
||||
/etc/systemd/system/gitea.service Systemd service
|
||||
/etc/letsencrypt/live/g.pozi.co.za/ TLS certificates
|
||||
/srv/git/ Bare git repositories
|
||||
/var/lib/gitea/ Gitea data, logs, sessions
|
||||
/home/git/.ssh/authorized_keys SSH keys (managed by Gitea)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Maintenance Commands
|
||||
|
||||
```bash
|
||||
# Service control
|
||||
systemctl status gitea
|
||||
systemctl restart gitea
|
||||
systemctl status nginx
|
||||
|
||||
# Check logs
|
||||
journalctl -u gitea -n 50
|
||||
tail -f /var/lib/gitea/log/gitea.log
|
||||
|
||||
# Certbot renewal (auto via timer, manual test)
|
||||
certbot renew --dry-run
|
||||
|
||||
# Disk space
|
||||
df -h
|
||||
|
||||
# Gitea version
|
||||
gitea --version
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Backup Checklist
|
||||
|
||||
Items to back up periodically:
|
||||
- `/etc/gitea/app.ini` — config (contains secrets)
|
||||
- `/srv/git/` — all bare repo data
|
||||
- `/var/lib/gitea/data/gitea.db` — SQLite database (users, keys, settings)
|
||||
- `/etc/letsencrypt/` — TLS certs and account
|
||||
|
||||
---
|
||||
|
||||
## What This Server Does NOT Do
|
||||
|
||||
- It does not run application code
|
||||
- It does not have a CI/CD runner
|
||||
- It does not send email (mailer disabled)
|
||||
- It is passive — receives pushes, serves pulls
|
||||
Reference in New Issue
Block a user