@@ -56,6 +56,68 @@ entrypoint: fileset serve
56
56
gcloud app deploy app.yaml
57
57
```
58
58
59
+ ### Authentication for deployment
60
+
61
+ Before you are able to deploy your files, you'll need to set up authentication
62
+ to deploy.
63
+
64
+ 1 . Identify the service account to use.
65
+
66
+ Authentication to upload your files is done using a service account. You'll
67
+ generally want to use one of two service accounts:
68
+
69
+ a. When the command is invoked from Google Cloud Build, your project's Cloud
70
+ Build service account (` <ProjectNumber>@cloudbuild.gserviceaccount.com ` ) is
71
+ used.
72
+
73
+ To determine your project's project number:
74
+
75
+ ``` bash
76
+ gcloud projects describe < AppID>
77
+ ```
78
+
79
+ b. When the command is invoked locally (i.e. for testing or for manual uploads),
80
+ you'll likely want to use your App Engine app's default service account
81
+ (` <AppID>@appspot.gserviceaccount.com ` ). You can download a service account key
82
+ by running:
83
+
84
+ ``` bash
85
+ gcloud iam service-accounts keys create \
86
+ key.json \
87
+ --iam-account < AppID> @appspot.gserviceaccount.com
88
+ ```
89
+
90
+ NOTE: This will download a ` key.json ` to your current directory. Avoid
91
+ committing this to your Git repository. You'll want to add ` key.json ` to
92
+ ` .gitignore ` .
93
+
94
+ 2 . Ensure service account has permissions.
95
+
96
+ The following permissions are needed:
97
+
98
+ - Cloud Datastore (manifests are stored here): Cloud Datastore Owner
99
+ (` datastore.owner ` )
100
+ - Cloud Storage (files are uploaded here): Storage Object Admin
101
+ (` storage.objectAdmin ` )
102
+
103
+ If using the App Engine default service account, you will not need to modify the
104
+ permissions, as the service account has the "Project Editor" permission by
105
+ default.
106
+
107
+ If using the Cloud Build service account (or any other service account), you'll
108
+ need to add the above two permissions to the account. That can be done via the
109
+ IAM page (` https://console.cloud.google.com/access/iam?project=<AppId> ` ) or via
110
+ the ` gcloud ` CLI:
111
+
112
+ ```
113
+ for role in datastore.owner storage.objectAdmin g; do \
114
+ gcloud projects add-iam-policy-binding \
115
+ <AppId>
116
+ --member=serviceAccount:<ProjectNumber>@cloudbuild.gserviceaccount.com \
117
+ --role=roles/$role \
118
+ ; done
119
+ ```
120
+
59
121
### Deployment setup
60
122
61
123
1 . Create a ` fileset.yaml ` configuration file.
@@ -66,17 +128,19 @@ schedule:
66
128
default : master # Specify a branch for the prod deployment.
67
129
` ` `
68
130
69
- 2. Generate your files. Use a static site generator or just manually create a
70
- directory containing files to upload. In the below example, the files in the
71
- directory ` build` are uploaded.
131
+ 2. Generate your files.
132
+
133
+ Use a static site generator or just manually create a directory containing files
134
+ to upload. In the below example, the files in the directory ` build` are
135
+ uploaded.
72
136
73
- 3 . Upload your files.
137
+ 4 . Upload your files.
74
138
75
139
` ` ` bash
76
140
fileset upload -s siteId build
77
141
` ` `
78
142
79
- 4 . That's it! Files have been uploaded to Google Cloud Storage and the uploaded
143
+ 5 . That's it! Files have been uploaded to Google Cloud Storage and the uploaded
80
144
directory is now being served by the application server.
81
145
82
146
TODO : Document Identity-Aware Proxy setup and CLI authentication.
@@ -110,4 +174,4 @@ Staging URL: https://default-f3a9abb-dot-fileset-dot-appid.appspot.com
110
174
(staging) $ fileset upload build
111
175
...
112
176
Staging URL: https://default-4fb48ce-dot-fileset-dot-appid.appspot.com
113
- ` ` `
177
+ ` ` `
0 commit comments