OpenTTD's website in Jekyll
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_data Remove: -docs-source.tar.xz was never in production Jan 25, 2019
_download-meta Fix: mark openttd-useful as deprecated, and tell what to do instead Feb 16, 2019
_includes Fix: replace {{ base }} with {{ site.baseurl }} Jan 5, 2019
_layouts Fix: point latest.html to stable and testing.html to testing for rele… Feb 9, 2019
_people Fix: TrueBrain too has a nickname Dec 1, 2018
_plugins Add: downloads pages, and links from header/index to them Jan 4, 2019
_posts Add: 1.9.0-beta2 release news post Feb 10, 2019
_screenshots Fix: handful of spelling errors (#33) Jan 22, 2019
pages Update: mention that Windows 8, 8.1 and 10 are also supported Jan 30, 2019
static Remove: remove the need for dot.png; it was only used in news Jan 19, 2019
thirdparty
.dockerignore Add: downloads pages, and links from header/index to them Jan 4, 2019
.dorpsgek.yml Add: dorpsgek configuration for IRC notification Dec 31, 2018
.flake8
.gitignore Add: downloads pages, and links from header/index to them Jan 4, 2019
.gitmodules Add: detect based on User-Agent which download the user wants most li… Jan 19, 2019
Dockerfile Add: [#8] add 404/500 pages to serve when page-not-found / internal-s… Jan 5, 2019
Gemfile Update: bump Jekyll and dependencies to latest version Jan 1, 2019
Gemfile.lock
LICENSE Add: README, LICENSE, and travis/test script for CI validation Dec 1, 2018
README.md Update: README.md is now more verbose and even contains a FAQ (#27) Jan 20, 2019
_config.yml Change: split baseurl into baseurl and staticurl Jan 19, 2019
azure-pipelines.yml Add: [AzurePipelines] also build when creating a tag Jan 22, 2019
fetch-downloads.py Fix: point latest.html to stable and testing.html to testing for rele… Feb 9, 2019
nginx.default.conf Fix: point latest.html to stable and testing.html to testing for rele… Feb 9, 2019
requirements.base Add: downloads pages, and links from header/index to them Jan 4, 2019
requirements.txt Add: downloads pages, and links from header/index to them Jan 4, 2019

README.md

OpenTTD's website

Build Status Deployment Status

This is the main website for OpenTTD, as can be seen on https://www.openttd.org/. 'master' is always deployed on staging.

This is a Jekyll website, and is served by nginx as a static site.

Development

Populating _downloads

By default _downloads is empty, so when building the website locally there is no latest stable/nightly. This can be resolved by running fetch-downloads.py. This script will download the latest available binaries, and populate _downloads.

fetch-downloads.py is a Python3.6+ application, and will make ~400 HTTP connections to various of OpenTTD-related servers.

python3 -m venv venv
venv/bin/pip install -r requirements.txt
venv/bin/python fetch-downloads.py

Running a local server

If you do not want to run a server, but just build the current site, replace serve with build in the examples below.

Under _site Jekyll will put the compiled result in both serve and build.

Installing Jekyll locally

Running via Docker

docker run --rm -v "$(pwd)":/srv/jekyll -it -p 127.0.0.1:4000:4000 jekyll/jekyll jekyll serve

Docker image

This repository in the end produces a Docker image which is started in production. The Dockerfile is a multistage Dockerfile to get to this result.

  1. Fetch the downloads.
  2. Create the HTML website via Jekyll.
  3. Prepare nginx with static files.

The result is a very small image (~50 MiB) with only static HTML sites. After merging into master, Azure Pipelines automatically publishes a new image on Docker Hub, and automatically deploys it on staging.

To test locally if the Docker will build, you can use:

docker build --no-cache --pull -t website:test .

FAQ

I want to make a new blog post

Create a new file in _posts. Follow the existing format. Make a Pull Request, have it approved, and merge. It will automatically show up on staging. After tagging, it will move to production.

I am a developer, and want to be on the website

No problem. Add yourself to _people, and follow the same as the above 'new blog post' section.

What is this download-descriptions.yml

On download pages, you notice that every binary has a human readable description. windows-win64.exe is for most people to cryptic. Windows XP / Vista / 7 / 8 / 10 (64bit) (installer) is much more clear. This file takes care of that mapping, based on the postfix of the file.

Why the downloads?

Because this is a static website, but we do want to show in the header what the latest version is, we need to find a solution. We picked a solution where we fetch some files to know what the latest version is, and create a static version out of it. This means that every time the latest version changes, the website has to be recreated. As new versions are rare (once or sometimes twice a day at most), it is very cheaper to do it this way. It avoids any dynamic component in production.

Why all the nginx redirects?

We used to have a very dynamic website, with tons of URLs. Because many people have them bookmarked or made automation around them, we set out to not have any regression during migration. In result, many URLs are being redirected to their new URL, and we should have not a single regression.

Screenshots in a git repository?

Yes. By lack of better, we are doing this.