Skip to content

Commit 56160da

Browse files
authored
docs for GCP quickstart (#2275)
1 parent e507bc0 commit 56160da

File tree

4 files changed

+132
-57
lines changed

4 files changed

+132
-57
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: " GCP Quickstart"
3+
---
4+
5+
6+
7+
8+
9+
10+
11+
## Prerequisites
12+
13+
Before starting, ensure you have the following:
14+
15+
### 1. Google Cloud Setup
16+
- **gcloud CLI installed**: [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install)
17+
- **Authenticated with Google Cloud**: Run `gcloud auth login` to authenticate
18+
- **Project ID configured**: Set your project with `gcloud config set project YOUR_PROJECT_ID`
19+
- **Billing enabled**: Ensure billing is enabled for your GCP project
20+
21+
### 2. Docker
22+
- **Docker daemon running**: Ensure Docker is installed and running on your machine
23+
- **Docker authenticated**: You'll need to authenticate with both Docker Hub and Google Artifact Registry
24+
25+
### 3. AWS Resources
26+
- **S3 bucket created**: Create an S3 bucket for storing Terraform state and artifacts
27+
- **AWS credentials**: Have your AWS Access Key ID and Secret Access Key ready
28+
- **IAM permissions**: Ensure your AWS credentials have permissions to read/write to the S3 bucket
29+
30+
### 4. Auth0 Setup
31+
- **Auth0 application**: Create an Auth0 application and note your domain, client ID, and client secret. You should follow the guide in [Configure SSO](./sso), you won't have the server url until the server is up but you don't need to set that right away.
32+
33+
34+
## Configuration
35+
36+
For GCP, you'll need to set up environment variables and then deploy to Cloud Run.
37+
38+
First, create a `cloud-run.env.yaml` file with your configuration:
39+
40+
```yaml
41+
# S3 Storage Configuration
42+
OPENTACO_S3_BUCKET: "your-s3-bucket-name"
43+
OPENTACO_S3_REGION: "us-east-1"
44+
OPENTACO_S3_PREFIX: "your-prefix"
45+
46+
# Auth0 Authentication Configuration
47+
OPENTACO_AUTH_ISSUER: "https://your-auth0-domain.auth0.com/"
48+
OPENTACO_AUTH_CLIENT_ID: "your_auth0_client_id"
49+
OPENTACO_AUTH_CLIENT_SECRET: "your_auth0_client_secret"
50+
OPENTACO_AUTH_AUTH_URL: "https://your-auth0-domain.auth0.com/authorize"
51+
OPENTACO_AUTH_TOKEN_URL: "https://your-auth0-domain.auth0.com/oauth/token"
52+
53+
# AWS Credentials
54+
AWS_ACCESS_KEY_ID: "your_aws_access_key_id"
55+
AWS_SECRET_ACCESS_KEY: "your_aws_secret_access_key"
56+
AWS_REGION: "us-east-1"
57+
58+
# Additional Statesman Configuration
59+
OPENTACO_PORT: "8080"
60+
OPENTACO_STORAGE: "s3"
61+
OPENTACO_AUTH_DISABLE: "false"
62+
```
63+
64+
Then, use the following script to set up Artifact Registry and deploy to Cloud Run from the same directory as your cloud-run.env.yaml
65+
66+
```bash
67+
#!/bin/bash
68+
set -e
69+
70+
# Set your project ID
71+
PROJECT_ID="YOUR_GCP_REPO"
72+
GCP_REPO_NAME="STATESMAN_ARTEFACT_NAME"
73+
GCP_REGION="us-central1"
74+
75+
echo "Setting up Artifact Registry for Statesman..."
76+
77+
# Enable all required APIs
78+
echo "Enabling required GCP APIs..."
79+
gcloud services enable artifactregistry.googleapis.com
80+
gcloud services enable run.googleapis.com
81+
gcloud services enable cloudbuild.googleapis.com
82+
gcloud services enable containerregistry.googleapis.com
83+
84+
# Check if repository exists, create if it doesn't
85+
if ! gcloud artifacts repositories describe $GCP_REPO_NAME --location=$GCP_REGION >/dev/null 2>&1; then
86+
echo "Creating repository..."
87+
gcloud artifacts repositories create $GCP_REPO_NAME \
88+
--repository-format=docker \
89+
--location=$GCP_REGION \
90+
--description="Repository for OpenTaco Statesman images"
91+
else
92+
echo "Repository already exists $GCP_REPO_NAME, skipping creation..."
93+
fi
94+
95+
# Configure Docker auth
96+
gcloud auth configure-docker $GCP_REGION-docker.pkg.dev
97+
98+
# Pull, tag, and push image
99+
docker pull --platform linux/amd64 ghcr.io/diggerhq/digger/taco-statesman:latest
100+
docker tag ghcr.io/diggerhq/digger/taco-statesman:latest \
101+
$GCP_REGION-docker.pkg.dev/$PROJECT_ID/$GCP_REPO_NAME/taco-statesman:latest
102+
docker push $GCP_REGION-docker.pkg.dev/$PROJECT_ID/$GCP_REPO_NAME/taco-statesman:latest
103+
104+
echo "Deploying to Cloud Run..."
105+
gcloud run deploy statesman \
106+
--image $GCP_REGION-docker.pkg.dev/$PROJECT_ID/$GCP_REPO_NAME/taco-statesman:latest \
107+
--region $GCP_REGION \
108+
--platform managed \
109+
--allow-unauthenticated \
110+
--env-vars-file cloud-run.env.yaml
111+
112+
echo "Artifact Registry and Cloud Run setup complete!"
113+
echo "Your image is now at: $GCP_REGION-docker.pkg.dev/$PROJECT_ID/$GCP_REPO_NAME/taco-statesman:latest"
114+
SERVICE_URL=$(gcloud run services describe statesman --region $GCP_REGION --format="value(status.url)")
115+
echo "Service URL: $SERVICE_URL"
116+
echo "Health check: $SERVICE_URL/readyz"
117+
```
118+
119+
120+
Once this service is up you can configure Auth0 with its cloud run url. Go to your application, and add the GCP url like so: `[GCP URL]/oauth/oidc-callback`.
121+
122+
Mine looks like this: https://statesman-1234567890.us-central1.run.app/oauth/oidc-callback
123+
124+
![Allowed Callbacks](/images/state-management/allowed_callbacks.png)
125+
126+
Then run `taco login`. If you have not setup taco before it will prompt you for a server url. If you have run taco login before, you can do `taco setup` to configure the server url. In either case you would set the cloud run url as the server url.
127+
128+
When the CLI asked me to enter my OpenTaco server url I pasted in: https://statesman-1234567890.us-central1.run.app

docs/ce/state-management/quickstart.mdx

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ for all users and systems requiring access to state.
197197

198198
# Configure Taco CLI
199199

200-
<Steps >
201-
<Step title="Install Cli">
200+
202201
<Tabs>
203202
<Tab title="Linux">
204203
The first thing you'll want to do is visit our releases page [here](https://github.com/diggerhq/digger/releases?q=taco%2Fcli&expanded=true) and check the latest taco/cli release. Right now it is v0.1.7
@@ -325,60 +324,7 @@ for all users and systems requiring access to state.
325324
</Tab>
326325
</Tabs>
327326

328-
</Step>
329-
<Step title="Configure CLI Environment Variables">
330-
For the best experience in your shell you can configure the following environment vars for the CLI:
331327

332-
<Tabs>
333-
<Tab title="Linux">
334-
#### On macOS/Linux:
335-
```bash
336-
export OPENTACO_SERVER=https://my-opentaco.company.com
337-
export OPENTACO_AUTH_ISSUER=https://[[auth0 domain]]/
338-
export OPENTACO_AUTH_CLIENT_ID=[[auth0 client id]]
339-
```
340-
</Tab>
341-
<Tab title="MacOS">
342-
#### On macOS/Linux:
343-
```bash
344-
export OPENTACO_SERVER=https://my-opentaco.company.com
345-
export OPENTACO_AUTH_ISSUER=https://[[auth0 domain]]/
346-
export OPENTACO_AUTH_CLIENT_ID=my-client-id
347-
```
348-
</Tab>
349-
<Tab title="Windows (PowerShell)">
350-
#### On Windows PowerShell:
351-
```powershell
352-
$env:OPENTACO_SERVER="https://my-opentaco.company.com"
353-
$env:OPENTACO_AUTH_ISSUER="https://[[auth0 domain]]/"
354-
$env:OPENTACO_AUTH_CLIENT_ID="my-client-id"
355-
356-
# To make permanent (optional):
357-
[Environment]::SetEnvironmentVariable("OPENTACO_SERVER", "https://my-opentaco.company.com", "User")
358-
[Environment]::SetEnvironmentVariable("OPENTACO_AUTH_ISSUER", "https://[[auth0 domain]]/", "User")
359-
[Environment]::SetEnvironmentVariable("OPENTACO_AUTH_CLIENT_ID", "my-client-id", "User")
360-
```
361-
</Tab>
362-
<Tab title="Windows (Command Prompt)">
363-
#### On Windows Command Prompt:
364-
```cmd
365-
set OPENTACO_SERVER=https://my-opentaco.company.com
366-
set OPENTACO_AUTH_ISSUER="https://[[auth0 domain]]/"
367-
set OPENTACO_AUTH_CLIENT_ID=my-client-id
368-
369-
# To make permanent (optional):
370-
setx OPENTACO_SERVER "https://my-opentaco.company.com"
371-
setx OPENTACO_AUTH_ISSUER "https://[[auth0 domain]]/"
372-
setx OPENTACO_AUTH_CLIENT_ID "my-client-id"
373-
```
374-
</Tab>
375-
</Tabs>
376-
377-
The env variable `OPENTACO_SERVER` is the address of your server which we'll get to setting up later.
378-
379-
</Step>
380-
381-
</Steps>
382328

383329

384330
# Create Your First Unit
@@ -389,7 +335,7 @@ Now that you have OpenTaco running and authentication configured, let's walk thr
389335

390336
<Steps>
391337
<Step title="Authenticate Both Systems">
392-
First, complete both authentication flows:
338+
First, complete both authentication flows. When you do taco login for the first time, it will ask for the server url. By default it is set to `http://localhost:8080`, which won't really work for authentication features. You'll want to host through a proxy at least. More likely, you will have a hosted system on a TLS endpoint. You'll want to place that endpoint here. You can reconfigure at any time by calling `taco setup`.
393339

394340
```bash
395341
# Authenticate taco CLI (for unit management)
84.1 KB
Loading

docs/mint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"ce/state-management/digger-integration",
6060
"ce/state-management/development",
6161
"ce/state-management/analytics",
62-
"ce/state-management/versioning"
62+
"ce/state-management/versioning",
63+
"ce/state-management/gcp-quickstart"
6364
]
6465
},
6566
{

0 commit comments

Comments
 (0)