I built LFK.im over the course of a day to help people figure out which restaurants were open and what their options for ordering food are in Lawrence, Kansas.
Our workflow involves using a Google Sheet to build a database of local businesses along with their hours and contact information.
We started off using a Python script to access this database and save them as Jekyll-friendly frontmatter/markdown files. See the
_places
folder for how this is structured.After my running this script became a bottleneck, I created an GitHub Action which runs this script every 15-minutes or after ever update to the website.
🏠 Homepage
- GitHub Pages for Hosting
- Jekyll for statically building the pages (you can ignore this if you don't run it locally)
- TailwindCSS for CSS
- GitHub Actions for automating Place updates
- Google Sheets for collaborating and updating the website
- Python 3.7 drives our Automation
- Sheetfu the library we use to get data from Google Sheets into Python
The lfk.im website runs on GitHub Pages using Jekyll.
To run the website locally, you'll want to run:
$ bundle install
$ jekyll serve --watch
Then check the website out at http://localhost:4000/
Create a virtualenv using your method of choice.
$ python -m pip install -r requirements.txt
# to run, but except it to fail on your first run:
$ python sync.py
When you run sync.py
, it will walk you through which ENV variables that you need to setup to sync your Google Sheet locally.
Our GitHub Actions Workflow which pulls from Google Sheets has to be configured. The script.py was designed to help error in hopefully useful ways. You can skip this step completely if you want and just fork the website and update _places
which might be the best way to start.
LFK_GOOGLE_SHEET_APP_ID
(required)LFK_SHEET_NAME
(optional, defaults to "Sheet1")
These are required by Sheetfu to run. To setup, check out the Sheetfu Authentication which walks you through setting up a free Google Cloud project.
Once your project is created, you you can download a secret.json file which we will turn into a bunch of environment variables. See the "If you want to initialize it from ENV vars" section for a better overview.
Please note: Do not commit these values in your public GitHub repo. Instead, we will add these as Secrets in our project's Settings.
SHEETFU_CONFIG_AUTH_PROVIDER_URL
(required)SHEETFU_CONFIG_AUTH_URI
(required)SHEETFU_CONFIG_CLIENT_CERT_URL
(required)SHEETFU_CONFIG_CLIENT_EMAIL
(required)SHEETFU_CONFIG_CLIENT_ID
(required)SHEETFU_CONFIG_PRIVATE_KEY
(required)SHEETFU_CONFIG_PRIVATE_KEY_ID
(required)SHEETFU_CONFIG_PROJECT_ID
(required)SHEETFU_CONFIG_TOKEN_URI
(required)SHEETFU_CONFIG_TYPE
(required)
Do not skip this step Don't forget to give your Google Cloud project permission to access your Google Sheet by inviting email address in your SHEETFU_CONFIG_CLIENT_EMAIL
or client_email
from the secrets file to have Read or Write access.
GitHub Pages are easy to work with at the cost of having options over how content is served like compression or HTML, CSS, and JS optimization. I tried to keep the HTML readable vs. using Jekyll/Liquid tricks to compress them.
The workaround is to use a CDN in front of GitHub and to turn these options on. CloudFlare (no affiliation) is my free goto for us tasks and here are the rough steps I used to turn it on:
- Login to your Cloudflare account (or register an account)
- Pick your domain (assumes you have already set it up)
- Slick the Speed app
- Click the Optimization tab
- Scroll down to the Auto Minify and check the ✅ next to HTML. (You may want CSS and JS too, but we already host our CSS via a CDN.)
👤 Jeff Triplett
- Website: https://jefftriplett.com
- Twitter: @webology
- Github: @jefftriplett
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator