Skip to content
The static website behind rm3l.org, running with the JAMStack. Built with Gatsby, and leveraging a headless Ghost CMS running in a Kubernetes cluster.
JavaScript CSS
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.dependabot
cypress
plugins/gatsby-plugin-ghost-manifest
src
static
tools/CI
.editorconfig
.env.template
.eslintignore
.eslintrc.js
.gitignore
.nvmrc
LICENSE
README.md
cypress-recorder-config.json
cypress.json
gatsby-browser.js
gatsby-config.js
gatsby-node.js
netlify.toml
package.json
yarn.lock

README.md

rm3l.org

The static website behind rm3l.org, hosted with Netlify, built with Gatsby, and leveraging a headless Ghost CMS running in a Kubernetes cluster

Netlify Status   Netlify Status   Dependabot Status

demo

🛠 Tech Stack

  • Backend
    • Ghost provides the headless Content Management System (CMS). It runs in my own self-hosted Kubernetes cluster
  • Frontend
  • End-to-end tests with Cypress and start-server-and-test
  • Continuously tested (CI) on CircleCI
  • Continuously deployed (CD) on Netlify, with support for Deploy previews of Pull Requests
  • Dependabot to keep dependencies secure and up-to-date

🛠 Installation & Set Up

  1. Clone the repo

    git clone https://github.com/rm3l/rm3l.org my-jamstack-site && cd my-jamstack-site
  2. Install and use the correct version of Node using NVM

    nvm install
  3. Install the Gatsby CLI

    npm install -g gatsby-cli
  4. Install YARN package manager

Follow the instructions here: https://legacy.yarnpkg.com/en/docs/install

  1. Install the project dependencies

    yarn
  2. Set up environment variables and customize the project

Copy the .env.template as a .env file in the repo and customize it accordingly:

GHOST_API_URL=https://my.healdless.ghost.entrypoint
GHOST_CONTENT_API_KEY=my-ghost-blog-content-key
CYPRESS_PROJECT_ID=my-cypress-project-id
CYPRESS_RECORD_KEY=my-cypress-record-key
  • GHOST_API_URL : the URL to the headless Ghost blog
  • GHOST_CONTENT_API_KEY : the Ghost Content API Key, which allows to pull data from a Ghost CMS
  • CYPRESS_PROJECT_ID : the Cypress project Identifier
  • CYPRESS_RECORD_KEY : the Cypress project record key, to use in a Cypress online dashboard

On build servers (CircleCI and Netlify), those are just defined as project-wide environment variables.

  1. Change the site configuration

Edit the src/utils/siteConfig.js file accordingly.

  1. Start the development server

    gatsby develop

Gatsby develop uses the development config in .ghost.json.

🚀 Building and Running for Production

  1. Generate a full static production build

     # Run a production build, locally
     gatsby build
  2. Preview the site as it will appear once deployed

    # Serve a production build, locally
    gatsby serve

Gatsby build uses the production config in .ghost.json.

🚨 Testing

This repository contains few Cypress end-to-end tests that not only make sure the website renders as expected, but also test accessibility (also known as a11y). To do so, the test commands spin up the Gatsby development server and run all the Cypress test specs against the former. You can run the tests using the following command:

 # Runs the tests right away, with no user interaction
 yarn test

or :

 # Interactive test launcher: opens up a Cypress browser for interactively running the tests
 yarn test:open

Deploying with Netlify

This contains 3 config files specifically for deploying with Netlify. A netlify.toml file for build settings, a /static/_headers file with default security headers set for all routes, and /static/_redirects to set Netlify custom domain redirects.

To deploy to your Netlify account, hit the button below.

Deploy to Netlify

You need however to leverage your own Ghost Content API Keys which allow Gatsby to communicate with your Ghost headless blog. For this, I currently set Netlify ENV variables for production builds instead.

Once deployed, I also set up a Ghost + Netlify Integration to use deploy hooks from Ghost to trigger Netlify rebuilds. That way, any time data changes (e.g., new post published) in the headless Ghost CMS, my website will rebuild on Netlify.

Developed by

License

The MIT License (MIT)

Copyright (c) 2020 Armel Soro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You can’t perform that action at this time.