@@ -20,7 +20,7 @@ The template requires two environment variables:
20
20
- ` BETTER_STACK_SOURCE_TOKEN ` : Your Better Stack source token
21
21
- ` BETTER_STACK_INGESTING_HOST ` : The Better Stack ingest host URL
22
22
23
- ## Building the Template
23
+ ## Building and Deploying the Template
24
24
25
25
1 . Clone this repository:
26
26
``` bash
@@ -37,27 +37,40 @@ gcloud projects list
37
37
gcloud config set project PROJECT_ID
38
38
```
39
39
40
- 2 . Build the Docker image:
40
+ 3 . Build the Docker image:
41
41
``` bash
42
42
docker build -t gcr.io/$( gcloud config get-value project) /pubsub-to-betterstack .
43
43
```
44
44
45
- 3 . Push the image to Google Container Registry:
45
+ 4 . Push the image to Google Container Registry:
46
46
``` bash
47
47
gcloud auth configure-docker
48
48
docker push gcr.io/$( gcloud config get-value project) /pubsub-to-betterstack
49
49
```
50
50
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
+ ```
52
56
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
+ ```
54
61
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
+ ```
56
66
67
+ 8 . Deploy the template using gcloud CLI:
57
68
``` bash
58
69
gcloud 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 \
61
74
--region=$( gcloud config get-value compute/region) \
62
75
--additional-experiments=use_runner_v2
63
76
```
@@ -67,13 +80,12 @@ gcloud dataflow flex-template run "pubsub-to-betterstack-$(date +%Y%m%d-%H%M%S)"
67
80
1 . Go to the Dataflow section in the Google Cloud Console
68
81
2 . Click "Create Job from Template"
69
82
3 . 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 `
71
84
5 . Fill in the required parameters:
72
85
- ` 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"
77
89
78
90
## Message Format
79
91
0 commit comments