Skip to content

Commit 1e85524

Browse files
committed
WIP: Re-work README to make it clearer how to run the app
App dependency install, build script and startup scripts seemed oddly dispersed throughout the README, making it difficult to talk about shared logic such as the ENV variables. I've consolidated these into their own "Run the app locally" section. Other things to note: - I added `--verbose` to the build script, as the build initially failed for me and I had to re-run the script with verbose mode to see any meaningful output. The output isn't much more verbose than without the flag, so there seems no downside. - I removed the section on `.env` file, as it seems to be an implementation detail, and also incompatible with running via govuk-docker. But I'd like to revisit this. - I'm currently able to compile the website fine, and fetch the remote docs, but am struggling to get the app to _run_ locally (in govuk-docker). - I'd very much like to remove the "docker-compose.yml" hack workaround.
1 parent 32b4840 commit 1e85524

File tree

1 file changed

+20
-32
lines changed

1 file changed

+20
-32
lines changed

README.md

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,39 @@ This is a static site generated with Middleman, using [alphagov/tech-docs-templa
77
Some of the files (like the CSS, javascripts and layouts) are managed in the template and are not supposed to be modified here. Any project-specific
88
Ruby code needs to go into `/app`.
99

10-
## Build the app locally
10+
## Run the app locally
11+
12+
Install the dependencies:
1113

1214
```sh
1315
bundle install
1416
```
1517

16-
## Run the tests locally
18+
You can then start up the site with `./startup.sh` (or `govuk-docker-up` if using [govuk-docker](https://github.com/alphagov/govuk-docker)). The startup script can optionally be configured with the following ENV variables:
1719

18-
```
19-
bundle exec rake
20-
```
20+
- `GOVUK_TOKEN=<your private token>` - token to use to make authenticated requests to GitHub's API. Authenticated requests have a much higher rate limit. *You will need to specify a `GITHUB_TOKEN` if you want to build the entire Developer Docs site*. You can [create a GitHub token](https://github.com/settings/tokens/new) (the token doesn't need any scopes).
21+
- `SKIP_PROXY_PAGES=true` - avoid fetching remote 'docs/' for each repo (i.e. just build the docs that live within govuk-developer-docs itself). You can use this if you don't have a `GITHUB_TOKEN` or if you don't care about including the remote docs.
2122

22-
## Run the app locally
23+
If using govuk-docker, you may struggle to pass ENV variables to the script. You can work around this by [editing the docker-compose.yml](https://github.com/alphagov/govuk-docker/blob/ed98d3547708286f534598c78fb5c57ee3c8d112/projects/govuk-developer-docs/docker-compose.yml#L12) to add the following to the `govuk-developer-docs-lite` entry:
2324

24-
```sh
25-
SKIP_PROXY_PAGES=true ./startup.sh
25+
```yml
26+
environment:
27+
LANG: "C.UTF-8"
28+
GITHUB_TOKEN: "<fill it in>"
29+
NO_CONTRACTS: true
2630
```
2731
28-
## Proxy pages
29-
30-
The live docs site includes pages from other alphagov GitHub repositories. To test this locally, omit `SKIP_PROXY_PAGES=true` from the command above.
31-
32-
The app downloads these "proxy pages" at startup and this can cause GitHub to rate limit your requests. You can pass a valid GitHub API token to the app to help avoid this:
33-
34-
1. [Create a GitHub token](https://github.com/settings/tokens/new). The token doesn't need any scopes.
35-
36-
1. Store the token in a `.env` file:
32+
If you just want to create the site (a `build/` directory containing a set of HTML files), but not actyally start up the application, you can do so as follows (noting that the ENV variables described above apply here too):
3733

38-
```sh
39-
GITHUB_TOKEN=somethingsomething
40-
```
34+
```sh
35+
NO_CONTRACTS=true bundle exec middleman build --verbose
36+
```
4137

42-
1. Start the application:
38+
## Run the tests locally
4339

44-
```sh
45-
./startup.sh
46-
```
40+
```
41+
bundle exec rake
42+
```
4743
4844
## Update to the latest Tech Docs template
4945
@@ -58,14 +54,6 @@ We host GOV.UK Developer Docs as a static site on GitHub Pages. The [ci.yml] Git
5854
- when a PR is merged to the default branch
5955
- on an hourly schedule, to pick up changes to docs included from other repos
6056

61-
### Build the static site locally
62-
63-
```sh
64-
NO_CONTRACTS=true bundle exec middleman build
65-
```
66-
67-
This will create a `build` directory containing a set of HTML files.
68-
6957
## Licence
7058

7159
[MIT License](LICENCE)

0 commit comments

Comments
 (0)