Skip to content

Commit 2178e14

Browse files
committed
Add README, add Typedoc, add AVA
1 parent f3a9abb commit 2178e14

File tree

8 files changed

+1634
-791
lines changed

8 files changed

+1634
-791
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "./node_modules/gts/",
33
"env": {
44
"browser": true,
5-
"mocha": true,
65
"node": true
76
},
87
"rules": {

.github/workflows/build-docs.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Deploy docs to GitHub pages'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Cache node modules
14+
uses: actions/cache@v2
15+
env:
16+
cache-name: cache-node-modules
17+
with:
18+
path: |
19+
~/.npm
20+
**/node_modules
21+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
22+
restore-keys: |
23+
${{ runner.os }}-build-${{ env.cache-name }}-
24+
${{ runner.os }}-build-
25+
${{ runner.os }}-
26+
- name: Build docs
27+
run: |
28+
npm install --dev
29+
npm run docs
30+
- name: Deploy
31+
uses: peaceiris/actions-gh-pages@v3
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./docs

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
.npmrc
12
build/
23
dist/
3-
example/db/
4+
docs/
5+
Makefile
46
node_modules/
5-
.npmrc

README.md

Lines changed: 108 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,113 @@
1-
### Usage
1+
# Fileset
22

3+
Fileset is a light, high-performance TypeScript static web server intended for
4+
high-traffic sites. Features include preview branches backed by Google Account
5+
authentication, redirects, localization-aware serving, atomic deployments, and
6+
timed deployments.
7+
8+
Instructions for deployment onto Google App Engine (backed by Cloud Datastore
9+
and Cloud Storage) are provided.
10+
11+
## Concept
12+
13+
Many websites can be built and deployed as fully static packages (i.e. just
14+
HTML, CSS, and JavaScript – with no dynamic backend). In these instances,
15+
websites may still have other requirements such as localization, redirects, or
16+
atomic deployments that end up adding slight dynamic functionality to an
17+
otherwise fully static project.
18+
19+
Fileset aims to bridge the gap by offering a thin middle layer on top of Google
20+
Cloud Storage: static files are uploaded to Google Cloud Storage via the CLI,
21+
with the Fileset server handling request traffic. The server determines whether
22+
to issue a response sprinkled with one of the above dynamic features, and
23+
otherwise proxies traffic directly to Google Cloud Storage – leveraging Google's
24+
global network for performance.
25+
26+
## Usage
27+
28+
There are two main tasks required in order to use Fileset. First, you'll need to
29+
deploy the application server and configure the Identity-Aware Proxy. This only
30+
needs to be done once, when the project is originally set up. Secondly, you'll
31+
need to upload files to be served. Files must be uploaded each time you want to
32+
serve new files to users, or update redirects, etc.
33+
34+
### Server setup
35+
36+
NOTE: Fileset uses the default App Engine Google Cloud Storage bucket
37+
(`gs://appid.appspot.com`) to upload files.
38+
39+
1. Install the Fileset CLI.
40+
41+
```bash
42+
npm install --save-dev @blinkk/fileset
43+
```
44+
45+
2. Create an `app.yaml` for Google App Engine deployment.
46+
47+
```yaml
48+
service: fileset
49+
runtime: nodejs10
50+
entrypoint: fileset serve
51+
```
52+
53+
3. Deploy the app.
54+
55+
```bash
56+
gcloud app deploy app.yaml
357
```
4-
# fileset.yaml
558

6-
site: mysite
59+
### Deployment setup
60+
61+
1. Create a `fileset.yaml` configuration file.
62+
63+
```yaml
64+
site: siteId # Specify a site ID. If blank, `default` will be used.
765
schedule:
8-
default: master
9-
2020-12-21 08:10:05: master
10-
2021-01-12 08:10:05: feature/takedown
11-
2050-02-12 09:10:05: feature/takedown-2
66+
default: master # Specify a branch for the prod deployment.
67+
```
68+
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.
72+
73+
3. Upload your files.
74+
75+
```bash
76+
fileset upload -s siteId build
77+
```
78+
79+
4. That's it! Files have been uploaded to Google Cloud Storage and the uploaded
80+
directory is now being served by the application server.
81+
82+
TODO: Document Identity-Aware Proxy setup and CLI authentication.
83+
84+
## Environments
85+
86+
Fileset uses Git branches to determine whether files should be in production
87+
(and public) or in staging (and restricted via the Identity-Aware Proxy). The
88+
Git branch is determined by inspecting the local Git environment when the
89+
`upload` command is invoked.
90+
91+
The best way to understand how this works is by following the examples below:
92+
93+
```bash
94+
# master branch
95+
# ✓ public
96+
# ✓ production URL
97+
# ✓ also available from staging URL (restricted)
98+
99+
(master) $ fileset upload build
100+
...
101+
Public URL: https://appid.appspot.com
102+
Staging URL: https://default-f3a9abb-dot-fileset-dot-appid.appspot.com
12103
```
104+
105+
```bash
106+
# staging branch
107+
# ✓ not public; restricted by Identity-Aware Proxy
108+
# ✓ staging URL only (restricted)
109+
110+
(staging) $ fileset upload build
111+
...
112+
Staging URL: https://default-4fb48ce-dot-fileset-dot-appid.appspot.com
113+
```

0 commit comments

Comments
 (0)