feat: add Gitea workflow for deploying Kekbot to NAS via SSH

This commit is contained in:
2025-12-24 20:38:13 -05:00
parent 2ac855b765
commit 7795662584
2 changed files with 134 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
# Gitea Workflow Deployment to NAS
This guide explains how to set up the Gitea workflow to deploy Kekbot to your NAS via SSH.
## Prerequisites
1. **Docker and Docker Compose** must be installed on your NAS
2. **SSH access** enabled on your NAS with password authentication
## Setup Instructions
### 1. Add SSH Password Secret to Gitea
1. Go to your Gitea repository
2. Navigate to **Settings****Secrets** (or **Actions****Secrets**)
3. Add a new secret named `NAS_SSH_PASSWORD`
4. Set the value to your NAS user password (hllywluis)
### 2. Verify NAS Configuration
Ensure your NAS has:
- Docker installed
- Docker Compose installed
- SSH server running on port 22
- Password authentication enabled for SSH
### 3. Test SSH Access (Optional)
Before running the workflow, you can test SSH access:
```bash
ssh hllywluis@luis-nas.lan
```
## Workflow Configuration
The workflow file is located at [`.gitea/workflows/deploy-nas.yml`](.gitea/workflows/deploy-nas.yml)
### How It Works
1. **Build**: Builds the Docker image locally using Docker Buildx
2. **Save**: Saves the Docker image as a tar archive
3. **Transfer**: Uses `sshpass` to SSH into your NAS and copy files
4. **Deploy**: Loads the Docker image and runs `docker-compose up -d`
### Manual Trigger
You can manually trigger the deployment by:
1. Going to your Gitea repository
2. Navigating to **Actions**
3. Selecting the **Deploy to NAS** workflow
4. Clicking **Run workflow**
## Troubleshooting
### SSH Connection Failed
If the workflow fails with SSH connection issues:
- Verify `NAS_SSH_PASSWORD` secret is set correctly
- Check that the NAS is reachable at `luis-nas.lan`
- Ensure SSH password authentication is enabled on the NAS
### Docker Errors
If Docker fails on the NAS:
- Verify Docker is running: `docker ps`
- Check Docker Compose: `docker-compose --version`
- Review logs: `docker-compose logs`
### Permission Issues
The workflow uses the `hllywluis` user. If you need a different user:
1. Update the `hllywluis@luis-nas.lan` in the workflow file
2. Adjust the `/mnt/kCloud/Home/hllywluis/kekbot` directory permissions accordingly