Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #27

Merged
merged 99 commits into from
Jul 1, 2024
Merged

Dev #27

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
4da6b27
Create Dockerfile
tushar5526 May 24, 2024
0f07f4f
feat: dockerize
tushar5526 May 24, 2024
df2a400
feat: add ci
tushar5526 May 24, 2024
98b23df
fix
tushar5526 May 24, 2024
027ba83
update docker image
tushar5526 May 24, 2024
5ea444e
fix image name
tushar5526 May 24, 2024
af01457
fix image name
tushar5526 May 24, 2024
eba3970
push
tushar5526 May 24, 2024
186d095
fix name
tushar5526 May 24, 2024
362ff78
fix
tushar5526 May 24, 2024
968882f
fix
tushar5526 May 24, 2024
d414b2b
ficx
tushar5526 May 24, 2024
0d29f26
fix
tushar5526 May 24, 2024
e3124c2
fix: deploy
tushar5526 May 26, 2024
3bb753f
fix
tushar5526 May 26, 2024
e2a3a20
fix
tushar5526 May 26, 2024
1167745
Update Dockerfile
karntrehan May 27, 2024
962065e
Update wsgi.py
karntrehan May 27, 2024
1b41fc2
Update Dockerfile
sasi2312 May 27, 2024
6e8fe3b
Update Dockerfile
karntrehan May 27, 2024
2bcf8f4
Revert wsgi.py
karntrehan May 27, 2024
194f1fc
Merge pull request #1 from Code4GovTech/devops
karntrehan May 28, 2024
bd769dd
API - restructured
sasi2312 May 28, 2024
4769cb6
Merge branch 'dev' of https://github.com/Code4GovTech/DMP-CMS-Backend…
sasi2312 May 28, 2024
a00897f
Create .dockerignore
tushar5526 May 28, 2024
741a1cf
middleware (auth) added
sasi2312 May 28, 2024
3ebbf1e
middleware change
sasi2312 May 29, 2024
769ac1e
API base changes
sasi2312 May 29, 2024
cdd84b5
api changes & cors added
sasi2312 May 30, 2024
5feb288
keys changed
sasi2312 May 30, 2024
cf4097a
Merge pull request #2 from Code4GovTech/sasi_dev
VedantKhairnar May 30, 2024
78ed104
cors added
sasi2312 May 30, 2024
4ab983c
Merge pull request #4 from Code4GovTech/sasi_dev
VedantKhairnar May 30, 2024
a4e7746
changes
sasi2312 May 30, 2024
0c387cc
Merge pull request #5 from Code4GovTech/sasi_dev
VedantKhairnar May 30, 2024
fc55902
cors added - 2
sasi2312 May 30, 2024
3795e9c
Merge pull request #6 from Code4GovTech/sasi_dev
VedantKhairnar May 30, 2024
7b821d7
cors - 3
sasi2312 May 30, 2024
c5b55f0
Merge pull request #7 from Code4GovTech/sasi_dev
VedantKhairnar May 30, 2024
32f6a92
auth removed
sasi2312 May 30, 2024
6a96bf5
Merge pull request #8 from Code4GovTech/sasi_dev
VedantKhairnar May 30, 2024
636e808
api changes
sasi2312 May 31, 2024
571f27b
middleware added
sasi2312 May 31, 2024
a6dd91c
cors checking
sasi2312 May 31, 2024
16632a8
change 1
sasi2312 May 31, 2024
1343702
changes
sasi2312 May 31, 2024
770882a
change 3
sasi2312 May 31, 2024
964687a
change 4
sasi2312 May 31, 2024
98784aa
pr_details removed & body added
sasi2312 Jun 3, 2024
0a39dec
issue fixes
sasi2312 Jun 3, 2024
24bced6
key change
sasi2312 Jun 3, 2024
d962e44
headers added
sasi2312 Jun 3, 2024
7366bbb
api logic changes (from supabase)
sasi2312 Jun 4, 2024
6328ff7
api fix 1st
sasi2312 Jun 4, 2024
f46998f
cors origin added
sasi2312 Jun 5, 2024
8bd894e
Merge pull request #10 from Code4GovTech/cors_fix
VedantKhairnar Jun 5, 2024
bba7ae9
env keys remaned
sasi2312 Jun 5, 2024
f983c25
Merge pull request #11 from Code4GovTech/cors_fix
sasi2312 Jun 5, 2024
2597910
env renamed
sasi2312 Jun 5, 2024
1ec5073
Merge pull request #12 from Code4GovTech/cors_fix
sasi2312 Jun 5, 2024
001c4e1
Update ci.yml
sasi2312 Jun 5, 2024
a536f4f
api issue fix
sasi2312 Jun 7, 2024
0525af7
Merge pull request #13 from Code4GovTech/cors_fix
sasi2312 Jun 10, 2024
7ecd8eb
auth added
sasi2312 Jun 10, 2024
c6f2da6
Merge pull request #14 from Code4GovTech/cors_fix
sasi2312 Jun 11, 2024
b83977d
v2 apis
sasi2312 Jun 12, 2024
d1b9bde
import issue fix
sasi2312 Jun 12, 2024
0ed597e
overall percentage finder added
sasi2312 Jun 13, 2024
964fe5b
pr data by issue num added
sasi2312 Jun 13, 2024
4156ab5
cont_id removed
sasi2312 Jun 13, 2024
b4cc8ff
issue fix
sasi2312 Jun 13, 2024
14c8331
issue fix
sasi2312 Jun 13, 2024
9e4a82a
overall prog changes
sasi2312 Jun 13, 2024
2e3de42
status code changes
sasi2312 Jun 14, 2024
f5cfe73
find org from org_name
sasi2312 Jun 14, 2024
2fea286
[Fix] as per the new DB structure
VedantKhairnar Jun 17, 2024
3250a5e
3rd api fix
sasi2312 Jun 17, 2024
3b6092c
Merge pull request #16 from Code4GovTech/dev_vedant
VedantKhairnar Jun 17, 2024
cf47d01
key changes
sasi2312 Jun 17, 2024
1bf2424
Merge pull request #17 from Code4GovTech/dev_vedant
sasi2312 Jun 17, 2024
34658d5
v2 api changes in week leanrings html
sasi2312 Jun 18, 2024
67df7df
Merge pull request #18 from Code4GovTech/sasi_dev_v2
sasi2312 Jun 18, 2024
5a2fab0
condition removed in find week datas
sasi2312 Jun 18, 2024
948b60b
Merge pull request #20 from Code4GovTech/sasi_dev_v2
sasi2312 Jun 18, 2024
21c2c06
issue api performance fix
sasi2312 Jun 21, 2024
bf36dae
Merge pull request #21 from Code4GovTech/sasi_dev_v2
sasi2312 Jun 21, 2024
790a6ad
issue by owner api fix
sasi2312 Jun 21, 2024
3b686d4
Merge pull request #22 from Code4GovTech/sasi_dev_v2
sasi2312 Jun 21, 2024
7a0b845
api change - get detail by repo owner
sasi2312 Jun 24, 2024
facbeaa
Merge pull request #23 from Code4GovTech/sasi_dev_v2
sasi2312 Jun 24, 2024
33e204c
org details fix
sasi2312 Jun 25, 2024
6687de8
weekly goals from mentors
sasi2312 Jun 25, 2024
2350586
id issues fix
sasi2312 Jun 25, 2024
6f597e4
Merge pull request #24 from Code4GovTech/sasi_dev_v2fix
karntrehan Jun 25, 2024
35d950a
org name issue fix
sasi2312 Jun 25, 2024
ae79633
week goals metor check removed
sasi2312 Jun 27, 2024
1383a49
Merge pull request #25 from Code4GovTech/sasi_dev_v2fix
sasi2312 Jun 27, 2024
2457de4
pr filter removed
sasi2312 Jun 27, 2024
e1253d6
Merge pull request #26 from Code4GovTech/sasi_dev_v2fix
sasi2312 Jun 27, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
146 changes: 146 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Build

