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
26 changes: 21 additions & 5 deletions .env → .env.example
Original file line number Diff line number Diff line change
@@ -1,28 +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

PROJECT_NAME="Full Stack FastAPI Project"
STACK_NAME=full-stack-fastapi-project
PROJECT_NAME="AI Platform"
STACK_NAME=ai-platform

# Backend
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com"

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 @@ -32,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

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
18 changes: 0 additions & 18 deletions .github/workflows/add-to-project.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/cd-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy AI Platform to ECS Production

on:
push:
tags:
- 'v*' # Deploy only when tags like v1.0.0, v2.1.0, etc., are created

jobs:
build:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read
attestations: write
id-token: write

steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section
with:
role-to-assume: arn:aws:iam::024209611402:role/github-action-role
aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build and Push Docker Image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ github.event.repository.name }}-repo
TAG: ${{ github.ref_name }}
run: |
docker build -t $REGISTRY/$REPOSITORY:latest ./backend
docker push $REGISTRY/$REPOSITORY:latest

- name: Deploy to ECS
run: |
aws ecs update-service \
--cluster ${{ github.event.repository.name }}-cluster \
--service ${{ github.event.repository.name }}-service \
--force-new-deployment
44 changes: 44 additions & 0 deletions .github/workflows/cd-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy AI Platform to ECS

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read
attestations: write
id-token: write


steps:
- name: checkout the repo
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section
with:
role-to-assume: arn:aws:iam::024209611402:role/github-action-role
aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2


- name: Build and Push Docker Image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ github.event.repository.name }}-staging-repo
run: |
docker build -t $REGISTRY/$REPOSITORY:latest ./backend
docker push $REGISTRY/$REPOSITORY:latest

- name: Deploy to ECS
run: |
aws ecs update-service --cluster ${{ github.event.repository.name }}-staging-cluster --service ${{ github.event.repository.name }}-staging-service --force-new-deployment
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: [main]
pull_request:
branches: [main]

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
32 changes: 0 additions & 32 deletions .github/workflows/deploy-production.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/deploy-staging.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/generate-client.yml

This file was deleted.

Loading
Loading