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 thedocker
group.) - A text editor installed such as nano, vim, or VSCode over SSH.
Preparation
- Connect to your server running Docker.
- Create a
docker
folder if you do not have one.mkdir docker
- Create a
grav
folder inside the Docker one you just made.mkdir docker/grav
- Make a
config
folder inside the Grav directory.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.
- Create a new
docker-compose.yml
file in the root of the Grav directory, which in this example isdocker/grav
.nano docker-compose.yml
- 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
- 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.
- For USERNAME, fill it in with your user account’s username.
- Save the file.
- While still in the Grav directory (where the new
docker-compose.yml
file is now saved), start up the Grav container.docker compose up -d
- Wait for the container to download its resources and for the installation to finish.
- 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.
http://localhost:8080
- 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.