env:
APP_NAME: CMS-BACKEND-API
PROJECT_NAME: CMS-BACKEND-API
DOCKER_COMPOSE_PATH: /root/app/docker-compose.yml
REGISTRY: ghcr.io
DOCKER_REGISTRY: ghcr.io/code4govtech/dmp-cms-backend-api
DOT_ENV_FILE_NAME: env.dmp-cms-backend-api


on:
workflow_dispatch:
push:
branches:
- devops
- dev
- main

permissions:
contents: write
packages: write


jobs:
set_vars:
name: Set Environment Variables
runs-on: ubuntu-latest
outputs:
TAG_LATEST: ${{ steps.tag_values.outputs.TAG_LATEST }}
TAG_ENV_COMMIT: ${{ steps.tag_values.outputs.TAG_ENV_COMMIT }}
APP_ENV: ${{ steps.tag_values.outputs.APP_ENV }}
steps:
- name: Set Docker Image Tags
id: tag_values
run: |
case "${{ github.ref }}" in
'refs/heads/main')
echo "TAG_LATEST=prod-latest" >> $GITHUB_OUTPUT
echo "TAG_ENV_COMMIT=prod-${GITHUB_SHA:0:5}" >> $GITHUB_OUTPUT
echo "APP_ENV=PROD" >> $GITHUB_OUTPUT
;;
'refs/heads/devops')
echo "TAG_LATEST=dev-latest" >> $GITHUB_OUTPUT
echo "TAG_ENV_COMMIT=dev-${GITHUB_SHA:0:5}" >> $GITHUB_OUTPUT
echo "APP_ENV=DEV" >> $GITHUB_OUTPUT
;;
'refs/heads/dev')
echo "TAG_LATEST=dev-latest" >> $GITHUB_OUTPUT
echo "TAG_ENV_COMMIT=dev-${GITHUB_SHA:0:5}" >> $GITHUB_OUTPUT
echo "APP_ENV=DEV" >> $GITHUB_OUTPUT
;;
esac

