This repository contains guides and configuration files of CTFd server, which is able to host on Google Cloud Run. And also including terraform code for swagstore GKE cluster, CTFd Cloud Run and datastores, and Datadog settings.
If you are in Datadog Sandbox AWS account, it has the limitation: AWS Config automatically delete extensive security group rules.
Use Cloud Run as a CTFd container server, Cloud SQL as a database and Cloud Storage FUSE as an image upload folder.
If there are many CTFd users, which are more than 10, Cloud Run are recommended to be scaled out. CTFd server has the login cache locally in a container w/o a Redis server. Redis server is necessary to avoid 403 error due to this.
gcloud auth login --no-launch-browser
git clone https://github.com/dd-japan/ctf-infra.git
cd ctf-infra/cloud-run/
export PROJECT_ID="<project_id>"
export REGION="<region_name>"
export CLOUD_SQL_INSTANCE="<cloud_sql_instance_name>"
export DB_USER="<db_user>"
export DB_PASS="<db_pass>"
export DB_NAME="<db_name>"
exporot GCS_BUCKET="<cloud_storage_bucket_name>"
envsubst <ctfd-single-container.yaml.tamplate> ctfd-single-container.yaml
gcloud run service replace ctfd-single-container.yaml
CTFd documentation has the configuration page.
If you are in Datadog Sandbox GCproject, it has the guardrail: Domain restricted sharing.
As a workaround, add a tag that adapts to the guardrail's exclusion rules: external-access:allowed in the case of Allowing unauthenticated Cloud Run invocations.


