2
2
source .env
3
3
set -e
4
4
5
+ # Install and authorize the gcloud CLI: https://cloud.google.com/sdk/docs/install
6
+
5
7
# SET ENV VARIABLES
6
- # note: load the service account key for either bigtable or firestore before running their respective CFs
7
- # e.g., EXPORT GOOGLE_APPLICATION_CREDENTIALS=<path-to-credentials>
8
- # export env variables: BIGTABLE_INSTANCE_ID, BIGTABLE_TABLE_ID, CLOUD_FUNCTIONS_NUM_ROWS, BIGTABLE_SIGNED_VAAS_TABLE_ID, BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID
8
+ # export env variables required below
9
9
# or source .env
10
10
# make sure you npm run build in the root folder before trying to deploy :D
11
11
@@ -29,16 +29,75 @@ if [ -z "$BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID" ]; then
29
29
exit 1
30
30
fi
31
31
32
- # note CLOUD_FUNCTIONS_NUM_ROWS isn't required and defaults to 100 if not provided
32
+ if [ -z " $CLOUD_FUNCTIONS_NUM_ROWS " ]; then
33
+ echo " CLOUD_FUNCTIONS_NUM_ROWS must be specified"
34
+ exit 1
35
+ fi
36
+
37
+ if [ -z " $CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL " ]; then
38
+ echo " CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL be specified"
39
+ exit 1
40
+ fi
41
+
42
+ if [ -z " $CLOUD_FUNCTIONS_BLOCK_INCREMENT " ]; then
43
+ echo " CLOUD_FUNCTIONS_BLOCK_INCREMENT must be specified"
44
+ exit 1
45
+ fi
46
+
47
+ if [ -z " $PG_USER " ]; then
48
+ echo " PG_USER must be specified"
49
+ exit 1
50
+ fi
51
+
52
+ if [ -z " $PG_PASSWORD " ]; then
53
+ echo " PG_PASSWORD must be specified"
54
+ exit 1
55
+ fi
56
+
57
+ if [ -z " $PG_DATABASE " ]; then
58
+ echo " PG_DATABASE must be specified"
59
+ exit 1
60
+ fi
33
61
34
- # for initial deployment
35
- # echo "gcloud functions deploy messages --entry-point getMessages --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 1GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID,CLOUD_FUNCTIONS_NUM_ROWS=$CLOUD_FUNCTIONS_NUM_ROWS,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL,CLOUD_FUNCTIONS_BLOCK_INCREMENT=$CLOUD_FUNCTIONS_BLOCK_INCREMENT"
62
+ if [ -z " $PG_HOST " ]; then
63
+ echo " PG_HOST must be specified"
64
+ exit 1
65
+ fi
66
+
67
+ if [ -z " $PG_TOKEN_TRANSFER_TABLE " ]; then
68
+ echo " PG_TOKEN_TRANSFER_TABLE must be specified"
69
+ exit 1
70
+ fi
71
+
72
+ if [ -z " $PG_ATTEST_MESSAGE_TABLE " ]; then
73
+ echo " PG_ATTEST_MESSAGE_TABLE must be specified"
74
+ exit 1
75
+ fi
76
+
77
+ if [ -z " $PG_TOKEN_METADATA_TABLE " ]; then
78
+ echo " PG_TOKEN_METADATA_TABLE must be specified"
79
+ exit 1
80
+ fi
81
+
82
+ if [ -z " $PUBSUB_SIGNED_VAA_TOPIC " ]; then
83
+ echo " PUBSUB_SIGNED_VAA_TOPIC must be specified"
84
+ exit 1
85
+ fi
86
+
87
+ if [ -z " $FIRESTORE_LATEST_COLLECTION " ]; then
88
+ echo " FIRESTORE_LATEST_COLLECTION must be specified"
89
+ exit 1
90
+ fi
36
91
37
- gcloud functions deploy messages --entry-point getMessages --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 1GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID ,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,CLOUD_FUNCTIONS_NUM_ROWS=$CLOUD_FUNCTIONS_NUM_ROWS ,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL ,CLOUD_FUNCTIONS_BLOCK_INCREMENT=$CLOUD_FUNCTIONS_BLOCK_INCREMENT
38
- gcloud functions deploy message-counts --entry-point getMessageCounts --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3
39
- gcloud functions deploy compute-message-counts --entry-point computeMessageCounts --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 4GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID ,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL
40
- gcloud functions deploy latest-blocks --entry-point getLatestBlocks --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL ,FIRESTORE_LATEST_COLLECTION=$FIRESTORE_LATEST_COLLECTION
41
- gcloud functions deploy compute-missing-vaas --entry-point computeMissingVaas --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 2GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID ,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL
42
- gcloud functions deploy missing-vaas --entry-point getMissingVaas --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3
43
- gcloud functions deploy vaas-by-tx-hash --entry-point getVaasByTxHash --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,BIGTABLE_SIGNED_VAAS_TABLE_ID=$BIGTABLE_SIGNED_VAAS_TABLE_ID ,BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID=$BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID
92
+ # Hack to make these packages available in the GCP build until they're published
93
+ npm pack --silent --workspace @wormhole-foundation/wormhole-monitor-common --pack-destination ./dist/src
94
+ npm pack --silent --workspace @wormhole-foundation/wormhole-monitor-database --pack-destination ./dist/src
44
95
96
+ gcloud functions deploy messages --entry-point getMessages --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 1GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID ,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,CLOUD_FUNCTIONS_NUM_ROWS=$CLOUD_FUNCTIONS_NUM_ROWS ,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL ,CLOUD_FUNCTIONS_BLOCK_INCREMENT=$CLOUD_FUNCTIONS_BLOCK_INCREMENT
97
+ gcloud functions deploy message-counts --entry-point getMessageCounts --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3
98
+ gcloud functions deploy compute-message-counts --entry-point computeMessageCounts --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 4GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID ,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL
99
+ gcloud functions deploy latest-blocks --entry-point getLatestBlocks --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL ,FIRESTORE_LATEST_COLLECTION=$FIRESTORE_LATEST_COLLECTION
100
+ gcloud functions deploy compute-missing-vaas --entry-point computeMissingVaas --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 2GB --region europe-west3 --set-env-vars BIGTABLE_TABLE_ID=$BIGTABLE_TABLE_ID ,BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL=$CLOUD_FUNCTIONS_REFRESH_TIME_INTERVAL
101
+ gcloud functions deploy missing-vaas --entry-point getMissingVaas --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3
102
+ gcloud functions deploy vaas-by-tx-hash --entry-point getVaasByTxHash --runtime nodejs16 --trigger-http --allow-unauthenticated --timeout 300 --memory 256MB --region europe-west3 --set-env-vars BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,BIGTABLE_SIGNED_VAAS_TABLE_ID=$BIGTABLE_SIGNED_VAAS_TABLE_ID ,BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID=$BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID
103
+ gcloud functions deploy process-vaa --entry-point processVaa --runtime nodejs16 --timeout 300 --memory 256MB --region europe-west3 --trigger-topic $PUBSUB_SIGNED_VAA_TOPIC --set-env-vars BIGTABLE_INSTANCE_ID=$BIGTABLE_INSTANCE_ID ,BIGTABLE_SIGNED_VAAS_TABLE_ID=$BIGTABLE_SIGNED_VAAS_TABLE_ID ,BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID=$BIGTABLE_VAAS_BY_TX_HASH_TABLE_ID ,PG_USER=$PG_USER ,PG_PASSWORD=$PG_PASSWORD ,PG_DATABASE=$PG_DATABASE ,PG_HOST=$PG_HOST ,PG_TOKEN_TRANSFER_TABLE=$PG_TOKEN_TRANSFER_TABLE ,PG_ATTEST_MESSAGE_TABLE=$PG_ATTEST_MESSAGE_TABLE ,PG_TOKEN_METADATA_TABLE=$PG_TOKEN_METADATA_TABLE
0 commit comments