From 9792110560f3d16ad665ec2aecef98ce1f7dd4eb Mon Sep 17 00:00:00 2001 From: Avnyr Date: Thu, 15 May 2025 19:10:07 +0200 Subject: [PATCH] docs: add CI/CD and deployment documentation Added a new `README.md` under `.github` to document the project's CI/CD workflow and deployment setup. Includes GitHub Actions pipeline descriptions, Docker configuration details, environment variables, and production deployment considerations. --- .github/README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/README.md diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..240d375 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,75 @@ +# CI/CD and Deployment Documentation + +This directory contains the CI/CD configuration for the project. + +## CI/CD Workflow + +The CI/CD pipeline is configured using GitHub Actions and is defined in the `.github/workflows/ci-cd.yml` file. The workflow consists of the following steps: + +### Build and Test + +This job runs on every push to the main branch and on pull requests: + +1. Sets up Node.js and pnpm +2. Installs dependencies +3. Builds and tests the backend +4. Builds and lints the frontend + +### Build and Push Docker Images + +This job runs only on pushes to the main branch: + +1. Sets up Docker Buildx +2. Logs in to GitHub Container Registry +3. Builds and pushes the backend Docker image +4. Builds and pushes the frontend Docker image + +## Deployment + +The application is containerized using Docker. Dockerfiles are provided for both the backend and frontend: + +- `backend/Dockerfile`: Multi-stage build for the NestJS backend +- `frontend/Dockerfile`: Multi-stage build for the Next.js frontend + +A `docker-compose.yml` file is also provided at the root of the project for local development and as a reference for deployment. + +### Running Locally with Docker Compose + +```bash +# Build and start all services +docker-compose up -d + +# View logs +docker-compose logs -f + +# Stop all services +docker-compose down +``` + +### Environment Variables + +The following environment variables are used in the deployment: + +#### Backend +- `NODE_ENV`: Environment (development, production) +- `PORT`: Port on which the backend runs +- `POSTGRES_HOST`: PostgreSQL host +- `POSTGRES_PORT`: PostgreSQL port +- `POSTGRES_DB`: PostgreSQL database name +- `POSTGRES_USER`: PostgreSQL username +- `POSTGRES_PASSWORD`: PostgreSQL password + +#### Frontend +- `NODE_ENV`: Environment (development, production) +- `PORT`: Port on which the frontend runs +- `NEXT_PUBLIC_API_URL`: URL of the backend API + +## Production Deployment Considerations + +For production deployment, consider the following: + +1. Use a proper secrets management solution for sensitive information +2. Set up proper networking and security groups +3. Configure a reverse proxy (like Nginx) for SSL termination +4. Set up monitoring and logging +5. Configure database backups \ No newline at end of file