feat: setup docker, backend, and gitea pipeline for production
All checks were successful
Build and Deploy / build-and-push (push) Successful in 4m19s

This commit is contained in:
Cauê Faleiros
2026-02-23 15:21:28 -03:00
parent 3250ad7537
commit 28c75bbe13
11 changed files with 425 additions and 8 deletions

58
GEMINI.md Normal file
View File

@@ -0,0 +1,58 @@
# Fasto Project Documentation
## Overview
Fasto is a commercial team management system built with React (Vite) on the frontend and Node.js (Express) on the backend. It uses a MySQL database.
## Architecture
- **Frontend**: React, TypeScript, Vite.
- **Backend**: Node.js, Express, MySQL2.
- **Database**: MySQL 8.0.
- **Deployment**: Docker Compose for local development; Gitea Actions for CI/CD pushing to a Gitea Registry and deploying via Portainer webhook.
## Prerequisites
- Docker & Docker Compose
- Node.js (for local development outside Docker)
## Setup & Running
### 1. Environment Variables
Copy `.env.example` to `.env` and adjust the values:
```bash
cp .env.example .env
```
Ensure you set the database credentials and Gitea Runner token if you plan to run the runner locally.
### 2. Database
The project expects a MySQL database. A `docker-compose.yml` file is provided which spins up a MySQL container and initializes it with `agenciac_comia.sql`.
### 3. Running with Docker Compose
To start the application, database, and runner:
```bash
docker-compose up -d --build
```
- Frontend/Backend: http://localhost:3001
- Database: Exposed on port 3306 (internal to network mostly, but mapped if needed)
### 4. Gitea Runner
The `docker-compose.yml` includes a service for a Gitea Runner (`fasto-runner`).
- Ensure `GITEA_RUNNER_REGISTRATION_TOKEN` is set in `.env`.
- The runner data is persisted in `./fasto_runner/data`.
## CI/CD Pipeline
The project uses Gitea Actions defined in `.gitea/workflows/build-deploy.yaml`.
- **Triggers**: Push to `main` or `master`.
- **Steps**:
1. Checkout code.
2. Build Docker image.
3. Push to `gitea.blyzer.com.br`.
4. Trigger Portainer webhook.
- **Secrets Required in Gitea**:
- `REGISTRY_USERNAME`
- `REGISTRY_TOKEN`
- `PORTAINER_WEBHOOK`
- `API_KEY` (Optional build arg)
## Development
- **Frontend**: `npm run dev` (Runs on port 3000)
- **Backend**: `node backend/index.js` (Runs on port 3001)
*Note: For local dev, you might need to run a local DB or point to the dockerized one.*