Compare commits
2 Commits
develop
...
6768946b0a
| Author | SHA1 | Date | |
|---|---|---|---|
|
6768946b0a
|
|||
|
1e769f0b39
|
4
.github/workflows/README.md
vendored
4
.github/workflows/README.md
vendored
@@ -7,7 +7,7 @@ The `publish-docker.yml` workflow automatically builds and publishes Docker imag
|
|||||||
### Triggers and Tagging Strategy
|
### Triggers and Tagging Strategy
|
||||||
|
|
||||||
| Event | Condition | Published Tags | Example |
|
| Event | Condition | Published Tags | Example |
|
||||||
|--------------|-----------------------------|------------------------|-------------------|
|
|--------------+-----------------------------+------------------------+-------------------|
|
||||||
| Tag push | Tag pushed to `main` branch | `latest` + version tag | `latest`, `1.0.0` |
|
| Tag push | Tag pushed to `main` branch | `latest` + version tag | `latest`, `1.0.0` |
|
||||||
| Branch push | Push to `develop` branch | `develop` | `develop` |
|
| Branch push | Push to `develop` branch | `develop` | `develop` |
|
||||||
| Pull request | PR opened or updated | `pr<number>` | `pr12` |
|
| Pull request | PR opened or updated | `pr<number>` | `pr12` |
|
||||||
@@ -18,7 +18,7 @@ The `publish-docker.yml` workflow automatically builds and publishes Docker imag
|
|||||||
Configure these secrets in your repository settings (`Settings` → `Secrets and variables` → `Actions`):
|
Configure these secrets in your repository settings (`Settings` → `Secrets and variables` → `Actions`):
|
||||||
|
|
||||||
| Secret Name | Description | Example Value |
|
| Secret Name | Description | Example Value |
|
||||||
|---------------------|---------------------------------------------|-----------------------------------------|
|
|---------------------+---------------------------------------------+-----------------------------------------|
|
||||||
| `DOCKER_USERNAME` | Username for Docker registry authentication | `phundrak` |
|
| `DOCKER_USERNAME` | Username for Docker registry authentication | `phundrak` |
|
||||||
| `DOCKER_PASSWORD` | Password or token for Docker registry | Personal Access Token (PAT) or password |
|
| `DOCKER_PASSWORD` | Password or token for Docker registry | Personal Access Token (PAT) or password |
|
||||||
| `CACHIX_AUTH_TOKEN` | (Optional) Token for Cachix caching | Your Cachix auth token |
|
| `CACHIX_AUTH_TOKEN` | (Optional) Token for Cachix caching | Your Cachix auth token |
|
||||||
|
|||||||
13
.github/workflows/publish-docker.yml
vendored
13
.github/workflows/publish-docker.yml
vendored
@@ -12,6 +12,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CACHIX_NAME: devenv
|
CACHIX_NAME: devenv
|
||||||
|
CACHIX_SKIP_PUSH: true
|
||||||
DOCKER_REGISTRY: labs.phundrak.com # Override in repository settings if needed
|
DOCKER_REGISTRY: labs.phundrak.com # Override in repository settings if needed
|
||||||
IMAGE_NAME: phundrak/phundrak-dot-com-backend
|
IMAGE_NAME: phundrak/phundrak-dot-com-backend
|
||||||
|
|
||||||
@@ -37,17 +38,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: '${{ env.CACHIX_NAME }}'
|
name: '${{ env.CACHIX_NAME }}'
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
skipPush: ${{ github.event_name == 'pull_request' }}
|
skipPush: ${{ env.CACHIX_SKIP_PUSH }}
|
||||||
|
|
||||||
- name: Coverage
|
|
||||||
run: |
|
|
||||||
nix develop --no-pure-eval --command just coverage
|
|
||||||
|
|
||||||
- name: Sonar analysis
|
|
||||||
uses: SonarSource/sonarqube-scan-action@v6
|
|
||||||
env:
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
||||||
|
|
||||||
- name: Build Docker image with Nix
|
- name: Build Docker image with Nix
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
64
README.md
64
README.md
@@ -1,24 +1,42 @@
|
|||||||
---
|
|
||||||
include_toc: true
|
|
||||||
gitea: none
|
|
||||||
---
|
|
||||||
|
|
||||||
# phundrak.com Backend
|
# phundrak.com Backend
|
||||||
|
|
||||||
<div align="center">
|
<!--toc:start-->
|
||||||
<a href="https://sonar.phundrak.com/dashboard?id=phundrak-backend" target="_blank">
|
- [phundrak.com Backend](#phundrakcom-backend)
|
||||||
<img src="https://sonar.phundrak.com/api/project_badges/measure?project=phundrak-backend&metric=coverage&token=sqb_bda24bf36825576d6c6b76048044e103339c3c5f" alt="Sonar Coverage" />
|
- [Features](#features)
|
||||||
</a>
|
- [API Endpoints](#api-endpoints)
|
||||||
<a href="https://sonar.phundrak.com/dashboard?id=phundrak-backend" target="_blank">
|
- [Configuration](#configuration)
|
||||||
<img src="https://sonar.phundrak.com/api/project_badges/measure?project=phundrak-backend&metric=alert_status&token=sqb_bda24bf36825576d6c6b76048044e103339c3c5f" alt="Sonar Quality Gate Status" />
|
- [Configuration Example](#configuration-example)
|
||||||
</a>
|
- [Rate Limiting](#rate-limiting)
|
||||||
<a href="#license">
|
- [Development](#development)
|
||||||
<img src="https://img.shields.io/badge/License-AGPL--3.0--only-blue" alt="License" />
|
- [Prerequisites](#prerequisites)
|
||||||
</a>
|
- [Running the Server](#running-the-server)
|
||||||
<a href="https://www.gnu.org/software/emacs/" target="_blank">
|
- [Building](#building)
|
||||||
<img src="https://img.shields.io/badge/Made%20with-GNU%2FEmacs-blueviolet.svg?logo=GNU%20Emacs&logoColor=white" alt="Made with GNU/Emacs" />
|
- [Testing](#testing)
|
||||||
</a>
|
- [Testing Notes](#testing-notes)
|
||||||
</div>
|
- [Code Quality](#code-quality)
|
||||||
|
- [Linting](#linting)
|
||||||
|
- [Continuous Checking with Bacon](#continuous-checking-with-bacon)
|
||||||
|
- [Code Style](#code-style)
|
||||||
|
- [Error Handling](#error-handling)
|
||||||
|
- [Logging](#logging)
|
||||||
|
- [Imports](#imports)
|
||||||
|
- [Testing Conventions](#testing-conventions)
|
||||||
|
- [Project Structure](#project-structure)
|
||||||
|
- [Architecture](#architecture)
|
||||||
|
- [Application Initialization Flow](#application-initialization-flow)
|
||||||
|
- [Email Handling](#email-handling)
|
||||||
|
- [Docker Deployment](#docker-deployment)
|
||||||
|
- [Using Pre-built Images](#using-pre-built-images)
|
||||||
|
- [Available Image Tags](#available-image-tags)
|
||||||
|
- [Building Images Locally](#building-images-locally)
|
||||||
|
- [Docker Compose Example](#docker-compose-example)
|
||||||
|
- [CI/CD Pipeline](#cicd-pipeline)
|
||||||
|
- [Automated Docker Publishing](#automated-docker-publishing)
|
||||||
|
- [Workflow Details](#workflow-details)
|
||||||
|
- [Registry Configuration](#registry-configuration)
|
||||||
|
- [Required Secrets](#required-secrets)
|
||||||
|
- [License](#license)
|
||||||
|
<!--toc:end-->
|
||||||
|
|
||||||
The backend for [phundrak.com](https://phundrak.com), built with Rust and the [Poem](https://github.com/poem-web/poem) web framework.
|
The backend for [phundrak.com](https://phundrak.com), built with Rust and the [Poem](https://github.com/poem-web/poem) web framework.
|
||||||
|
|
||||||
@@ -198,7 +216,6 @@ just coverage
|
|||||||
- Tests use `get_test_app()` helper for consistent test setup
|
- Tests use `get_test_app()` helper for consistent test setup
|
||||||
- Telemetry is automatically disabled during tests
|
- Telemetry is automatically disabled during tests
|
||||||
- Tests are organized in `#[cfg(test)]` modules within each file
|
- Tests are organized in `#[cfg(test)]` modules within each file
|
||||||
- Email sending is tested using lettre's `StubTransport` for mocking SMTP operations
|
|
||||||
|
|
||||||
## Code Quality
|
## Code Quality
|
||||||
|
|
||||||
@@ -277,15 +294,12 @@ backend/
|
|||||||
│ ├── startup.rs # Application builder, server setup
|
│ ├── startup.rs # Application builder, server setup
|
||||||
│ ├── settings.rs # Configuration management
|
│ ├── settings.rs # Configuration management
|
||||||
│ ├── telemetry.rs # Logging and tracing setup
|
│ ├── telemetry.rs # Logging and tracing setup
|
||||||
│ ├── errors.rs # Error type re-exports
|
|
||||||
│ ├── middleware/ # Custom middleware
|
│ ├── middleware/ # Custom middleware
|
||||||
│ │ ├── mod.rs # Middleware module
|
│ │ ├── mod.rs # Middleware module
|
||||||
│ │ └── rate_limit.rs # Rate limiting middleware
|
│ │ └── rate_limit.rs # Rate limiting middleware
|
||||||
│ └── route/ # API route handlers
|
│ └── route/ # API route handlers
|
||||||
│ ├── mod.rs # Route organization
|
│ ├── mod.rs # Route organization
|
||||||
│ ├── contact/ # Contact form module
|
│ ├── contact.rs # Contact form endpoint
|
||||||
│ │ ├── mod.rs # Contact form endpoint
|
|
||||||
│ │ └── errors.rs # Contact form error types
|
|
||||||
│ ├── health.rs # Health check endpoint
|
│ ├── health.rs # Health check endpoint
|
||||||
│ └── meta.rs # Metadata endpoint
|
│ └── meta.rs # Metadata endpoint
|
||||||
├── settings/ # Configuration files
|
├── settings/ # Configuration files
|
||||||
@@ -445,4 +459,4 @@ See [.github/workflows/README.md](./.github/workflows/README.md) for detailed se
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
AGPL-3.0-only - See [LICENSE.md](./LICENSE.md) for full license information.
|
AGPL-3.0-only - See the root repository for full license information.
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
sonar.projectKey=phundrak-backend
|
|
||||||
Reference in New Issue
Block a user