Skip to content

Commit d59b878

Browse files
committed
Add example
1 parent 1d521b6 commit d59b878

File tree

8 files changed

+68
-10
lines changed

8 files changed

+68
-10
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
^build/
12
.npmrc
23
Makefile
3-
build/
44
dist/
55
docs/
66
key.json

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ NOTE: Fileset uses the default App Engine Google Cloud Storage bucket
3939
(`gs://appid.appspot.com`) to upload files.
4040

4141
1. Within your project, create a directory to house the server files, e.g.
42-
`./backend/fileset`. Avoid mixing the server configuration with any tools to
42+
`./backend/server`. Avoid mixing the server configuration with any tools to
4343
build your website. The `package.json`, etc. should be kept separate in order
4444
to keep the deployment slim.
4545

@@ -64,11 +64,17 @@ service: fileset
6464
runtime: nodejs10
6565
```
6666
67-
4. Deploy the app and enable the Cloud Datastore API.
67+
4. Create the app and deploy.
6868
6969
```bash
70-
gcloud app deploy --project=<AppID> app.yaml
71-
gcloud services enable datastore.googleapis.com --project=<AppID>
70+
# Create an App Engine app if one doesn't exist yet.
71+
gcloud app create --project=<AppId>
72+
73+
# Enable the Cloud Datastore API.
74+
gcloud services enable datastore.googleapis.com --project=<AppId>
75+
76+
# Deploy the app.
77+
gcloud app deploy --project=<AppId> app.yaml
7278
```
7379

7480
### Deployment setup
@@ -80,9 +86,16 @@ Google Cloud Platform services before and need information on authentication.
8086
1. Create a `fileset.yaml` configuration file.
8187

8288
```yaml
83-
site: siteId # Specify a site ID. If blank, `default` will be used.
89+
# Your Google Cloud project's ID (required).
90+
google_cloud_project: <AppId>
91+
92+
# Your site ID (optional). If blank, `default` will be used.
93+
site: <SiteId>
94+
95+
# Specify a launch schedule. The schedule maps timestamps to branches or commit
96+
# shas. If blank, `master` is used for the default deployment.
8497
schedule:
85-
default: master # Specify a branch for the prod deployment.
98+
default: master
8699
```
87100
88101
2. Generate your files.
@@ -138,18 +151,18 @@ Build, your project's Cloud Build service account
138151
To determine your project's project number:
139152

140153
```bash
141-
gcloud projects describe <AppID>
154+
gcloud projects describe <AppId>
142155
```
143156

144157
__Application default service account__: When the command is invoked locally
145158
(i.e. for testing or for manual uploads), you'll likely want to use your App
146-
Engine app's default service account (`<AppID>@appspot.gserviceaccount.com`).
159+
Engine app's default service account (`<AppId>@appspot.gserviceaccount.com`).
147160
You can download a service account key by running:
148161

149162
```bash
150163
gcloud iam service-accounts keys create \
151164
key.json \
152-
--iam-account <AppID>@appspot.gserviceaccount.com
165+
--iam-account <AppId>@appspot.gserviceaccount.com
153166
```
154167

155168
NOTE: This will download a `key.json` to your current directory. Avoid

example/build/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>Hello World</title>
4+
<h1>Hello World</h1>
5+
<p>Welcome to my homepage.</p>

example/fileset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
google_cloud_project: <AppId>
2+
site: <SiteId>
3+
schedule:
4+
default: master

example/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"scripts": {
3+
"start": "fileset serve",
4+
"upload": "fileset upload build"
5+
},
6+
"devDependencies": {
7+
"@blinkk/fileset": "^0.1.0"
8+
}
9+
}

example/server/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Fileset server
2+
3+
This directory contains the configuration files for deploying the Fileset
4+
server. It only needs to be deployed once.
5+
6+
## Deployment
7+
8+
```bash
9+
# Create an App Engine app if one doesn't exist yet.
10+
gcloud app create --project=<AppId>
11+
12+
# Enable the Cloud Datastore API.
13+
gcloud services enable datastore.googleapis.com --project=<AppId>
14+
15+
# Deploy the app.
16+
gcloud app deploy --project=<AppId> app.yaml
17+
```

example/server/app.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
service: fileset
2+
runtime: nodejs10

example/server/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"scripts": {
3+
"start": "fileset serve"
4+
},
5+
"dependencies": {
6+
"@blinkk/fileset": "^0.1.0"
7+
}
8+
}

0 commit comments

Comments
 (0)