feat: Implement GCP Cloud Run stg and prod deployment with refactored settings #204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements complete CI/CD pipeline for automated deployment to Google Cloud Run staging and production environment, with refactored Django settings following organizational patterns.
Changes
Settings Refactoring
base.py: Common settings with SQLite default, development-friendlyproduction.py: GCS storage, Cloud SQL, SMTP email,ALLOWED_SEED_COMMAND=Falsestaging.py: Inherits from production, staging-specific overridesdevelopment.py: Simplified, inherits SQLite from baseUpdated dependencies in
requirements.txtand created deployment filesDockerfile.dockerignore.gcloudignoreManagement Command
create_gcp_cors_config.pythat generates CORS configuration for GCS bucket from Django settingsCI/CD Workflow (
.github/workflows/ci-cd.yml)test-python job:
testbed.settings.cideploy job:
--sourceflagDeployment Flow
Configuration for Each Environment
Required GitHub Environment Variables
DJANGO_SETTINGS_MODULE: Settings module pathGCP_PROJECT_ID: Google Cloud project IDCLOUD_RUN_SERVICE_NAME: Cloud Run service nameSERVICE_ACCOUNT_NAME: Deployment service accountDATABASE_NAME: PostgreSQL database nameARTIFACT_REGISTRY: Container image nameRequired GitHub Environment Secrets
GCP_CREDENTIALS: Service account JSON credentialsCLOUD_SQL_ICN: Cloud SQL instance connection namePOSTGRES_CREDENTIALS: Database credentials (username:password)DJANGO_SECRET_KEY: Django secret keyShared Repository Secret
EMAIL_HOST_PASSWORD: SMTP password (Gmail app password)Close #206
Close #207
Close #209
Close #203