@@ -20,7 +20,7 @@ The template requires two environment variables:
2020- ` BETTER_STACK_SOURCE_TOKEN ` : Your Better Stack source token
2121- ` BETTER_STACK_INGESTING_HOST ` : The Better Stack ingest host URL
2222
23- ## Building the Template
23+ ## Building and Deploying the Template
2424
25251 . Clone this repository:
2626``` bash
@@ -37,27 +37,40 @@ gcloud projects list
3737gcloud config set project PROJECT_ID
3838```
3939
40- 2 . Build the Docker image:
40+ 3 . Build the Docker image:
4141``` bash
4242docker build -t gcr.io/$( gcloud config get-value project) /pubsub-to-betterstack .
4343```
4444
45- 3 . Push the image to Google Container Registry:
45+ 4 . Push the image to Google Container Registry:
4646``` bash
4747gcloud auth configure-docker
4848docker push gcr.io/$( gcloud config get-value project) /pubsub-to-betterstack
4949```
5050
51- ## Deploying the Template
51+ 5 . Create a Cloud Storage bucket for the template (if you don't have one):
52+ ``` bash
53+ BUCKET_NAME=" dataflow-templates-$( gcloud config get-value project) "
54+ gsutil mb -l us-central1 gs://${BUCKET_NAME}
55+ ```
5256
53- You can deploy the template using the Google Cloud Console or the gcloud CLI:
57+ 6 . Update the template specification with your project ID:
58+ ``` bash
59+ sed -i " s/PROJECT_ID/$( gcloud config get-value project) /g" pubsub-to-betterstack.json
60+ ```
5461
55- ### Using gcloud CLI
62+ 7 . Upload the template specification to Cloud Storage:
63+ ``` bash
64+ gsutil cp pubsub-to-betterstack.json gs://${BUCKET_NAME} /templates/
65+ ```
5666
67+ 8 . Deploy the template using gcloud CLI:
5768``` bash
5869gcloud dataflow flex-template run " pubsub-to-betterstack-$( date +%Y%m%d-%H%M%S) " \
59- --template-file-gcs-location=gs://YOUR_BUCKET/templates/pubsub-to-betterstack.json \
60- --parameters input_subscription=projects/YOUR_PROJECT/subscriptions/YOUR_SUBSCRIPTION \
70+ --template-file-gcs-location=gs://${BUCKET_NAME} /templates/pubsub-to-betterstack.json \
71+ --parameters input_subscription=projects/$( gcloud config get-value project) /subscriptions/YOUR_SUBSCRIPTION \
72+ --parameters better_stack_source_token=YOUR_SOURCE_TOKEN \
73+ --parameters better_stack_ingesting_host=YOUR_INGESTING_HOST \
6174 --region=$( gcloud config get-value compute/region) \
6275 --additional-experiments=use_runner_v2
6376```
@@ -67,13 +80,12 @@ gcloud dataflow flex-template run "pubsub-to-betterstack-$(date +%Y%m%d-%H%M%S)"
67801 . Go to the Dataflow section in the Google Cloud Console
68812 . Click "Create Job from Template"
69823 . Select "Custom Template"
70- 4 . Enter the path to your template in Cloud Storage
83+ 4 . Enter the path to your template in Cloud Storage: ` gs://${BUCKET_NAME}/templates/pubsub-to-betterstack.json `
71845 . Fill in the required parameters:
7285 - ` input_subscription ` : Your PubSub subscription to read from
73- 6 . Set the environment variables:
74- - ` BETTER_STACK_SOURCE_TOKEN `
75- - ` BETTER_STACK_INGESTING_HOST `
76- 7 . Click "Run Job"
86+ - ` better_stack_source_token ` : Your Better Stack source token
87+ - ` better_stack_ingesting_host ` : The Better Stack ingest host URL
88+ 6 . Click "Run Job"
7789
7890## Message Format
7991
0 commit comments