Planning applications tracker for InLinkUK from BT kiosks. https://kiosks.adrianshort.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.4 KiB

6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # [kiosks.adrianshort.org](https://kiosks.adrianshort.org/)
  2. Static site generator for website to track BT InLink kiosks planning applications.
  3. ## How to build this site locally
  4. ### Setup - do this only once
  5. 1. `$ git clone git@github.com:adrianshort/kiosks.git && cd kiosks`
  6. 2. `$ bundle install`
  7. 3. [Sign in to Morph](https://morph.io/users/auth/github) with your GitHub account.
  8. 4. Go to your Settings page: https://morph.io/owners/YOUR-USERNAME/settings and copy your secret API key.
  9. 5. `$ export MORPH_API_KEY=123456abcdef` (use the actual key value given)
  10. Add the `MORPH_API_KEY` to your `.profile` or `.bash_profile` file or similar as required so it's available for every shell session.
  11. ### Build - do this every time
  12. 1. `$ bundle exec bin/download` - gets the latest data from the scraper's API
  13. 2. `$ bundle exec bin/petrify` - builds the static site
  14. The built site is now in the `_site` directory.
  15. 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`.
  16. ## How to build and deploy this site on Netlify
  17. 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.
  18. ### Basic setup
  19. 1. Sign in to Netlify.
  20. 2. Click `New site from Git`
  21. 3. Connect your GitHub account.
  22. 4. Choose the `adrianshort/kiosks` repo to deploy, or your own fork of it.
  23. 5. Use these settings: Branch to deploy: `master`, build command: `bundle exec bin/download && bundle exec bin/petrify`, publish directory: `_site`
  24. 6. Click `Show advanced` and create a `New variable`
  25. 7. Key: `MORPH_API_KEY`, Value: `123456abcdef` (use the actual key value given by Morph)
  26. 8. Click `Deploy`. Netlify will now build and deploy the site.
  27. ### Set up a webhook to trigger automatic builds/deploys when the scraper finishes
  28. 1. Click `Site settings` for your Netlify site.
  29. 2. `Build & deploy` tab > `Continuous Deployment`
  30. 3. Click `Add build hook`.
  31. 4. `Build hook name` can be anything you like, eg `Morph scrape completed`.
  32. 5. `Branch to build` is `master`.
  33. 6. Click `Save`.
  34. 7. Copy the webhook URL, eg: `https://api.netlify.com/build_hooks/123456abcdef`.
  35. 8. On Morph, go to the Settings page for your scraper.
  36. 9. Click `Add webhook`.
  37. 10. Paste the webhook URL and click `Update Settings`.
  38. Netlify will now build and deploy the site using the latest scraper data every time the Morph scrape succeeds.