|
@@ -1,60 +1,13 @@ |
|
|
# [kiosks.adrianshort.org](https://kiosks.adrianshort.org/) |
|
|
# [kiosks.adrianshort.org](https://kiosks.adrianshort.org/) |
|
|
|
|
|
|
|
|
Static site generator for website to track BT InLink kiosks planning applications. |
|
|
|
|
|
|
|
|
Static site generator for website to track BT InLinkUK kiosk planning applications. |
|
|
|
|
|
|
|
|
## Environment variables |
|
|
## Environment variables |
|
|
|
|
|
|
|
|
$ export KIOSKS_SITEURL=https://kiosks.adrianshort.org |
|
|
$ export KIOSKS_SITEURL=https://kiosks.adrianshort.org |
|
|
|
|
|
|
|
|
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/adrianshort/kiosks) |
|
|
|
|
|
|
|
|
|
|
|
## How to build this site locally |
|
|
## How to build this site locally |
|
|
|
|
|
|
|
|
### Setup - do this only once |
|
|
|
|
|
|
|
|
|
|
|
1. `$ git clone git@github.com:adrianshort/kiosks.git && cd kiosks` |
|
|
|
|
|
2. `$ bundle install` |
|
|
|
|
|
3. [Sign in to Morph](https://morph.io/users/auth/github) with your GitHub account. |
|
|
|
|
|
4. Go to your Settings page: https://morph.io/owners/YOUR-USERNAME/settings and copy your secret API key. |
|
|
|
|
|
5. `$ export MORPH_API_KEY=123456abcdef` (use the actual key value given) |
|
|
|
|
|
|
|
|
|
|
|
Add the `MORPH_API_KEY` to your `.profile` or `.bash_profile` file or similar as required so it's available for every shell session. |
|
|
|
|
|
|
|
|
|
|
|
### Build - do this every time |
|
|
|
|
|
|
|
|
|
|
|
1. `$ bundle exec bin/download` - gets the latest data from the scraper's API |
|
|
|
|
|
2. `$ bundle exec bin/build` - builds the static site |
|
|
|
|
|
|
|
|
`$ bundle exec bin/build` - builds the static site |
|
|
|
|
|
|
|
|
The built site is now in the `_site` directory. |
|
|
The built site is now in the `_site` directory. |
|
|
|
|
|
|
|
|
If you've got build/deploy to Netlify set up (see below), use `[skip ci]` in your commit messages to avoid triggering a build every time you `git push`. |
|
|
|
|
|
|
|
|
|
|
|
## How to build and deploy this site on Netlify |
|
|
|
|
|
|
|
|
|
|
|
Use Morph to send a webhook HTTP POST request to [Netlify](https://www.netlify.com/), triggering Netlify to build and deploy the site using the latest version of the data. |
|
|
|
|
|
|
|
|
|
|
|
### Basic setup |
|
|
|
|
|
|
|
|
|
|
|
1. Sign in to Netlify. |
|
|
|
|
|
2. Click `New site from Git` |
|
|
|
|
|
3. Connect your GitHub account. |
|
|
|
|
|
4. Choose the `adrianshort/kiosks` repo to deploy, or your own fork of it. |
|
|
|
|
|
5. Use these settings: Branch to deploy: `master`, build command: `bundle exec bin/download && bundle exec bin/build`, publish directory: `_site` |
|
|
|
|
|
6. Click `Show advanced` and create a `New variable` |
|
|
|
|
|
7. Key: `MORPH_API_KEY`, Value: `123456abcdef` (use the actual key value given by Morph) |
|
|
|
|
|
8. Click `Deploy`. Netlify will now build and deploy the site. |
|
|
|
|
|
|
|
|
|
|
|
### Set up a webhook to trigger automatic builds/deploys when the scraper finishes |
|
|
|
|
|
|
|
|
|
|
|
1. Click `Site settings` for your Netlify site. |
|
|
|
|
|
2. `Build & deploy` tab > `Continuous Deployment` |
|
|
|
|
|
3. Click `Add build hook`. |
|
|
|
|
|
4. `Build hook name` can be anything you like, eg `Morph scrape completed`. |
|
|
|
|
|
5. `Branch to build` is `master`. |
|
|
|
|
|
6. Click `Save`. |
|
|
|
|
|
7. Copy the webhook URL, eg: `https://api.netlify.com/build_hooks/123456abcdef`. |
|
|
|
|
|
8. On Morph, go to the Settings page for your scraper. |
|
|
|
|
|
9. Click `Add webhook`. |
|
|
|
|
|
10. Paste the webhook URL and click `Update Settings`. |
|
|
|
|
|
|
|
|
|
|
|
Netlify will now build and deploy the site using the latest scraper data every time the Morph scrape succeeds. |
|
|
|