64 lines
1.8 KiB
Markdown
64 lines
1.8 KiB
Markdown
# Deployment Options for Sereact
|
|
|
|
This directory contains multiple options for deploying the Sereact application:
|
|
|
|
## Terraform Infrastructure (`/terraform`)
|
|
|
|
The Terraform configuration automates the provisioning of all required Google Cloud resources:
|
|
|
|
- Google Cloud Run service
|
|
- Google Container Registry (GCR)
|
|
- Cloud Firestore
|
|
- Cloud Storage buckets
|
|
|
|
See [terraform/README.md](terraform/README.md) for detailed instructions.
|
|
|
|
## Cloud Run Deployment (`/cloud-run`)
|
|
|
|
The `service.yaml` file defines the Cloud Run service configuration which can be deployed using:
|
|
|
|
```bash
|
|
gcloud run services replace deployment/cloud-run/service.yaml --region=us-central1
|
|
```
|
|
|
|
## Deployment Script (`deploy.sh`)
|
|
|
|
For convenience, a deployment script is provided to handle the entire deployment workflow:
|
|
|
|
```bash
|
|
# Provision infrastructure with Terraform
|
|
./deployment/deploy.sh --provision
|
|
|
|
# Build and push Docker image
|
|
./deployment/deploy.sh --build
|
|
|
|
# Deploy to Cloud Run
|
|
./deployment/deploy.sh --deploy
|
|
|
|
# Do everything (provision, build, deploy)
|
|
./deployment/deploy.sh --all
|
|
```
|
|
|
|
## CI/CD Pipelines
|
|
|
|
For CI/CD integration, consider using:
|
|
|
|
1. **GitHub Actions**: Sample workflow included in terraform/README.md
|
|
2. **Cloud Build**: Configure a `cloudbuild.yaml` in your repository
|
|
3. **Jenkins**: Use the `deploy.sh` script in your pipeline
|
|
|
|
## Managing Secrets
|
|
|
|
Sensitive data should be managed using Google Secret Manager:
|
|
|
|
```bash
|
|
# Create a secret
|
|
gcloud secrets create sereact-db-uri --replication-policy="automatic"
|
|
|
|
# Add a secret version
|
|
echo -n "your-mongodb-uri" | gcloud secrets versions add sereact-db-uri --data-file=-
|
|
|
|
# Update Cloud Run service to use the secret
|
|
gcloud run services update sereact \
|
|
--update-secrets=DATABASE_URI=sereact-db-uri:latest
|
|
``` |