Deploy DreamFactory with commercial features to Google Cloud Run.
One-click deploy: Click the button above to open Google Cloud Shell with a guided deployment walkthrough. You'll need a GCP project with billing enabled and a DreamFactory license key.
./deploy.sh
│
▼
┌──────────────────────────────┐
│ Google Cloud Run │
│ ┌─────────┐ ┌──────────┐ │
│ │ Nginx │─▶│ PHP-FPM │ │
│ │ :8080 │ │ (socket) │ │
│ └─────────┘ └──────────┘ │
└──────────┬───────────────────┘
│ Cloud SQL Auth Proxy (sidecar)
┌────────▼──────────┐
│ Cloud SQL │
│ MySQL 8.0 │
└────────────────────┘
Two GCP resources: Cloud Run + Cloud SQL. Secrets in Secret Manager.
- Google Cloud account with billing enabled
gcloudCLI installed and authenticated (gcloud auth login)- DreamFactory license key (from your DreamFactory sales rep)
- Commercial composer files (
composer.json+composer.lock) — provided separately by DreamFactory via SFTP
- Add your commercial composer files (provided via SFTP) to this directory:
composer.json composer.lock - Run the deploy script:
./deploy.sh
The script will interactively prompt for:
- GCP project ID
- Region (default:
us-central1) - DreamFactory license key
- Admin email and password
That's it. The script provisions everything and gives you a URL.
Note: Without composer files, the script will build the open-source edition of DreamFactory. Commercial features (SAML, AD/LDAP, Oracle, etc.) require the commercial composer files.
| Flag | Description | Default |
|---|---|---|
--build |
Build image from source | Use pre-built image |
--github-token=XXX |
GitHub token (required with --build) |
— |
--project=XXX |
GCP project ID | Interactive prompt |
--region=XXX |
GCP region | us-central1 |
--service-name=XXX |
Cloud Run service name | dreamfactory |
--db-tier=XXX |
Cloud SQL machine tier | db-g1-small |
--yes |
Skip confirmation prompts | — |
Removes all resources created by deploy.sh. Confirms before each deletion.
./teardown.sh
./teardown.sh --project=my-proj --region=us-central1
./teardown.sh --yes # Skip confirmationsSet via Cloud Run environment variables or --set-env-vars in deploy:
| Variable | Description | Default |
|---|---|---|
DB_CONNECTION |
Database driver | mysql |
DB_HOST |
Database host | 127.0.0.1 (proxy) |
DB_PORT |
Database port | 3306 |
DB_DATABASE |
Database name | dreamfactory |
DB_USERNAME |
Database user | dreamfactory |
CACHE_DRIVER |
Cache backend | database |
SESSION_DRIVER |
Session backend | database |
APP_DEBUG |
Debug mode | false |
APP_LOG_LEVEL |
Log level | warning |
LOG_CHANNEL |
Log output | stderr |
ADMIN_EMAIL |
First admin user email | — |
ADMIN_PASSWORD |
First admin user password | — |
DF_LICENSE_KEY |
Commercial license key | — |
| Secret | Description |
|---|---|
dreamfactory-app-key |
Laravel APP_KEY (auto-generated) |
dreamfactory-db-password |
Cloud SQL password (auto-generated) |
dreamfactory-license-key |
DreamFactory license key |
Adjust Cloud Run settings after deployment:
# Increase resources
gcloud run services update dreamfactory \
--region=us-central1 \
--memory=2Gi \
--cpu=2
# Scale instances
gcloud run services update dreamfactory \
--region=us-central1 \
--min-instances=2 \
--max-instances=20
# Use a larger DB
gcloud sql instances patch dreamfactory-db \
--tier=db-n1-standard-2# Map your domain
gcloud run domain-mappings create \
--service=dreamfactory \
--domain=api.yourdomain.com \
--region=us-central1
# Follow the DNS instructions printed by the command aboveIf you prefer to provision resources manually:
-
Create Cloud SQL instance:
gcloud sql instances create dreamfactory-db \ --database-version=MYSQL_8_0 \ --tier=db-g1-small \ --region=us-central1 gcloud sql databases create dreamfactory --instance=dreamfactory-db gcloud sql users create dreamfactory --instance=dreamfactory-db --password=YOUR_PASSWORD
-
Create secrets:
echo -n "base64:$(openssl rand -base64 32)" | gcloud secrets create dreamfactory-app-key --data-file=- echo -n "YOUR_DB_PASSWORD" | gcloud secrets create dreamfactory-db-password --data-file=- echo -n "YOUR_LICENSE_KEY" | gcloud secrets create dreamfactory-license-key --data-file=-
-
Deploy Cloud Run:
gcloud run deploy dreamfactory \ --image=us-docker.pkg.dev/dreamfactory-public/dreamfactory/dreamfactory-cloud-run:latest \ --region=us-central1 \ --add-cloudsql-instances=PROJECT:REGION:dreamfactory-db \ --set-secrets="APP_KEY=dreamfactory-app-key:latest,DB_PASSWORD=dreamfactory-db-password:latest,DF_LICENSE_KEY=dreamfactory-license-key:latest" \ --set-env-vars="DB_CONNECTION=mysql,DB_HOST=127.0.0.1,DB_DATABASE=dreamfactory,DB_USERNAME=dreamfactory,CACHE_DRIVER=database,SESSION_DRIVER=database,ADMIN_EMAIL=admin@example.com,ADMIN_PASSWORD=YOUR_PASSWORD" \ --min-instances=1 --max-instances=10 \ --memory=1Gi --cpu=1 --timeout=300 \ --allow-unauthenticated --port=8080
Check logs:
gcloud run services logs read dreamfactory --region=us-central1 --limit=50Verify the Cloud SQL Auth Proxy sidecar is configured:
gcloud run services describe dreamfactory --region=us-central1 \
--format="value(spec.template.metadata.annotations['run.googleapis.com/cloudsql-instances'])"Connect to the database directly to debug:
gcloud sql connect dreamfactory-db --user=dreamfactory --database=dreamfactoryIncrease minimum instances:
gcloud run services update dreamfactory --region=us-central1 --min-instances=2Increase memory allocation:
gcloud run services update dreamfactory --region=us-central1 --memory=2Gi