docker-paheko/README.md
2023-02-18 22:03:59 +01:00

4.7 KiB

docker-garradin

Garradin on Alpine Linux with Docker. With Alpine 3.1.16, PHP 8.1 and Nginx 1.22.0.

Usage

Pre-requisite : Docker Desktop.

Option 1 from Docker Hub : download the image and launch the container in one line

sudo docker run -d -t --name ga -p 80:80 -v vol-ga:/var/www/garradin/data/ hluthwigg/garradin 

Option 2 from the Github repository : build the image and launch the container

# clone the repository
git clone https://github.com/HluthWigg/docker-garradin.git
cd docker-garradin

# build the image
sudo docker build -t garradin .

# launch the container
sudo docker run -d -t --name ga -p 80:80 -v vol-ga:/var/www/garradin/data/ garradin 

Then open http://localhost:80 in your browser.


To stop and remove the container

sudo docker rm -f ga

To shell inside the container :

sudo docker exec -it ga sh

To start off a new database, just remove the volume :

sudo docker volume rm vol-ga

and run again.

Acknowledgements

This is inspired by Aurélien Janvier's and Tim de Pater's works. Thanks to them !

It also relies on resources hosted on Garradin's fossil server :

More explanations

Disclaimer : those comments come from a newbie.

Garradin is a PHP-written website, not a simple software. Therefore, its installation is not that easy. It requires a web server (Nginx or Apache), with a PHP interpreter (PHP-FPM).

Supervisord is used to launch the two required services, Nginx and PHP-FPM, as you can see in config/supervisord.conf. Because the conf file has no "supervisorctl" section (I don't know how to write a working one), it is not possible to use supervisorctl restart nginx inside the container. This would be nice to test new parameters without restarting the whole container. Instead I intensively used this command.

sudo docker rm -f ga ; sudo docker build -t garradin . ; sudo docker run -d -t --name ga -p 80:80 -v vol-ga:/var/www/garradin/data/ garradin 

You can still make sure that both Nginx and PHP-FPM services work with a simple ps. And you can check that your configuration is well taken into account by nginx -T (with a lowercase -t, it checks the configuration file) and by php-fpm81 -tt.

Nginx and PHP-FPM communicate through a socket (/run/garradin.socket) as you can see in config/nginx-garradin.conf and config/fpm-garradin.conf. As I imagine it, when Nginx receive a request over a PHP file, it sends it to PHP for interpretation and PHP hands back a HTML file to Nginx which sends it to the browser.

Beware : in the nginx configuration file garradin.conf, the root has to be the www, inside the garradin folder, not the garradin itself. Otherwise, you would receive a warning "Garradin n'est pas installé sur un sous-domaine dédié."

Version compatibility

If you want to test another garradin version, you first need to check available versions of garradin. Then you can put it as GARRADIN_VERSION in the Dockerfile. If the version you want is only provided with the format .tar.bz2, change tar xzvf garradin-$GARRADIN_VERSION.tar.gz by tar xjvf garradin-$GARRADIN_VERSION.tar.bz2.

Then you have to check which PHP version is required for this Garradin version. You can do that with a case-sensitive "PHP" search on the changelog.

Depending on this, you may want a newer or an older Alpine version, so that the PHP version you're looking for is available. Just change ALPINE_VERSION in the Dockerfile.

Modules Make sure you have installed all necessary modules. For instance, I experienced a crash because the PHP function finfo_open(), provided by the module php81-fileinfo, was not found. Indeed the module was not installed. I added it to the RUN apk add line in the Dockerfile

Plugins

(Thanks @gromain) I have put all available plugins as of July 3rd, 2022 in the docker image. You can install more plugins as explained here. You need to download the .tar.gz in the directory /var/www/garradin/data/plugins and then connect to garradin (localhost:80) > Configuration > Plugins and then tick and install desired plugins. DomPDF requires php-zip.