Skip to content

My personal website and blog, written in Rust, Tera, and Bootstrap.

License

Notifications You must be signed in to change notification settings

dpbriggs/dpbriggs-blog

Repository files navigation

dpbriggs.ca

https://travis-ci.org/dpbriggs/dpbriggs-blog.svg?branch=master

This repository holds my personal website dpbriggs.ca.

Feel free to fork and modify this website. Please note this website is under GPLv3 so be sure to keep the license and attribute.

Built with:

  • Rocket 🚀 (Rust Web Framework)
  • Tera (Fast templating language/engine, similar to Jinja2)
  • Bootstrap (CSS framework)

Running the website locally (development)

Running the website locally is pretty easy, thanks to cargo and rustup.

  1. Be sure you have rustup to install a nightly toolchain.
  2. Install a nightly toolchain rustup toolchain add nightly
  3. Set nightly as your default toolchain rustup default nightly
  4. Clone and enter the project git clone [email protected]:dpbriggs/dpbriggs-blog.git && cd dpbriggs-blog
  5. Run the project cargo run
  6. (optional) rename the project (replace myname with whatever you want):
    • mv dpbriggs-blog myname-blog
    • Edit Cargo.toml and change instances of dpbriggs in there to myname
    • Edit src/context.rs and update the default site context.

Alternatively, use the make file:

make watch # live-reload
make test  # run tests

Deploying the website

As is tradition, we need several ways to build the website. The server which runs my website is running a stable version of Ubuntu, and my arch system has a relatively new version of Glibc. It’s no longer possible for me to run make_package.sh and upload the artifacts.

So I added a quick docker container which will generate the build artifacts.

Using docker

To build the container:

cd docker
docker build . -t blog-maker

This will setup a container with rust running ubuntu 18.04.

To generate a build artifact:

docker run --rm -v ~/programming/dpbriggs-blog:/source blog-maker

This will output something like:

... rust build stuff ...
Created project archive dpbriggs-blog-Aug-15-2021-06-47PM.zip in current directory.
Simply copy to server, unzip, and use:
systemctl --user restart run_site run_caddy

If this succeeds, you’ll have a new artifact that looks like dpbriggs-blog-Aug-15-2021-06-47PM.zip in the repo root.

NOTE: This zip only builds off of the latest committed master. Some files, like .caddy-env will need to be copied onto the server normally.

Attribution