Skip to content

Commit

Permalink
Release 1.0.3 (#19)
Browse files Browse the repository at this point in the history
* Bumped php to version 8.2
* Bumped galette version to 1.0.3
* More comprehensive how-to. Now describes how to create the container once and use it without recreating it after configurating galette (as was written before).
* Contribution guide added for future maintaners and contributors
  • Loading branch information
grasdk authored Apr 25, 2024
1 parent c6e38eb commit b3b2f7e
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 61 deletions.
11 changes: 4 additions & 7 deletions .example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.7'

services:
galette:
image: galette/galette:<version>
image: galette/galette:latest
container_name: galette
stdin_open: true
tty: true
Expand All @@ -14,15 +14,12 @@ services:
volumes:
- ./data/attachments:/var/www/galette/data/attachments
- ./data/cache:/var/www/galette/data/cache
# - ./data/exports:/var/www/galette/data/exports
- ./data/files:/var/www/galette/data/files
# - ./data/logs:/var/www/galette/data/logs
- ./data/logs:/var/www/galette/data/logs
- ./data/photos:/var/www/galette/data/photos
# - ./data/tempimages:/var/www/galette/data/tempimages
# - ./data/template_c:/var/www/galette/data/template_c
- ./data/tempimages:/var/www/galette/data/tempimages
- ./data/templates_c:/var/www/galette/data/templates_c
# Uncomment this line below, after you have launch once Galette to create database : see file config / config.inc.php
# - ./config/config.inc.php:/var/www/galette/config/config.inc.php
- ./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
# - ./config/behavior.inc.php:/var/www/galette/config/behavior.inc.php
Expand Down
28 changes: 24 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
# Galette Docker project
Building and maintaining this project is solely about the containerization of the finished Galette packages. If you want to contribute to Galette itself, take a look [here](https://galette.eu/site/contribute/).

## Prerequisites
## Updating to next Galette 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 galetteversion=<version>`. You might also need to update the plugin versions: `ARG plugin_< plugin name>_version=<version>`.

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.

In steps:
1. Create a new branch or fork
2. Update `Dockerfile` with new version(s)
3. [Build and test locally](#building-and-testing-locally) - _yeah, you really should do this ;)_
4. Make a pull request and await approval if you can't approve yourself.
- Normal contributers cannot proceed past this step. The next step requires elevated access to the github repository. So these steps are intended for the maintainer(s) of the project.
5. Once merged, click Releases in Github
6. Click "Draft new Release" button
7. Select "Choose a tag" and type a version number equal to the Galette version in the `Dockerfile`. Click "Create new tag: <version> on publish".
8. Update the description (copy paste from the previous release) and update latest changes, using the "Generate Release Notes" button
9. Click publish release
10. The github action [build and publish](./.github/workflows/docker-build-and-publish.yml), will build and publish the image automatically.
- Note: [build and publish](./.github/workflows/docker-build-and-publish.yml) uses the username and a personal access token from a docker-hub user with access to the [galette organisation](https://hub.docker.com/orgs/galette/members) on dockerhub. These are both stored as secrets in Github. These tokens should be the current maintainer's.

## Building and testing locally
### Prerequisites
- `docker` is installed in your development environment.
- `dockerd` the docker deamon is installed (and [started](https://docs.docker.com/config/daemon/start/))
- `buildx` is installed in your development environment.

Although it's possible to build packages without `dockerd` running, using [`buildah`](https://buildah.io/), the focus here is on [`buildx`](https://docs.docker.com/reference/cli/docker/buildx/). You're welcome to contribute with instructions for `buildah`.

## Linting
### Linting
1. Start the docker daemon if it's not already started: `sudo dockerd`
2. Run hadolint (containerized): `docker run --rm -i -v ./.config/hadolint.yml:/.config/hadolint.yaml hadolint/hadolint < Dockerfile`
3. Fix errors and warnings or add them to ignore list of the [hadolint configuration file](./.config/hadolint.yml) if there is a good reason for that. Read more [here](https://github.com/hadolint/hadolint).

## Building the docker image locally
### Building the docker image locally
1. Start the docker daemon if it's not already started: `sudo dockerd`
2. Run the build command: `docker buildx build -t galette-local .`
* replace `galette-local` with any name you would like to give your local image
Expand All @@ -25,5 +45,5 @@ 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
* NOTE: The build process is significantly longer than just building for your local architecture.

## Running the docker image locally
### Running the docker image locally
1. Follow the same steps as in [How to use this image](./README.md#How-to-use-this-image), replacing the image name `galette/galette:latest` with your local container name, e.g. `galette-local`.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Using PHP-Apache image
FROM php:8.1-apache
FROM php:8.2-apache

# Maintained by GrasDK for Galette community
LABEL maintainer="GrasDK"
# @author Hiob
# @author GrasDK

LABEL phpversion="8.1"
ARG galetteversion="1.0.2"
LABEL phpversion="8.2"
ARG galetteversion="1.0.3"

## Plugins versions
ARG plugin_auto_version="2.0.0"
ARG plugin_events_version="2.0.0"
Expand Down Expand Up @@ -139,4 +140,4 @@ WORKDIR $GALETTE_INSTALL
COPY scripts/entrypoint.sh /entrypoint.sh
RUN chmod -v +x /entrypoint.sh
USER www-data:www-data
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
96 changes: 50 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,80 @@

Current repository hosts sources of the [Galette docker image](https://hub.docker.com/repository/docker/galette/galette), created and maintained by [Galette Community](https://github.com/galette-community/).

## Contributing
If you want to contribute to containerized galette, take a look [here](./CONTRIBUTING.md).

## Features
* integrated plugins : [events](https://github.com/galette/plugin-events), [fullcard](https://github.com/galette/plugin-fullcard), [maps](https://github.com/galette/plugin-maps), [objectslend](https://github.com/galette/plugin-objectslend) and [paypal](https://github.com/galette/plugin-paypal)
* mount volume to keep persistent database settings (*config.inc.php*)
* keep data (images, logs, etc) persistent by mounting volume
* keep data (images, logs, etc) persistent by mounting volumes
* enabling Log IP addresses behind a proxy (*optional*)
* custom your CSS (volume)
* customize your CSS (volume)
* user www-data instead of root
* a crontab will run `reminder.php` (with user www-data) every day at 8:30am to send reminder mail
* only webroot is exposed via Apache DocumentRoot and vhost
* you can use reverse proxy to access Galette by domain or subdomain

## How to use this image
## 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.

### Run manually using docker command line
This requires a first launch for initialization, followed by some configuration. Then you can run the container
Therefore it is really important that you follow this guide exactly.

#### First launch
If you are upgrading from an ealier version, you can skip the first step below.

run your docker container to install to connect Galette to your database server
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.
```
docker run -d -p 8080:80 --name galette
-v /path/to/config.inc.php:/var/www/galette/config/config.inc.php \
-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
```
Remember to replace `./path/to/` with your own path.
```
docker run -d -p 8080:80 --name galette \
galette/galette:latest
```
3. Run the installer: Open a browser to http://\<ip or server name\>: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.
#### Configure
* go to localhost:8080 and complete installation (database, etc)
* stop container `docker container stop galette` and remove it `docker container rm galette`
You're done!
N.B.: You can check `config.inc.php` in container.
Now your Galette database is created, to have a persistent MySQL/PostgreSQL configuration, you need to mount your `config.inc.php` as a volume
`docker exec galette cat /var/www/galette/config/config.inc.php`
* create a `config.inc.php` ([example](https://github.com/galette-community/docker/blob/master/.example/config/config.inc.php)) file wherever you want containing the configuration and turn environment variable `RM_INSTALL_FOLDER` to "1" (for remove install folder after installation/update, for security purpose)
* now run again your container with a persistent volume to your `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.
#### Running the container after first launch
`docker exec galette rm -r /var/www/galette/install`
```
docker run -d -p 8080:80 --name galette
-v /path/to/config.inc.php:/var/www/galette/config/config.inc.php \
-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 ./data/templates_c:/var/www/galette/data/templates_c \
galette/galette:latest
```
5. Advanced configuration:
**N.B.:** You can check `config.inc.php` in container.
* in terminal, connect to container console `docker container exec -ti galette bash`
* and type `cat /var/www/galette/config/config.inc.php` to check your dabatase configuration
* exit from container console : `exit`
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:
#### 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.
`-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:
`v ./path/to/galette_local.css:/var/www/galette/webroot/themes/default/galette_local.css`
## Using Docker Compose
An [example of docker-compose.yml](.example/docker-compose.yml) is provided.
Remember to replace `./path/to/` with your own path.
### 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.
#### First launch
* copy `docker-compose.yml` example wherever you want in a folder
* Edit your `docker-compose.yml` **without** a mounted volume (config.inc.php) and launch with `docker-compose up -d`
* go to localhost:8080 and complete installation (database, etc)
* stop and remove container : `docker-compose down`
* create a `config.inc.php` ([example](https://github.com/galette-community/docker/blob/master/.example/config/config.inc.php)) file wherever you want containing the configuration
* edit `docker-compose.yml` and uncomment *volumes* section, make sure that your `/path/to/config.inc.php` is OK and turn environment variable `RM_INSTALL_FOLDER` to "1" (for remove install folder after installation/update, for security purpose)
* launch container with `docker-compose up -d`
## How to use this image using Docker Compose
1. Copy [docker-compose.yml](.example/docker-compose.yml) to the folder, where you want to persist your configuration.
2. 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. Launch with `docker-compose up -d`
4. Go to http://localhost:8080/installer.php and complete installation (database, etc)
You're done (see above for plugin configuration)!
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.
## Reverse proxy
### Nginx
Expand Down
17 changes: 17 additions & 0 deletions galette-with-db.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Using PHP-Apache image
FROM galette/galette:1.0.2
USER root
RUN apt-get -y update \
&& apt-get install --no-install-recommends -y \
mariadb-server=1:10.11* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV MYSQL_ROOT_PASSWORD=myrootpassword
ENV MYSQL_DATABASE=galette
ENV MYSQL_USER=galette
ENV MYSQL_PASSWORD=galette_pass
ENV MYSQL_PORT=3306
RUN mkdir /run/mysqld/
USER mysql:mysql
CMD ["mysqld_safe"]
USER www-data:www-data

0 comments on commit b3b2f7e

Please sign in to comment.