build:
name: Build
runs-on: ubuntu-latest
needs: [set_vars]
permissions:
contents: read
packages: write
env:
TAG_LATEST: ${{ needs.set_vars.outputs.TAG_LATEST }}
TAG_ENV_COMMIT: ${{ needs.set_vars.outputs.TAG_ENV_COMMIT }}
SUPABASE_URL: ${{ vars[format('APP_{0}_SUPABASE_URL', needs.set_vars.outputs.APP_ENV)] }}
SUPABASE_KEY: ${{ secrets[format('APP_{0}_SUPABASE_KEY', needs.set_vars.outputs.APP_ENV)] }}
SECRET_KEY: ${{ secrets[format('APP_{0}_SECRET_KEY', needs.set_vars.outputs.APP_ENV)] }}
steps:
- name: Checkout code
uses: actions/checkout@v2

# - name: Login to GitHub Packages
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set Docker Tags
uses: actions/setup-node@v2

- name: Read Secrets
run: |
echo "SUPABASE_URL=${SUPABASE_URL}" >> .env
echo "SUPABASE_KEY=${SUPABASE_KEY}" >> .env
echo "SECRET_KEY=${SECRET_KEY}" >> .env
mv .env ${{ env.DOT_ENV_FILE_NAME }}

- name: Copy env file to DEV Server
uses: appleboy/[email protected]
if: needs.set_vars.outputs.APP_ENV == 'DEV'
with:
host: ${{ vars.DEV_SERVER_HOST }}
username: ${{ vars.DEV_SERVER_USERNAME }}
key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}
port: ${{ vars.DEV_SERVER_PORT }}
source: "${{ env.DOT_ENV_FILE_NAME }}"
target: /root/app/

- name: Build ${{ env.APP_NAME }} Docker image
run: |
docker build -t ${{ env.DOCKER_REGISTRY }}:${{ env.TAG_LATEST }} .

- name: Add tag to Docker image
run: |
echo ${{ github.sha }}
docker tag ${{ env.DOCKER_REGISTRY }}:${{ env.TAG_LATEST }} ${{ env.DOCKER_REGISTRY }}:${{ env.TAG_ENV_COMMIT }}

- name: Push Docker image to GitHub Packages
run: |
docker push ${{ env.DOCKER_REGISTRY }}:${{ env.TAG_LATEST }}
docker push ${{ env.DOCKER_REGISTRY }}:${{ env.TAG_ENV_COMMIT }}

deploy:
name: Deployment
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref_type == 'branch'

steps:
- name: Deploy to DevOps/Dev Environment
if: github.ref == 'refs/heads/devops' || github.ref == 'refs/heads/dev'
uses: appleboy/[email protected]
env:
DOCKER_COMPOSE_PATH: ${{ env.DOCKER_COMPOSE_PATH }}
APP_NAME: ${{ env.APP_NAME }}
DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
with:
host: ${{ vars.DEV_SERVER_HOST }}
username: ${{ vars.DEV_SERVER_USERNAME }}
key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}
port: ${{ vars.DEV_SERVER_PORT }}
allenvs: true
script_stop: true
envs: DOCKER_COMPOSE_PATH,APP_NAME,DOCKER_REGISTRY
script: |
echo "Docker Compose Path $DOCKER_COMPOSE_PATH"
docker compose -f $DOCKER_COMPOSE_PATH pull
docker compose -f $DOCKER_COMPOSE_PATH up -d

- name: Deploy to Prod environment
if: github.ref == 'refs/heads/main'
run: echo "Deploying to Kubernetes"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dmp_2/__pycache__/*
.env
env/*

venv
__pycache__/*
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use an official Python runtime as a parent image
FROM python:3.12-slim

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Make port 5000 available to the world outside this container
EXPOSE 5000

# Define environment variable
ENV FLASK_APP=wsgi.py
ENV FLASK_RUN_HOST=0.0.0.0

# Run the application
CMD ["flask", "run"]

Loading
Loading