diff --git a/.example/config/behavior.inc.php b/.example/config/behavior.inc.php index 3f88107..a571c99 100644 --- a/.example/config/behavior.inc.php +++ b/.example/config/behavior.inc.php @@ -1,20 +1,42 @@ `. You might also need to update the plugin versions: `ARG plugin_< plugin name>_version=`. +If you just want to upgrade to the next version of Galette, all you need to do is change the version number in the Dockerfile: `ARG GALETTE_VERSION=`. You might also need to update the plugin versions: `ARG PLUGIN__VERSION=`. + +You can also provide these arguments as a build-args (see [Building the docker image with another version of PHP and/or Galette](#building-the-docker-image-with-another-version-of-php-andor-galette)). After this, you _should_ of course build and test like described in [Building and testing locally](#building-and-testing-locally). But you can also commit the change, merge it to master and start a new release in GitHub. The github action [build and publish](./.github/workflows/docker-build-and-publish.yml), will build and publish the image, when a new release is published. @@ -40,6 +42,38 @@ Although it's possible to build packages without `dockerd` running, using [`buil * replace `galette-local` with any name you would like to give your local image * `--load` loads the image into your local docker, so you can use it as a container image. +#### Building the docker image with another version of PHP and/or Galette +Follow the instructions above, but add any or both of these build args to the build command: `PHP_VERSION` and/or `GALETTE_VERSION`. For example: + + ``` + docker buildx build --platform linux/amd64 -t galette-local-special \ + --build-arg PHP_VERSION=8.2 \ + --build-arg GALETTE_VERSION=1.0.4 \ + --load . + ``` + +#### Building the docker image with Galette pre-releases +- Follow the instructions above, but override the two build args: `MAIN_PACKAGE_URL` and `GALETTE_RELEASE`. For example: + ``` + docker buildx build --platform linux/amd64 -t galette-local-prerelease \ + --build-arg MAIN_PACKAGE_URL=https://galette.eu/download/dev/ \ + --build-arg GALETTE_RELEASE=galette-1.1.0-rc1-20240508-95bbbc2ede \ + --load . + ``` +- If you want to add nightly official plugin releases, follow the instructions above, but add which release you want for each plugin as builds args, e.g. So for eample: + ``` + docker buildx build --platform linux/amd64 -t galette-local-prerelease \ + --build-arg MAIN_PACKAGE_URL=https://galette.eu/download/dev/ \ + --build-arg GALETTE_RELEASE=galette-1.1.0-rc1-20240508-95bbbc2ede \ + --build-arg PLUGIN_AUTO_VERSION=dev \ + --build-arg PLUGIN_EVENTS_VERSION=dev \ + --build-arg PLUGIN_FULLCARD_VERSION=dev \ + --build-arg PLUGIN_MAPS_VERSION=dev \ + --build-arg PLUGIN_OBJECTSLEND_VERSION=dev \ + --build-arg PLUGIN_PAYPAL_VERSION=dev \ + --load . + ``` + ### Building for multiple architecures locally 1. Start the docker daemon if it's not already started: `sudo dockerd` 2. Create a builder-image `docker buildx create --name mybuilder --use --bootstrap` (see "Building with Buildx" [here](https://www.docker.com/blog/how-to-rapidly-build-multi-architecture-images-with-buildx/) for more details) diff --git a/Dockerfile b/Dockerfile index 9e8ebe9..4c855a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,35 @@ +ARG PHP_VERSION=8.2 + # Using PHP-Apache image -FROM php:8.2-apache +FROM php:${PHP_VERSION}-apache +ARG PHP_VERSION +ARG GALETTE_VERSION=1.1.0 +ARG GALETTE_RELEASE=galette-${GALETTE_VERSION} # Maintained by GrasDK for Galette community LABEL maintainer="GrasDK" # @author Hiob # @author GrasDK -LABEL phpversion="8.2" -ARG galetteversion="1.0.4" ## Plugins versions -ARG plugin_auto_version="2.0.0" -ARG plugin_events_version="2.0.0" -ARG plugin_fullcard_version="2.0.0" -ARG plugin_maps_version="2.0.0" -ARG plugin_objectslend_version="2.0.0" -ARG plugin_paypal_version="2.0.0" +ARG PLUGIN_AUTO_VERSION="2.1.0" +ARG PLUGIN_EVENTS_VERSION="2.1.0" +ARG PLUGIN_FULLCARD_VERSION="2.1.0" +ARG PLUGIN_MAPS_VERSION="2.1.0" +ARG PLUGIN_OBJECTSLEND_VERSION="2.1.0" +ARG PLUGIN_PAYPAL_VERSION="2.1.0" -LABEL version=$galetteversion -LABEL description="PHP $phpversion / Apache 2 / Galette $galetteversion" +LABEL description="PHP $PHP_VERSION / Apache 2 / $GALETTE_RELEASE" LABEL org.opencontainers.image.source=https://github.com/galette-community/docker LABEL org.opencontainers.image.description="Galette is a membership management web application towards non profit organizations." LABEL org.opencontainers.image.licenses=GPL-3.0-or-later -ARG main_package_url="https://galette.eu/download/" -ARG plugin_package_url="https://galette.eu/download/plugins/" -#ARG main_package_url="https://download.tuxfamily.org/galette/" -#ARG plugin_package_url="https://download.tuxfamily.org/galette/plugins/" - +ARG MAIN_PACKAGE_URL="https://galette.eu/download/" +ARG PLUGIN_PACKAGE_URL="https://galette.eu/download/plugins/" +#ARG MAIN_PACKAGE_URL="https://download.tuxfamily.org/galette/" +#ARG PLUGIN_PACKAGE_URL="https://download.tuxfamily.org/galette/plugins/" # Install APT dependencies RUN a2enmod rewrite RUN apt-get -y update \ @@ -58,9 +59,6 @@ RUN sed -i "s/galette.localhost/galette.${HOSTNAME}/" /etc/apache2/sites-availab && a2dissite -- * && a2ensite vhost.conf # ENVIRONMENT VARIABLES -## Galette version -ENV GALETTE_VERSION=$galetteversion - ## Galette ENV ENV GALETTE_CONFIG /var/www/galette/config ENV GALETTE_DATA /var/www/galette/data @@ -82,34 +80,34 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # Installation Galette and plugins ## Galette WORKDIR /usr/src -RUN wget --progress=dot:giga ${main_package_url}galette-${GALETTE_VERSION}.tar.bz2 -RUN tar jxvf galette-${GALETTE_VERSION}.tar.bz2; mv galette-${GALETTE_VERSION}/galette/* ${GALETTE_INSTALL} ; rm galette-${GALETTE_VERSION}.tar.bz2 +RUN wget --progress=dot:giga ${MAIN_PACKAGE_URL}${GALETTE_RELEASE}.tar.bz2 +RUN tar jxvf ${GALETTE_RELEASE}.tar.bz2; mv ${GALETTE_RELEASE}/galette/* ${GALETTE_INSTALL} ; rm ${GALETTE_RELEASE}.tar.bz2 ## Official plugins WORKDIR ${GALETTE_INSTALL}/plugins ### Auto -RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-auto-${plugin_auto_version}.tar.bz2 -RUN tar jxvf galette-plugin-auto-${plugin_auto_version}.tar.bz2; rm galette-plugin-auto-${plugin_auto_version}.tar.bz2; mv galette-plugin-auto-${plugin_auto_version} plugin-auto +RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-auto-${PLUGIN_AUTO_VERSION}.tar.bz2 +RUN tar jxvf galette-plugin-auto-${PLUGIN_AUTO_VERSION}.tar.bz2; rm galette-plugin-auto-${PLUGIN_AUTO_VERSION}.tar.bz2; mv galette-plugin-auto-${PLUGIN_AUTO_VERSION} plugin-auto ### Events -RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-events-${plugin_events_version}.tar.bz2 -RUN tar jxvf galette-plugin-events-${plugin_events_version}.tar.bz2; rm galette-plugin-events-${plugin_events_version}.tar.bz2; mv galette-plugin-events-${plugin_events_version} plugin-events +RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-events-${PLUGIN_EVENTS_VERSION}.tar.bz2 +RUN tar jxvf galette-plugin-events-${PLUGIN_EVENTS_VERSION}.tar.bz2; rm galette-plugin-events-${PLUGIN_EVENTS_VERSION}.tar.bz2; mv galette-plugin-events-${PLUGIN_EVENTS_VERSION} plugin-events ### FullCard -RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-fullcard-${plugin_fullcard_version}.tar.bz2 -RUN tar jxvf galette-plugin-fullcard-${plugin_fullcard_version}.tar.bz2; rm galette-plugin-fullcard-${plugin_fullcard_version}.tar.bz2; mv galette-plugin-fullcard-${plugin_fullcard_version} plugin-fullcard +RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION}.tar.bz2 +RUN tar jxvf galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION}.tar.bz2; rm galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION}.tar.bz2; mv galette-plugin-fullcard-${PLUGIN_FULLCARD_VERSION} plugin-fullcard ### Maps -RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-maps-${plugin_maps_version}.tar.bz2 -RUN tar jxvf galette-plugin-maps-${plugin_maps_version}.tar.bz2; rm galette-plugin-maps-${plugin_maps_version}.tar.bz2; mv galette-plugin-maps-${plugin_maps_version} plugin-maps +RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-maps-${PLUGIN_MAPS_VERSION}.tar.bz2 +RUN tar jxvf galette-plugin-maps-${PLUGIN_MAPS_VERSION}.tar.bz2; rm galette-plugin-maps-${PLUGIN_MAPS_VERSION}.tar.bz2; mv galette-plugin-maps-${PLUGIN_MAPS_VERSION} plugin-maps ### ObjectsLend -RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-objectslend-${plugin_objectslend_version}.tar.bz2 -RUN tar jxvf galette-plugin-objectslend-${plugin_objectslend_version}.tar.bz2; rm galette-plugin-objectslend-${plugin_objectslend_version}.tar.bz2; mv galette-plugin-objectslend-${plugin_objectslend_version} plugin-objectslend +RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION}.tar.bz2 +RUN tar jxvf galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION}.tar.bz2; rm galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION}.tar.bz2; mv galette-plugin-objectslend-${PLUGIN_OBJECTSLEND_VERSION} plugin-objectslend ### Paypal -RUN wget --progress=dot:giga ${plugin_package_url}galette-plugin-paypal-${plugin_paypal_version}.tar.bz2 -RUN tar jxvf galette-plugin-paypal-${plugin_paypal_version}.tar.bz2; rm galette-plugin-paypal-${plugin_paypal_version}.tar.bz2; mv galette-plugin-paypal-${plugin_paypal_version} plugin-paypal +RUN wget --progress=dot:giga ${PLUGIN_PACKAGE_URL}galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION}.tar.bz2 +RUN tar jxvf galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION}.tar.bz2; rm galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION}.tar.bz2; mv galette-plugin-paypal-${PLUGIN_PAYPAL_VERSION} plugin-paypal # CRON Auto-Reminder ## Copy galette-cron file to the cron.d directory diff --git a/README.md b/README.md index f7dfd79..a1b0cce 100644 --- a/README.md +++ b/README.md @@ -21,29 +21,34 @@ If you want to contribute to containerized galette, take a look [here](./CONTRIB This docker image has no included database, so you need to have that separately. Since you probably already are running docker, take a look [here](https://mariadb.com/kb/en/installing-and-using-mariadb-via-docker/#creating-a-container) for a guide on how to run MariaDB in a container. ## How to use this image using docker command line -Galette has a really nice installer, that runs you through database setup and initial admin user creation. The installer creates a configuration files, which you will be interested in keeping on a volume outside the docker image, for reuse when you upgrade to a newer version. + +**Important!**: Following these instructions for Galette versions earlier than 1.1.0 will **not** work, due to differences in volumes. If you are using a Galette version earlier than 1.1.0, please follow [the earlier version of these instructions](https://github.com/galette-community/docker/blob/1.0.4/README.md#how-to-use-this-image-using-docker-command-line). Instructions for version 1.0.4 should work for all ealier versions, but if you run into trouble with those, you can follow [version-specific instructions](https://github.com/galette-community/docker/tags). + +--- + +Galette has a really nice installer, that runs you through database setup and initial admin user creation. The installer creates a configuration file in the `config` folder, which you should keep on a volume outside the docker image, for reuse when you upgrade to a newer version. You also have the option to create files for advanced configuration in the same `config` folder (see step 6). Therefore it is really important that you follow this guide exactly. -If you are upgrading from an earlier version, you can skip the first two steps below. +If you are upgrading from an earlier version, you can skip step 1, 2 and 4 below. -1. Create an empty file `config.inc.php` which you will mount as a volume in the next step. - - It is important that you create this file. You can also take a copy of [this](.example/config/config.inc.php), as the contents do not matter -2. Start a container with the version of galette you want (perhaps :latest) and the proper list of volumes, take note of the `config.inc.php` volume which is a file. +1. Create folders corresponding to all the volumes in the next step. +2. Optional: Create a file `config.inc.php` in the `config` folder. You can also copy [this](.example/config/config.inc.php) and alter it to suit your configuration. You can put in your database details up front, or wait until step 4. +3. Start a container with the version of galette you want (e.g. V1.1.0) and the proper list of volumes. ``` docker run -d -p 8080:80 --name galette - -v /path/to/config.inc.php:/var/www/galette/config/config.inc.php \ + -v /path/to/config:/var/www/galette/config \ -v /path/to/data/attachments:/var/www/galette/data/attachments \ -v /path/to/data/cache:/var/www/galette/data/cache \ -v /path/to/data/files:/var/www/galette/data/files \ -v /path/to/data/logs:/var/www/galette/data/logs \ -v /path/to/data/photos:/var/www/galette/data/photos \ -v ./path/to/data/templates_c:/var/www/galette/data/templates_c \ - galette/galette:latest + galette/galette:1.1.0 ``` Remember to replace `./path/to/` with your own path. -3. Run the installer: Open a browser to http://\:8080/installer.php, e.g. [http://localhost:8080/installer.php](http://localhost:8080/installer.php) and follow the instructions. +4. Run the installer: Open a browser to http://\:8080/installer.php, e.g. [http://localhost:8080/installer.php](http://localhost:8080/installer.php) and follow the instructions. - Remember your database details, as you will need them in this process. You're done! @@ -52,21 +57,24 @@ If you are upgrading from an earlier version, you can skip the first two steps b `docker exec galette cat /var/www/galette/config/config.inc.php` -4. As a subsequent security precaution, you should delete the galette installation files. Replace `galette` with the actual container name, if you changed that in the commands above. +5. As a security precaution, you should delete the galette installation files **after** you finished installing or upgrading. Replace `galette` with the actual container name, if you changed that in the commands above. `docker exec galette rm -r /var/www/galette/install` -5. Advanced configuration: +6. Advanced configuration: - Add the following volume to your container parameters to control logging of IP addresses behind a proxy, or to enable debugging mode. Read [here](https://doc.galette.eu/en/master/usermanual/avancee.html#log-ip-addresses-behind-a-proxy) for more info: + - To change some default behavior of Galette, add `behavior.inc.php` to your `config` folder (same folder as `config.inc.php`). You can start with a copy of [this file](./.example/config/behavior.inc.php). You can change most things listed [here](https://doc.galette.eu/en/master/usermanual/avancee.html#behavior), among them: + - session timeout + - logging of IP's behind a proxy + - operation mode - `-v ./path/to/config/behavior.inc.php:/var/www/galette/config/behavior.inc.php` - - Add the folloing volume to your container parameters to enable custom styling via CSS. Read [here](https://doc.galette.eu/en/master/usermanual/avancee.html#adapt-to-your-graphical-chart) for more info: + - Galette provides a parameterized CSV exports system. Only one parameterized export is provided, but you can add your own: Add `exports.yaml` to your `config` folder (same folder as `config.inc.php`). Read [here](https://doc.galette.eu/en/master/usermanual/avancee.html#csv-exports) for more info. - `v ./path/to/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css` + - To provide your own CSS styling for galette, create a `galette_local.css` on your host system, and add the folloing volume to your container parameters: - Remember to replace `./path/to/` with your own path. + `-v ./path/to/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css` + + Remember to replace `./path/to/` with your own path. Read [here](https://doc.galette.eu/en/master/usermanual/avancee.html#adapt-to-your-graphical-chart) for more info on the styling. ### Configure plugins From the main page of galette, click the plugin icon and manage the built-in modules. You can disable/enable them an initialize their database configuration from the UI. @@ -74,17 +82,18 @@ From the main page of galette, click the plugin icon and manage the built-in mod ## How to use this image using Docker Compose 1. Copy [`docker-compose/galette/docker-compose.yml`](docker-compose/galette/docker-compose.yml) and [`docker-compose/galette/.env`](docker-compose/galette/.env) to the folder, where you want to persist your configuration. 2. Optionally edit the values in `.env` -3. Create a `config` folder and an empty `config.inc.php` in that folder. Or copy the one from [here](.example/config/config.inc.php). +3. Create a `config` folder and optionally add a `config.inc.php` file to that folder. You can copy the one from [here](.example/config/config.inc.php) and adjust it. 4. Launch with `docker-compose up -d` 5. Go to http://localhost:8080/installer.php and complete installation (database, etc). - Note that http://localhost:8080 will report a failure, but adding /installer will work. You're done. -5. See above for deleting the install folder, advanced configuration and plugin configuration! In the docker compose example file, there are commented out lines for the behavior or css volumes. +5. See above for deleting the install folder, advanced configuration and plugin configuration! In the docker compose example file, there are commented out lines for the css volume. ## How to use this image AND a mariadb image using Docker Compose 1. Copy [`docker-compose/galette-and-mariadb/docker-compose.yml`](docker-compose/galette-and-mariadb/docker-compose.yml) and [`docker-compose/galette-and-mariadb/.env`](docker-compose/galette-and-mariadb/.env) to the folder, where you want to persist your configuration. + - Note: The official mariadb docker image LTS version `10.11` is currently not released for `arm/v7` so it can't be used for e.g. RaspBerry Pi 32 bit. However, you can switch to this unofficial mariadb-image instead: `jbergstroem/mariadb-alpine:10.11.5`. 2. Edit the `env` file to set your database configuration. **Don't** skip this. 3. Continue with the rest of the steps above diff --git a/docker-compose/galette-and-mariadb/docker-compose.yml b/docker-compose/galette-and-mariadb/docker-compose.yml index bf16868..9cc0314 100644 --- a/docker-compose/galette-and-mariadb/docker-compose.yml +++ b/docker-compose/galette-and-mariadb/docker-compose.yml @@ -34,10 +34,7 @@ services: - ${GALETTE_DATA_DIR}/data/photos:/var/www/galette/data/photos - ${GALETTE_DATA_DIR}/data/tempimages:/var/www/galette/data/tempimages - ${GALETTE_DATA_DIR}/data/templates_c:/var/www/galette/data/templates_c - - ${GALETTE_DATA_DIR}/config/config.inc.php:/var/www/galette/config/config.inc.php -# Uncomment this line below, to Log IP addresses behind a proxy or enabling debug mode : see file config/behavior.inc.php -# https://doc.galette.eu/en/master/usermanual/avancee.html#log-ip-addresses-behind-a-proxy -# - ${DATA_DIR}/config/behavior.inc.php:/var/www/galette/config/behavior.inc.php + - ${GALETTE_DATA_DIR}/config:/var/www/galette/config # Uncomment this line below, to enable a custom css # https://doc.galette.eu/en/master/usermanual/avancee.html#adapt-to-your-graphical-chart -# - ${DATA_DIR}/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css +# - ${GALETTE_DATA_DIR}/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css diff --git a/docker-compose/galette/docker-compose.yml b/docker-compose/galette/docker-compose.yml index ad34257..861236f 100644 --- a/docker-compose/galette/docker-compose.yml +++ b/docker-compose/galette/docker-compose.yml @@ -20,10 +20,7 @@ services: - ${GALETTE_DATA_DIR}/data/photos:/var/www/galette/data/photos - ${GALETTE_DATA_DIR}/data/tempimages:/var/www/galette/data/tempimages - ${GALETTE_DATA_DIR}/data/templates_c:/var/www/galette/data/templates_c - - ${GALETTE_DATA_DIR}/config/config.inc.php:/var/www/galette/config/config.inc.php -# Uncomment this line below, to Log IP addresses behind a proxy or enabling debug mode : see file config/behavior.inc.php -# https://doc.galette.eu/en/master/usermanual/avancee.html#log-ip-addresses-behind-a-proxy -# - ${DATA_DIR}/config/behavior.inc.php:/var/www/galette/config/behavior.inc.php + - ${GALETTE_DATA_DIR}/config:/var/www/galette/config # Uncomment this line below, to enable a custom css # https://doc.galette.eu/en/master/usermanual/avancee.html#adapt-to-your-graphical-chart -# - ${DATA_DIR}/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css \ No newline at end of file +# - ${GALETTE_DATA_DIR}/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css \ No newline at end of file