Skip to content

Grav

Grav is an open-source flat file content management system (CMS), also known as the backend of a website. It serves as the administration section of my website, running in a Docker container.

I chose Grav for a couple of reasons:

  • It’s open-source.
  • The flat file nature makes it extremely lightweight and fast, allowing me to run my entire main website on low-powered hardware, thus saving me money.

The admin panel is very simple and easy to use, it supports plugins, and I can even back up everything to my Nextcloud server on a daily basis in case things go wrong.

Themes on Grav aren’t as robust as something like WordPress, but I am okay with that. I like that my website is simple, though the lack of a dark mode concerns me. Maybe I just haven’t discovered it yet.

I have had Grav running my website for over a year with no complaints. It’s a healthy and lean alternative to WordPress and Drupal, and certainly worth your consideration.


Prerequisites and preparation

Here is everything you’ll need to get started with your own Grav website.

Prerequisites

  • A server, preferably running Debian, Ubuntu, or Alpine Linux.
  • Docker and Docker Compose installed. (To avoid having to run all of your Docker commands with sudo, be sure to add your user to the docker group.)
  • A text editor installed such as nano, vim, or VSCode over SSH.

Preparation

  1. Connect to your server running Docker.
  2. Create a docker folder if you do not have one.
    1. mkdir docker
  3. Create a grav folder inside the Docker one you just made.
    1. mkdir docker/grav
  4. Make a config folder inside the Grav directory.
    1. mkdir docker/grav/config

You don’t need any additional preparation for this project.


Installing the Grav container

Installation

We’ll be using Docker Compose for this installation, so in your terminal, head over to the Grav directory you just created. I’ll be using nano below, so if you’re using a different text editor, substitute in your commands appropriately.

  1. Create a new docker-compose.yml file in the root of the Grav directory, which in this example is docker/grav.
    1. nano docker-compose.yml
  2. Copy the following code and fill in it appropriately.
---
version: "2.1"
services:
grav:
image: lscr.io/linuxserver/grav:latest
container_name: grav
environment:
- PUID=1000
- PGID=1000
- TZ=YOUR_TIMEZONE_HERE
volumes:
- /home/USERNAME/docker/grav/config:/config
ports:
- 8080:80
restart: unless-stopped
  1. For YOUR_TIMEZONE_HERE, fill in your timezone with the appropriate tz code for where you live. You can find the codes listed on Wikipedia.
  2. For USERNAME, fill it in with your user account’s username.
  3. Save the file.
  4. While still in the Grav directory (where the new docker-compose.yml file is now saved), start up the Grav container.
    1. docker compose up -d
  5. Wait for the container to download its resources and for the installation to finish.
  6. In your web browser, navigate to the new URL using the container’s port number. You’ll need to know your server’s IP address for this step.
    1. http://localhost:8080
  7. The Grav admin panel should open and ask you to create an admin account. Follow the steps to do so and to start setting up your website.