-
Notifications
You must be signed in to change notification settings - Fork 31
IAC Setup #71
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
Merged
IAC Setup #71
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ace62c7
Update settings and requirements to support Google Cloud Storage
mjumbewu 6e6a94d
feat: migrate infrastructure to GCP
mjumbewu 565fdbd
docs: Enhance Cloud Run deployment instructions, simplify Docker Comp…
mjumbewu bf44912
refactor: Adopt environment-specific image tagging for Cloud Run depl…
mjumbewu ad97fc7
chore: Remove explicit Docker Compose version and use API service com…
mjumbewu 2fcf68a
feat: Add Makefile to streamline GCP deployment and containerized tes…
mjumbewu 9f5ff52
chore: Migrate continuous integration from Travis CI to GitHub Actions.
mjumbewu 45de464
fix: Add `test-env` target to create a `.env` file from template and …
mjumbewu 6229926
ci: Upgrade GitHub Actions runner to Ubuntu 24.04 to support Podman 4…
mjumbewu 97e8070
Apply some of the chore/clean-up from code review
mjumbewu 0571b27
refactor: Externalize `ALLOWED_HOSTS`, `SECRET_KEY`, and `REDIS_KEY_P…
mjumbewu 4d839dc
refactor: support multiple custom domains and refactor the `ALLOWED_H…
mjumbewu d621ffb
feat: Introduce a new `gcp-domains` module for centralized Cloud Run …
mjumbewu d93afc1
refactor: Migrate SSL certificate management from Google Compute Engi…
mjumbewu 2915729
feat: Introduce `tfvars` secrets in GCP Secret Manager for both domai…
mjumbewu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master, main ] | ||
| pull_request: | ||
| branches: [ master, main ] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-24.04 # Use 24.04 for Podman 4.x (matches local dev environment) | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install Podman Compose | ||
| run: | | ||
| pip install podman-compose | ||
|
|
||
| - name: Build Images | ||
| run: make build | ||
|
|
||
| - name: Run Tests | ||
| run: make test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| .PHONY: test-env test test-clean build gcp-push gcp-restart gcp-deploy | ||
|
|
||
| # Build the container image | ||
| build: | ||
| podman build -t shareabouts-api -f Containerfile . | ||
|
|
||
| # Push image to GCP Container Registry | ||
| # Requires: PROJECT_ID, ENVIRONMENT_NAME environment variables | ||
| gcp-push: | ||
| @if [ -z "$(PROJECT_ID)" ]; then echo "Error: PROJECT_ID is not set"; exit 1; fi | ||
| @if [ -z "$(ENVIRONMENT_NAME)" ]; then echo "Error: ENVIRONMENT_NAME is not set"; exit 1; fi | ||
| podman tag shareabouts-api gcr.io/$(PROJECT_ID)/shareabouts-api:latest-$(ENVIRONMENT_NAME) | ||
| podman push gcr.io/$(PROJECT_ID)/shareabouts-api:latest-$(ENVIRONMENT_NAME) | ||
|
|
||
| # Restart the Cloud Run service with the latest image | ||
| # Requires: PROJECT_ID, ENVIRONMENT_NAME, SERVICE_NAME, REGION environment variables | ||
| gcp-restart: | ||
| @if [ -z "$(PROJECT_ID)" ]; then echo "Error: PROJECT_ID is not set"; exit 1; fi | ||
| @if [ -z "$(ENVIRONMENT_NAME)" ]; then echo "Error: ENVIRONMENT_NAME is not set"; exit 1; fi | ||
| @if [ -z "$(SERVICE_NAME)" ]; then echo "Error: SERVICE_NAME is not set"; exit 1; fi | ||
| @if [ -z "$(REGION)" ]; then echo "Error: REGION is not set"; exit 1; fi | ||
| gcloud run services update $(SERVICE_NAME)-$(ENVIRONMENT_NAME) \ | ||
| --region $(REGION) \ | ||
| --image gcr.io/$(PROJECT_ID)/shareabouts-api:latest-$(ENVIRONMENT_NAME) | ||
|
|
||
| # Full deployment: build, push, and restart | ||
| gcp-deploy: build gcp-push gcp-restart | ||
|
|
||
| # Stub .env file | ||
| test-env: | ||
| cp .env.template .env | ||
|
|
||
| # Run tests in a clean container environment | ||
| test: test-env test-clean | ||
| podman-compose run --rm test | ||
|
|
||
| # Just clean up containers | ||
| test-clean: | ||
| podman-compose down --remove-orphans 2>/dev/null || true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,6 @@ | |
| secure_scheme_headers = { | ||
| 'X-FORWARDED-PROTO': 'https', | ||
| } | ||
| accesslog = '-' | ||
| errorlog = '-' | ||
| timeout = 120 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Example configuration - update with your actual values | ||
| project_id = "example-shareabouts" | ||
| load_balancer_name = "custom-domains-abcd" | ||
|
|
||
| # Add your domain mappings here | ||
| # Each key is a service name, value contains domains and cloud_run_service details | ||
| domain_mappings = { | ||
| # Example: | ||
| # shareabouts-api-dev = { | ||
| # domains = ["shareaboutsapi-gcp-dev.example.com"] | ||
| # cloud_run_service = { | ||
| # name = "shareabouts-api-dev" | ||
| # region = "us-central1" | ||
| # } | ||
| # } | ||
| } | ||
|
|
||
| # Optional: default backend for unmatched requests | ||
| # default_backend_service = "projects/example-shareabouts/global/backendServices/default-backend" | ||
|
|
||
| # Optional: redirect host for unmatched requests (used when default_backend_service is not set) | ||
| # default_redirect_host = "example.com" | ||
|
|
||
| # Optional: Legacy host rules for existing backend services not managed by this project | ||
| # legacy_host_rules = { | ||
| # my-legacy-service = { | ||
| # hosts = ["legacy.example.com"] | ||
| # path_matcher = "legacy-example-com" | ||
| # backend_service = "https://www.googleapis.com/compute/v1/projects/my-project/global/backendServices/my-backend" | ||
| # } | ||
| # } | ||
|
|
||
| # Optional: Group domains into separate SSL certificates | ||
| # domains not listed here will be grouped into a "default" certificate | ||
| # ssl_certs = { | ||
| # mycity-gov = ["suggest.mycity.gov", "suggest-staging.mycity.gov"] | ||
| # bikeshare-com = ["suggest.bikeshare.com"] | ||
| # } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.