This is a short description how to set up a simple, effective Configuration to develop web sites with Grav.
Of course, websites can be built directly on the Live Domain by installing Grav on your Web Host following one of the recipes described on the official Guide.
Much better, however, is to develop new Sites in a staging environment, and only deploy already working Versions to the Live Site.
This will be described here.
From my own experience, the best approach for this is using Docker which can be installed on Windows (10 only!) and, of course, on Linux .
In the past 2..3 years, I have done this using a local Docker Installation on my Workplace Desktop Win 10 PC, and, although this proved to be usable, it was not all that stable, and, most of all: SLOW.
This is due to docker using the Win10 WSL Linux Layer, and, mostly, the fact that Access to the Windows File System from inside the docker container is slow.
Of course, one could also work without this, but then there is the need to access the files inside the container via SSH or something else, at least: not directly.
As a conclusion, I hardly recommend using a dedicated Linux box as docker host, this has proved to be the best Solution for me.
So, here are the short steps how to accomplish that using Debian 10 (Buster):
- Install Debian, be sure to include the openssh Server
- Install Docker following this Guide
- be sure to also install docker-compose (see obove)
- get the latest official docker build environment from Github
- build the image from Dockerfile as described there:
docker build -t grav:latest .
- save the text listed at the end of the README to a file named docker-compose.yml in the same Directory where your Dockerfile is
Now you are ready to fire up your grav container with
docker-compose up -d
That's it .
You can now access the Grav Backend by just navigating your Browser to http://localhost:8080/admin and then configure your Backend user as desired. From the Backend, you can install and activate Plugins and Themes from the Grav Repository as desired, you can then find all the files in your local Folder 'grav', as configured in docker-compose.yml.
So, you are now free to adapt anything to your needs using your favourite IDE / Text Editor (I'm using VS Code currently, which is also available for Linux).
This approach will work with any Desktop Environment on any Computer in your LAN, just make sure to make the File System on your Docker Host accessible from there - for Windows Clients, you can use the standard Network connections, provided you have installed and configured Samba Server . On Linux Clients, you may also use Samba, or NFS, or anything else suited for remote File access.
Addtional Note on Development cycles:
- as mentioned above, a good advice is to always develop on your local test Site and then deploy working Versions to your Live Domain.
- this can be done via simple ftp, or, more sophisticted, via synchronization Services / Tools like:
if you have git available on your Live Domain, this might be the most elegant Method, there is even a Grav Plugin available especially for that.
Another smart Solution has just been announced from the Grav Team: use of the built-in Webserver, see this Blogpost.