Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions envSample → .env.example
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
# Domain

# This would be set to the production domain with an env var on deployment

# used by Traefik to transmit traffic and aqcuire TLS certificates

DOMAIN=localhost

# To test the local Traefik config

# DOMAIN=localhost.tiangolo.com

# Used by the backend to generate links in emails to the frontend

FRONTEND_HOST=http://localhost:5173

# In staging and production, set this env var to the frontend host, e.g.

# FRONTEND_HOST=https://dashboard.example.com

# Environment: local, staging, production
ENVIRONMENT=local

ENVIRONMENT=local

PROJECT_NAME="AI Platform"
STACK_NAME=ai-platform

# Backend

BACKEND_CORS_ORIGINS="http://localhost:5173"
SECRET_KEY=changethis
FIRST_SUPERUSER=admin@example.com
FIRST_SUPERUSER_PASSWORD=changethis

# Emails

SMTP_HOST=
SMTP_USER=
SMTP_PASSWORD=
Expand All @@ -33,14 +43,19 @@ SMTP_SSL=False
SMTP_PORT=587

# Postgres

POSTGRES_SERVER=localhost
POSTGRES_PORT=5432
POSTGRES_DB=app
POSTGRES_DB=ai_platform
POSTGRES_USER=postgres
POSTGRES_PASSWORD=changethis
POSTGRES_PASSWORD=postgres

SENTRY_DSN=

# Configure these with your own Docker registry images

DOCKER_IMAGE_BACKEND=backend
DOCKER_IMAGE_FRONTEND=frontend
DOCKER_IMAGE_FRONTEND=frontend

CI=""
OPENAI_API_KEY="this_is_not_a_secret"
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Summary

Target issue is #_PLEASE_TYPE_ISSUE_NUMBER_
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Explain the **motivation** for making this change. What existing problem does the pull request solve?

## Checklist

Before submitting a pull request, please ensure that you mark these task.

- [ ] Ran `poetry run uvicorn src.app.main:app --reload` in the repository root and test.
- [ ] Ran `fastapi run --reload app/main.py` or `docker compose up` in the repository root and test.
- [ ] If you've fixed a bug or added code that is tested and has test cases.

## Notes
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: AI Platform CI

on:
push:
branches: [staging]
pull_request:
branches: [staging]

jobs:
checks:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ai_platform
ports:
- 5432:5432
options: --health-cmd "pg_isready -U postgres" --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
matrix:
python-version: ["3.11.7"]
redis-version: [6]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Making env file
run: cp .env.example .env

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.4.15"
enable-cache: true

- name: Install dependencies
run: uv sync
working-directory: backend

- name: Activate virtual environment and run Alembic migrations
run: |
source .venv/bin/activate
alembic upgrade head
working-directory: backend

- name: Run tests
run: uv run bash scripts/tests-start.sh "Coverage for ${{ github.sha }}"
working-directory: backend

- name: Upload coverage reports to codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

- name: Check coverage percentage
run: |
source .venv/bin/activate
coverage report --fail-under=70
working-directory: backend
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can **just fork or clone** this repository and use it as is.
Create env file using example file

```bash
cp envSample .env
cp .env.example .env
```

You can then update configs in the `.env` files to customize your configurations.
Expand All @@ -26,7 +26,8 @@ Before deploying it, make sure you change at least the values for:
- `SECRET_KEY`
- `FIRST_SUPERUSER_PASSWORD`
- `POSTGRES_PASSWORD`
```bash

````bash

### Generate Secret Keys

Expand All @@ -36,7 +37,7 @@ You have to change them with a secret key, to generate secret keys you can run t

```bash
python -c "import secrets; print(secrets.token_urlsafe(32))"
```
````

Copy the content and use that as password / secret key. And run that again to generate another secure key.

Expand All @@ -62,7 +63,6 @@ or by visiting: http://[your-domain]:8000/api/v1/utils/health-check/ in the brow

Backend docs: [backend/README.md](./backend/README.md).


## Deployment

Deployment docs: [deployment.md](./deployment.md).
Expand Down
11 changes: 9 additions & 2 deletions backend/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env bash

#!/bin/bash
set -e
set -x

# Run tests with coverage tracking
coverage run --source=app -m pytest

# Generate a human-readable coverage report in the terminal
coverage report --show-missing

# Generate an HTML report for local viewing
coverage html --title "${@-coverage}"

# Generate the XML report for Codecov
coverage xml