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

Refactor dockerization & deployment #950

Merged
merged 7 commits into from
Oct 26, 2023
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
19 changes: 9 additions & 10 deletions .env.example.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ ENVIRONMENT=development
API_PORT=8030
SECRET_KEY=test

RUN_MIGRATION=yes
RUN_COMPILEMESSAGES=yes
RUN_LOAD_DUMMY_DATA=no
RUN_COLLECT_STATIC=no
RUN_DEV_SERVER=yes
RUN_MIGRATION=True
RUN_COMPILE_MESSAGES=True
RUN_COLLECT_STATIC=False
RUN_LOAD_INITIAL_DATA=False
RUN_CREATE_SUPER_USER=True

# django
DEBUG=True
Expand All @@ -25,16 +25,15 @@ NO_REPLY_EMAIL=
DEFAULT_FROM_EMAIL=

# admin
SUPER_ADMIN_EMAIL=a@a.co
SUPER_ADMIN_PASS=a
SUPER_ADMIN_FIRST_NAME=abc
SUPER_ADMIN_LAST_NAME=dee
DJANGO_ADMIN_EMAIL=a@example.co
DJANGO_ADMIN_PASSWORD=a

# database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=secret
POSTGRES_DB=seismic_site
DATABASE_URL=postgres://postgres:secret@db/postgres
POSTGRES_HOST=db
POSTGRES_PORT=

# client
REACT_APP_DJANGO_SITE_URL=http://localhost
Expand Down
51 changes: 25 additions & 26 deletions .env.example.prod
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
# api deployment
ENVIRONMENT=production
API_PORT=8030
SECRET_KEY=
SECRET_KEY=test

RUN_MIGRATION=yes
RUN_COMPILEMESSAGES=yes
RUN_LOAD_DUMMY_DATA=no
RUN_COLLECT_STATIC=yes
RUN_DEV_SERVER=no
RUN_MIGRATION=True
RUN_COMPILE_MESSAGES=True
RUN_COLLECT_STATIC=True
RUN_LOAD_INITIAL_DATA=False
RUN_CREATE_SUPER_USER=True

# django
DEBUG=False
ENABLE_DEBUG_TOOLBAR=False

ALLOWED_HOSTS=localhost
CSRF_TRUSTED_ORIGINS=http://localhost
CORS_ALLOWED_ORIGINS=http://localhost
CORS_ALLOWED_ORIGIN_REGEXES=http://localhost*

SITE_URL=
EMAIL_HOST=
EMAIL_PORT=
EMAIL_PORT=25
EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD=
EMAIL_USE_TLS=
EMAIL_USE_SSL=
EMAIL_USE_TLS=False
EMAIL_USE_SSL=False

NO_REPLY_EMAIL=
DEFAULT_FROM_EMAIL=

ALLOWED_HOSTS=localhost
CSRF_TRUSTED_ORIGINS=http://localhost
CORS_ALLOWED_ORIGINS=http://localhost
CORS_ALLOWED_ORIGIN_REGEXES=http://localhost*

# admin
SUPER_ADMIN_EMAIL=
SUPER_ADMIN_PASS=
SUPER_ADMIN_FIRST_NAME=
SUPER_ADMIN_LAST_NAME=
DJANGO_ADMIN_EMAIL=a@example.co
DJANGO_ADMIN_PASSWORD=a

# database
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
DATABASE_URL=postgres://user:password@netloc/database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=secret
POSTGRES_DB=seismic_site
POSTGRES_HOST=db
POSTGRES_PORT=

GUNICORN_PORT=5000
GUNICORN_WORKERS=10
BACKGROUND_WORKERS=2
GUNICORN_WORKERS=2

# client
REACT_APP_DJANGO_SITE_URL=
REACT_APP_DJANGO_PORT=
REACT_APP_DJANGO_SITE_URL=http://localhost
REACT_APP_DJANGO_PORT=8030
REACT_APP_DJANGO_API_ENDPOINT=api/v1

# external api keys
Expand Down
8 changes: 0 additions & 8 deletions .github/CODEOWNERS

This file was deleted.

16 changes: 0 additions & 16 deletions .github/dependabot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/api_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- 'api/**.py'
- 'api/requirements*.*'
- 'api/Dockerfile'
- 'docker/dockerfiles/Dockerfile.backend*'
- 'docker-compose.yml'
- '.github/workflows/api_pipeline.yml'

Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
push:
branches:
- 'main'
tags:
- 'v*'

name: Build Docker image

jobs:

build-backend-amd64:
name: backend/amd64
uses: code4romania/.github/.github/workflows/build-push-image.yml@main
with:
images: ghcr.io/code4romania/seismic-risc-backend
context: ./
dockerfile: ./docker/dockerfiles/Dockerfile.backend
registry: ghcr.io
secrets:
username: ${{ github.actor }}
token: ${{ secrets.GITHUB_TOKEN }}

# disable frontend build for now since we're using Vercel
# build-frontend-amd64:
# name: frontend/amd64
# uses: code4romania/.github/.github/workflows/build-push-image.yml@main
# with:
# images: ghcr.io/code4romania/seismic-risc-frontend
# context: ./client
# dockerfile: ./docker/dockerfiles/Dockerfile.frontend
# registry: ghcr.io
# secrets:
# username: ${{ github.actor }}
# token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/client_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- 'client/**.js'
- 'client/package*.json'
- 'client/Dockerfile'
- 'docker/dockerfiles/Dockerfile.frontend*'
- 'docker-compose.yml'
- '.github/workflows/client_pipeline.yml'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- 'client/**.js'
- 'client/package*.json'
- 'client/Dockerfile'
- 'docker/dockerfiles/Dockerfile.frontend*'
- 'docker-compose.yml'
- '.github/workflows/client_pipeline.yml'
- '.github/workflows/code-analysis-js.yml'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- 'api/**.py'
- 'api/requirements*.*'
- 'api/Dockerfile'
- 'docker/dockerfiles/Dockerfile.backend*'
- 'docker-compose.yml'
- '.github/workflows/api_pipeline.yml'
- '.github/workflows/code-analysis-py.yml'
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/deploy_staging.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/local_deployment_pipeline.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ api/public/*

# dotenv environment variables file
.env
.env.dev
.env.test
.env.prod
.env.*
Expand Down
Loading