Skip to content

Commit 03c2424

Browse files
authored
Include gzipped version of assets in console tarball (#1031)
* gzip .js, .map, and .css files inside the tarball * update nexus instructions with out/console-assets and prereqs script * run workflow on PR (will manually delete tarball) * don't run on PRs but keep the bit where we got rid of main.tar.gz
1 parent dd7cd95 commit 03c2424

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

.github/workflows/upload-assets.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ jobs:
2626
- run: yarn install
2727
- name: Build for Nexus
2828
run: SHA=${{ github.sha }} yarn build-for-nexus
29+
- name: Gzip individual files (keep originals)
30+
run: ls dist/assets/*.{js,css,map} | xargs gzip --keep
2931
- run: mkdir -p releases/console
3032
- name: Make <sha>.tar.gz
3133
run: tar czf releases/console/${{ github.sha }}.tar.gz --directory=dist .
3234
- name: Write sha256sum to file
3335
run: sha256sum releases/console/${{ github.sha }}.tar.gz | awk '{print $1}' > releases/console/${{ github.sha }}.sha256.txt
34-
- name: Copy files to main.*
35-
run: |
36-
cp releases/console/${{ github.sha }}.tar.gz releases/console/main.tar.gz
37-
cp releases/console/${{ github.sha }}.sha256.txt releases/console/main.sha256.txt
3836
- name: Upload files to GCP bucket
3937
id: upload-files
4038
uses: google-github-actions/upload-cloud-storage@v0.9.0

docs/serve-from-nexus.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
# Serving the Console from Nexus
22

3-
## Wait! You probably don't need to build anything
3+
## Wait! You probably don't need to do anything
44

5-
Assets from commits on `main` are available at `dl.oxide.computer/releases/console/<sha>.tar.gz`. The latest `main` is probably what you want and can always be found at https://dl.oxide.computer/releases/console/main.tar.gz in addition to the path with the SHA.
5+
Assets from commits on `main` are available at `dl.oxide.computer/releases/console/<sha>.tar.gz`. A console version is pinned in Omicron in the file `tools/console_version`, and the prereqs script `./tools/install_prerequisites.sh` will download the tarball and extract it in the right place.
66

7-
If you want to use a version of the console that's already merged into `main`, just download the tarball and extract the files into the directory configured as `console.static_dir` in the Nexus config (the default in the example config `nexus/static`).
7+
If you want to use a different commit than the one that's pinned, just change the commmit hash and SHA256 in that file (get the SHA256 at `https://dl.oxide.computer/releases/console/<commit>.sha256.txt`) and re-run the script.
88

99
Following the rest of the instructions is only necessary if you want to build the assets yourself, for example if you're making a change to the console and want to test it locally against Nexus.
1010

11-
### Choosing a Console version to download
12-
13-
Most of the time you will want the latest commit on `main`. Look at [`OMICRON_VERSION`](/OMICRON_VERSION) to see what Omicron SHA that version of the console expects. Often it will work with a newer version of the API, but don't be surprised if it doesn't.
14-
1511
## Dependencies
1612

1713
- Node.js (tested on 14+, 16+ recommended)
@@ -44,7 +40,7 @@ The only difference between this build and the one for local dev is that the lat
4440

4541
The build output lands in the `dist` directory. Now all you need to do is make `console.static_dir` in the Nexus config point to a directory containing these files.
4642

47-
If you're using the example Nexus config, `static_dir` is set there to `nexus/static` (treated as relative to CWD), so that's a reasonable default location for the files. Another option is to point Nexus directly at `dist` so you don't even have to copy them. Nexus accepts both absolute and relative paths.
43+
If you're using the example Nexus config, `static_dir` is set there to `out/console-assets` (treated as relative to CWD), so that's a reasonable default location for the files. Another option is to point Nexus directly at `dist` so you don't even have to copy them. Nexus accepts both absolute and relative paths.
4844

4945
Whatever the directory is, the files need to be at top level, just like they are in `dist`:
5046

@@ -67,13 +63,13 @@ If I have `console` and `omicron` sitting next to each other in the same directo
6763

6864
```toml
6965
[console]
70-
static_dir = "nexus/static"
66+
static_dir = "out/console-assets"
7167
```
7268

7369
I would run `yarn build-for-nexus` in `console` and then use the following command to copy the files over:
7470

7571
```bash
76-
cp -R dist/ ../omicron/nexus/static
72+
cp -R dist/ ../omicron/out/console-assets
7773
```
7874

7975
The `/` after `dist` is there on purpose — if the target directory already exists, if I leave off the `/` it will copy `dist` into the target with its contents inside rather than the copying only the contents.

0 commit comments

Comments
 (0)