Jekyll Static Site
A Tugboat Preview for a Jekyll static site builds the static site, and then serves it. This
config generates a static site that looks like your jekyll build on your local development environment, but is
accessible via the secure Tugboat URL by anyone who has the link; no need for the viewer to have a local environment.
Configure Tugboat
The Tugboat configuration is managed by a YAML file at
.tugboat/config.yml in the git repository. Here’s a basic Jekyll static site configuration you can use as a starting
point, with comments to explain what’s going on:
1services:
2 # What to call the service hosting the site. Because there is only
3 # one service, it is automatically set as the default service, which
4 # does a few things
5 # 1. Clones the git repository into the service container
6 # 2. Exposes port 80 to the Tugboat HTTP proxy
7 # 3. Routes requests to the preview URL to this service
8 apache:
9 # Use the available version of Apache by not specifying a version
10 image: tugboatqa/httpd
11
12 # A set of commands to run while building this service
13 commands:
14 # Commands that set up the basic preview infrastructure
15 init:
16 # Check for updates to apt-get, and then use it to install Ruby
17 - apt-get update
18 - apt-get install ruby ruby-dev
19
20 # Install Jekyll
21 - gem install jekyll bundler
22
23 # Clean up apt artifacts to keep the Preview small
24 - apt-get clean
25 - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
26
27 build:
28 # Check for updates to Jekyll
29 - bundle update
30
31 # Use the `jekyll build` command to build your static site
32 - bundle exec jekyll build
33
34 # Link the document root to the expected path. This example links the
35 # /public directory generated by the Jekyll build to the docroot
36 - ln -snf "${TUGBOAT_ROOT}"/_site "${DOCROOT}"Want to know more about something mentioned in the comments of this config file? Check out these topics:
- Name your Service
- Specify a Service image
- Leverage Service commands
- Define a default Service
- Set the document root path
- Preview build process phases (
init,update,build)
Start Building Previews!
Once this Tugboat configuration file is committed to your git repository, you can start building previews!