dpbriggs-blog
dpbriggs-blog copied to clipboard
My personal website and blog, written in Rust, Tera, and Bootstrap.
#+AUTHOR: David Briggs [email protected]
- dpbriggs.ca [[https://travis-ci.org/dpbriggs/dpbriggs-blog.svg?branch=master][https://travis-ci.org/dpbriggs/dpbriggs-blog.svg?branch=master]]
This repository holds my personal website [[https://dpbriggs.ca][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:
- [[https://rocket.rs/][Rocket]] 🚀 (Rust Web Framework)
- [[https://github.com/Keats/tera][Tera]] (Fast templating language/engine, similar to Jinja2)
- [[https://getbootstrap.com/][Bootstrap]] (CSS framework)
** Running the website locally (development)
Running the website locally is pretty easy, thanks to =cargo= and =rustup=.
- Be sure you have [[https://rustup.rs/][rustup]] to install a nightly toolchain.
- Install a nightly toolchain =rustup toolchain add nightly=
- Set nightly as your default toolchain =rustup default nightly=
- Clone and enter the project =git clone [email protected]:dpbriggs/dpbriggs-blog.git && cd dpbriggs-blog=
- Run the project =cargo run=
- (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:
#+begin_example make watch # live-reload make test # run tests #+end_example
** 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:
#+begin_example cd docker docker build . -t blog-maker #+end_example
This will setup a container with rust running ubuntu 18.04.
To generate a build artifact:
#+begin_example docker run --rm -v ~/programming/dpbriggs-blog:/source blog-maker #+end_example
This will output something like:
#+begin_example ... 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 #+end_example
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
- [[https://github.com/highlightjs/highlight.js/blob/main/LICENSE][highlight.js]]
- [[https://github.com/twbs/bootstrap/blob/v4.2.1/LICENSE][Bootstrap]]
- [[https://github.com/thomaspark/bootswatch/blob/v5/LICENSE][Bootstrap slate]]