todolist-proto/DEPLOYMENT.md

120 lines
3.1 KiB
Markdown
Raw Normal View History

2026-01-20 18:40:33 +01:00
# Deployment to Gitea Package Registry
This document describes how to deploy the Docker images to the Gitea package registry using the Python deployment script.
## Prerequisites
1. **Python 3.x** installed on your system
2. Access to Gitea server at https://brokkr.robotico.dev/
3. A personal access token with package write permissions
4. Docker and Docker Compose installed
## Setup
### 1. Install Python Dependencies
```bash
pip install -r requirements.txt
```
This installs:
- `python-dotenv` - For loading environment variables from .env file
### 2. Create .env file
Create a `.env` file in the project root (this file is git-ignored):
```bash
PUBLISH_TOKEN=your_gitea_personal_access_token_here
```
**Important**: Never commit the `.env` file to version control!
### 3. Get Your Gitea Token
1. Log in to https://brokkr.robotico.dev/
2. Go to User Settings → Applications
3. Create a new token with "write:package" permission
4. Copy the token and add it to your `.env` file
## Deployment
Run the Python deployment script:
```bash
python deploy.py
```
Or on systems where Python 3 is not the default:
```bash
python3 deploy.py
```
The script will:
1. Load the `PUBLISH_TOKEN` from `.env` file
2. Build both frontend and backend Docker images using docker-compose
3. Tag them for the Gitea registry
4. Log in to the Gitea Docker registry
5. Push both images to the registry
## What the Script Does
The Python deployment script (`deploy.py`) performs the following steps:
1. Loads the `PUBLISH_TOKEN` from `.env` file using python-dotenv
2. Validates that the token exists
3. Builds both frontend and backend Docker images via `docker-compose build`
4. Tags them for the Gitea registry:
- `https://brokkr.robotico.dev/dalex/dalex-todo-backend:latest`
- `https://brokkr.robotico.dev/dalex/dalex-todo-frontend:latest`
5. Logs in to the Gitea Docker registry
6. Pushes both images to the registry
7. Displays success message with package URLs
## Using the Deployed Images
After deployment, you can pull and use the images from the Gitea registry:
```bash
docker pull https://brokkr.robotico.dev/dalex/dalex-todo-backend:latest
docker pull https://brokkr.robotico.dev/dalex/dalex-todo-frontend:latest
```
Or update your `docker-compose.yml` to use the registry images instead of building locally:
```yaml
services:
backend:
image: https://brokkr.robotico.dev/dalex/dalex-todo-backend:latest
# Remove the 'build' section
frontend:
image: https://brokkr.robotico.dev/dalex/dalex-todo-frontend:latest
# Remove the 'build' section
```
## Troubleshooting
### Authentication Failed
- Verify your token is correct in the `.env` file
- Check that the token has "write:package" permission
- Ensure the token hasn't expired
### Build Failed
- Run `docker-compose build` manually to see detailed error messages
- Check that all source files are present and correct
### Push Failed
- Verify you have write access to the `dalex` organization/user on Gitea
- Check network connectivity to https://brokkr.robotico.dev/
- Ensure the registry URL is correct
## Package Registry Location
The packages will be available at:
https://brokkr.robotico.dev/dalex/-/packages