|
1 |
| -### Usage |
| 1 | +# Fileset |
2 | 2 |
|
| 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 |
3 | 57 | ```
|
4 |
| -# fileset.yaml |
5 | 58 |
|
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. |
7 | 65 | 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 |
12 | 103 | ```
|
| 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