-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.json
40 lines (40 loc) · 2.51 KB
/
app.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
"name": "docai-service",
"env": {
"GCP_DOCAI_REGION": {
"value": "eu",
"description": "Region (eu or us) where the Document AI form processor is deployed."
},
"GCP_DOCAI_PROCESSOR_ID": {
"description": "The Document AI form processor ID from the deployment (visible in the overview information for the processor)."
},
"API_KEY": {
"generator": "secret",
"description": "A secret that to be used to access the API."
}
},
"options": {
"allow-unauthenticated": true
},
"hooks": {
"postbuild": {
"commands": [
"gcloud config set project $GOOGLE_CLOUD_PROJECT",
"gcloud services enable appengine.googleapis.com",
"gcloud services enable firestore.googleapis.com",
"gcloud services enable aiplatform.googleapis.com",
"gcloud services enable documentai.googleapis.com",
"gcloud services enable drive.googleapis.com",
"if [[ $(gcloud app describe 2>&1 || true) == *'ERROR'* ]]; then echo 'No app engine or firestore instances found, creating...' && gcloud app create --region=europe-west; fi",
"gcloud alpha firestore databases update --type=firestore-native",
"echo 'Now creating service account with correct permissions..'",
"PROJECTNUMBER=$(gcloud projects list --filter=\"$(gcloud config get-value project)\" --format=\"value(PROJECT_NUMBER)\") && gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT --member=\"serviceAccount:[email protected]\" --role='roles/datastore.user'",
"PROJECTNUMBER=$(gcloud projects list --filter=\"$(gcloud config get-value project)\" --format=\"value(PROJECT_NUMBER)\") && gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT --member=\"serviceAccount:[email protected]\" --role='roles/aiplatform.user'",
"PROJECTNUMBER=$(gcloud projects list --filter=\"$(gcloud config get-value project)\" --format=\"value(PROJECT_NUMBER)\") && gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT --member=\"serviceAccount:[email protected]\" --role='roles/documentai.apiUser'",
"PROJECTNUMBER=$(gcloud projects list --filter=\"$(gcloud config get-value project)\" --format=\"value(PROJECT_NUMBER)\") && echo \"Add user [email protected] to your AppSheet Google Drive folder with Read permissions.\"",
"echo 'Now importing some test data..'",
"./2_loaddata.sh"
]
}
}
}