Grav

Grav CMS and WordPress are two of the most popular content management systems available today. In this blog post, we’ll explore the pros and cons of each platform, as well as compare their features and capabilities.

Grav is a static CMS: a content management system that generates and serves static HTML pages instead of dynamic pages that are generated on the fly. What this means is that no database is required to be configured or maintained also static sites have shorter loading time, as well as less entry points for hackers.

  • Static CMSs are ideal for websites that have a limited amount of content that changes infrequently, such as portfolios, blogs, and brochure sites.
  • Examples of popular static CMSs include: Jekyll, Hugo, Gatsby, and Hexo. These platforms allow developers to create websites that are fast, secure, and easy to maintain, with the added benefit of being able to host the site on a variety of platforms including CDNs, shared hosts, and cloud services.

Why using Grav as your Static CMS?

  • User-Friendly: Grav CMS has a simple and intuitive user interface, making it easy for users to create and manage their content.
  • Performance: Grav CMS is designed to be fast and lightweight, making it a top choice for developers and users who prioritize speed.
  • Flexibility: With a modular architecture and a powerful plugin system, Grav CMS provides ample customization options for users.
  • Security: Grav CMS is built with security in mind, with features such as user authentication and data encryption.

You should also be aware that:

  • Learning Curve: Grav CMS may have a steeper learning curve for users who are new to the platform or not familiar with Markdown.
  • Smaller Community: Compared to WordPress, Grav CMS has a smaller community and fewer resources available for support and troubleshooting.

SSG’s vs CMS’s

Static site generators and flat file content management systems (CMS) have become popular choices for web developers and content creators who seek simplicity, performance, and security.

Although they both eliminate the need for a database and share some similar features, there are crucial differences between them.

SSG’s

Static site generators (SSGs) are tools that take raw content files (usually written in Markdown) and templates, and then generate a static HTML website. The content and templates are combined during the build process, which occurs before the site is published. Once the build is complete, the generated HTML, CSS, and JavaScript files are served to the user.

Some popular SSGs include Jekyll, Hugo, and Gatsby. They offer a variety of features and customizations, including plugins, themes, and support for modern web technologies like React and GraphQL.

  • Pros:

    • Speed: SSGs create static files, resulting in fast load times.
    • Security: As there’s no database or server-side scripting, security risks are minimized.
    • Scalability: Static sites can be easily served through a content delivery network (CDN), making scaling simple.
  • Cons:

    • Limited dynamic functionality: SSGs may not be ideal for sites requiring extensive dynamic content or user interaction.
    • Build time: The build process can be time-consuming for large sites.

Flat File CMS’s

Flat file CMSs are content management systems that store content in text files instead of a traditional database. They offer a user-friendly interface for managing and editing content, as well as templates for designing the site’s appearance. Popular flat file CMSs include Grav, Kirby, and Statamic. They often provide features like user authentication, media management, and form handling.

  • Pros:

    • Simplicity: No database setup or maintenance is required.
    • Flexibility: Flat file CMSs allow for easy customization and extension.
    • Performance: Without a database, sites load quickly and efficiently.
  • Cons:

    • Not ideal for large sites: Flat file CMSs may struggle with performance and complexity as the site grows.
    • Limited dynamic functionality: Like SSGs, flat file CMSs are not suited for sites with extensive dynamic content or user interaction.

Comparing Grav CMS

Grav versus Wordpress

  • User Interface: Grav CMS has a simpler and more streamlined user interface, while WordPress offers more customization options and a more complex interface.
  • Performance: Grav CMS is designed to be fast and lightweight, while WordPress can be slower due to its more complex nature and reliance on plugins.
  • Flexibility: Grav CMS offers a modular architecture and plugin system for customization, while WordPress offers a vast library of themes and plugins.
  • Security: Both platforms offer security features such as user authentication and data encryption, but Grav CMS may have an edge due to its simpler architecture.

Grav versus HUGO

Grav and Hugo are two popular static site generators that have gained popularity in recent years. Grav is a PHP-based CMS that uses Markdown as its primary content format. Hugo, on the other hand, is written in Go and uses a variety of content formats, including Markdown, YAML, and JSON.

While both platforms offer similar functionality, there are some key differences to consider. Grav is more user-friendly, with a simpler interface and easier setup process. It also offers a wider range of plugins and themes, making it more customizable. Hugo, on the other hand, is faster and more efficient, making it a better choice for larger websites with more complex content.

Installing Grav with Docker

The docker image that we are going to use to deploy Grav:

Grav: Locally with Docker Compose

---
version: "2.1"
services:
  grav:
    image: lscr.io/linuxserver/grav:latest
    container_name: grav
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /home/Docker/grav/config:/config
    ports:
      - 87:80
    restart: unless-stopped

After deployment is completed, execute the following:

sudo docker exec grav ls config/www/user/accounts

You will see the account information (password will be hashed), but you can change it as you wish and it will encrypt it by itself.

sudo docker exec -it grav nano config/www/user/accounts/yarness.yaml
sudo docker exec -it grav nano config/www/user/accounts/your_selected_user.yaml

Ghost with NGINX and Docker Compose

If you are interested to exposed the service to the internet, you will want to run uptime kuma behind a NGINX proxy. Follow this steps:

---
version: "2.1"
services:
  grav:
    image: lscr.io/linuxserver/grav:latest
    container_name: grav
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /home/Docker/grav/config:/config
    ports:
      - 87:80
    restart: unless-stopped
    networks:
       - nginx_default 
networks:
    nginx_default:
       external: true          

IMPORTANT: make sure to change the default passwords in the configuration file before deploying and exposing it to the internet.

  • Step 3: Finish the setup in NGINX UI as covered in its guide.

Grav with Cloudflare Tunnel and Docker Compose

First, get familiar with the Cloudflare Docker setup, as covered during the guide to expose your services securely with Cloudflare Zero Trust Tunnel.

Once you have that ready, simply use the tunnel network that connects our matrix-synapse instance to the Cloudflare tunnel during the installation with docker-compose:

---
version: "2.1"
services:
  grav:
    image: lscr.io/linuxserver/grav:latest
    container_name: grav
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /home/Docker/grav/config:/config
    ports:
      - 87:80
    restart: unless-stopped
    networks: ["tunnel"]

networks:
    tunnel:
        external: true            

Remember to go back to the one dash cloudflare UI:

  • Add a Public Hostname in the Cloudflare web UI
    • Select the desired subdomain, domain and path (where applicable)
    • Then, add proxy host for example: grav:87

After this step, your service is already protected with HTTPS and accesible through the internet in the desired subdomain.yourdomain.com

FAQ

How to Deploy Nginx Proxy Manager

If you are interested in deploying a separated NGINX instance with Docker, I already created a guide for that here.

How to Configure Cloudflare Tunnel with Docker

Check this guide if you are interested to know how to safely deploy services through Cloudflare Zero Trust Tunnels.