Skip to content

Earthly-Staging/website

 
 

Repository files navigation

Earthly Website & Blog

How To Build in Earthly and Run in Docker

Run Blog in Docker

Build docker image for blog:

> earthly ./blog+run

Then browse to http://0.0.0.0:4002/blog/

Run Website in Docker

You can run the website locally, and use it to preview changes as you go.

> earthly ./website+run

Then browse to http://0.0.0.0:4001/

Alternative Run

By default the Earth files use a prebuilt image. To skip this and build the image yourself use --CACHE_IMAGE="NO"

> earthly ./blog+run --CACHE_IMAGE="NO"

Or

> earthly ./website+run --CACHE_IMAGE="NO"

To update the base image, makes changes in the earthfile and then run this workflow.

Linting

The blog has several linting steps. They run in CI, but you can also run them locally using earthly +blog-lint.

These linting errors can also be seen directly in VS Code if you install them natively (See Install Dependencies below ) and install vs-code extension markdownlint and vale.

Also the helper function lint exists which will correct some of the lint problems itself and return any it can't correct (see helper functions below).

Updating Videos page content

The Videos page is built with static data from files in the _data folder. Just before the website is built in CI, a step runs to update the content of the applicable file in the _data folder – webinar-videos.json – with videos from Earthly's YouTube channel. You can run this process manually using earthly +./website+update-videos. It requires that you have a .secret file in this repo's root directory that specifies a YOUTUBE_API_KEY that has API access to Earthly's YouTube account.

Run Blog Native on MacOS

Volume mounts on a mac can be slow, until such time as watch mode exists it can be worth it to run Jekyll natively.

Install Dependencies

For blogging locally:

 brew update
 brew install gawk
 brew install ruby
 brew upgrade ruby-build
 brew install rbenv
 rbenv install 2.7.8
 rbenv global 2.7.8
 brew install vips
 brew install pandoc
 brew install dateutils 

Then, in /blog/ run bundle install.

For linting locally (and in vs code):

 brew install moreutils
 brew install vale
 brew install sponge
 brew install gawk
 brew install gnu-sed
 brew install rg

 npm install -g [email protected]

gnu-sed works different than the version of sed that comes with mac by default, so you need to add the line below to your .bashrc or .zshrc to get your system to use it.

# For Intel Mac
 export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

# For M1 Mac
export PATH=/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH

Image compression

If you want to resize images for the blog, and recompress them using functions in functions on a mac install these:

Warning: these take a while and install a lot of dependencies

brew install pngquant
brew install jpegoptim
brew install imagemagick
``

## Helper Bash Functions

There are helper functions in `util/functions`. Once sourced, `list` lists them.

```bash
> source ./util/functions
functions assume they are run from repo root
run "list" for a list of helpers
> list
function             description
----------------     -----------------------------------------------------------------
clear-images()       Clear images for latest post
link-opp()           List places you could link to other posts
lint()               Run Linter
list-images
new-post()           Eg. new-post multi-word-slug
set-author-image()   Eg. set-author-image first-last.jpg
set-header()         Set latest-image as header using $IMAGE_DOWNLOADS
set-image()          Save latest-image using $IMAGE_DOWNLOADS
imgur(){             Download images from imgur from post and update post
start-blog(){        Start up blog on localhost:4002/blog
start-website(){     Start up website on localhost:4001
-----------------------------------------------------------------------------------------

Build Site (Blog and Website)

Build this site into a folder of static files:

earthly +build

Results will be output to build and future dated posts will not be included. To include future dated posts use:

earthly +dev-build

How To Deploy

Anything merged into main is deployed using earthly +build in GitHub actions.

FAQS

Question: A page is not updating - what did I do wrong? Answer: Clear the cache with earthly +clean

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 41.5%
  • JavaScript 23.9%
  • SCSS 22.1%
  • Python 6.7%
  • CSS 2.7%
  • Ruby 1.3%
  • Other 1.8%