From 086fa572f4a0fefb0de5a5519dc7fc65cbaa6dce Mon Sep 17 00:00:00 2001 From: Magicalex Date: Thu, 10 Oct 2019 14:24:53 +0200 Subject: [PATCH] feat(): update flarum beta9 and some improvements --- Dockerfile | 6 +- README.md | 135 +++++++++++++++++++----------------- rootfs/usr/local/bin/run.sh | 18 ++--- 3 files changed, 81 insertions(+), 78 deletions(-) diff --git a/Dockerfile b/Dockerfile index 43e0c02..602135a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM alpine:3.8 +FROM alpine:3.10 LABEL description "Simple forum software for building great communities" \ maintainer="Hardware , Magicalex " -ARG VERSION=v0.1.0-beta.8.1 +ARG VERSION=v0.1.0-beta.9 ENV GID=991 \ UID=991 \ @@ -11,7 +11,7 @@ ENV GID=991 \ PHP_MEMORY_LIMIT=128M \ OPCACHE_MEMORY_LIMIT=128 -RUN echo "@community https://nl.alpinelinux.org/alpine/v3.8/community" >> /etc/apk/repositories \ +RUN echo "@community https://dl-cdn.alpinelinux.org/alpine/v3.10/community" >> /etc/apk/repositories \ && apk add -U \ nginx \ s6 \ diff --git a/README.md b/README.md index fde0572..c50ca7f 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ Simple forum software for building great communities. http://flarum.org/ - Lightweight & secure image - Based on Alpine Linux with **nginx** and **PHP 7.2** -- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.8.1) +- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.9) - MySQL/Mariadb driver - OPCache extension configured ### Build-time variables -- **VERSION** = Version of [flarum/flarum](https://github.com/flarum/flarum) skeleton (default: *v0.1.0-beta.8.1*) +- **VERSION** = Version of [flarum/flarum](https://github.com/flarum/flarum) skeleton (default: *v0.1.0-beta.9*) ### Ports @@ -46,6 +46,7 @@ Simple forum software for building great communities. http://flarum.org/ | **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M | | **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128 | **LOG_TO_STDOUT** | Enable nginx and php error logs to stdout | *optional* | false +| **GITHUB_TOKEN_AUTH** | github token to download private extensions | *optional* | false ### Required environment variable for first installation @@ -62,7 +63,7 @@ Simple forum software for building great communities. http://flarum.org/ ```bash # Pull from hub.docker.com : -docker pull mondedie/docker-flarum:0.1.0-beta.8.1-stable +docker pull mondedie/docker-flarum:0.1.0-beta.9-stable # or build it manually : docker build -t mondedie/docker-flarum https://github.com/mondediefr/flarum.git#master @@ -75,7 +76,7 @@ version: "3" services: flarum: - image: mondedie/docker-flarum:0.1.0-beta.8.1-stable + image: mondedie/docker-flarum:0.1.0-beta.9-stable container_name: flarum env_file: - /mnt/docker/flarum/flarum.env @@ -87,7 +88,7 @@ services: - mariadb mariadb: - image: mariadb:10.2 + image: mariadb:10.4 container_name: mariadb environment: - MYSQL_ROOT_PASSWORD=xxxxxxxxxx @@ -137,6 +138,72 @@ docker-compose up -d ![flarum-home](http://i.imgur.com/6kH9iTV.png) +### Install custom extensions + +**Flarum extensions list :** https://flagrow.io/extensions + +#### Install an extension + +```sh +docker exec -ti flarum extension require some/extension +``` + +#### Remove an extension + +```sh +docker exec -ti flarum extension remove some/extension +``` + +#### List all extensions + +```sh +docker exec -ti flarum extension list +``` + +### Custom vhost flarum nginx + +File to change the vhost flarum `/etc/nginx/conf.d/custom-vhost-flarum.conf` +To use file custom-vhost-flarum.conf add volume `/etc/nginx/conf.d` + +### Custom composer repositories + +To use the composer repository system, add your repo name and json representation in `/mnt/docker/flarum/extensions/composer.repositories.txt`: + +``` +my_private_repo|{"type":"path","url":"extensions/*/"} +my_public_repo|{"type":"vcs","url":"https://github.com/my/repo"} +``` + +Example for a private repository in github + +Add this in `/mnt/docker/flarum/extensions/composer.repositories.txt` +``` +username|{"type":"vcs","url":"https://github.com/username/my-private-repo"} +``` + +Create a token in github with full control of privates repository +https://github.com/settings/tokens + +Add your github token in var environment +``` +GITHUB_TOKEN_AUTH=XXXXXXXXXXXXXXX +``` + +Add your repo in the list file `/mnt/docker/flarum/extensions/list` +``` +username/my-private-repo:0.1.0 +``` + +https://getcomposer.org/doc/03-cli.md#modifying-repositories + +### Upgrade to v0.1.0-beta.10 from v0.1.0-beta.9 + +... + +### Upgrade to v0.1.0-beta.9 from v0.1.0-beta.8.1 + +... + ### Upgrade to v0.1.0-beta.8.1 from v0.1.0-beta.7.2 :warning: Backup your database, config.php, composer.lock and assets folder @@ -218,61 +285,3 @@ docker-compose stop flarum docker-compose rm flarum docker-compose up -d ``` - -### Install custom extensions - -**Flarum extensions list :** https://flagrow.io/extensions - -#### Install an extension - -```sh -docker exec -ti flarum extension require some/extension -``` - -#### Remove an extension - -```sh -docker exec -ti flarum extension remove some/extension -``` - -#### List all extensions - -```sh -docker exec -ti flarum extension list -``` - -### Custom vhost flarum nginx - -File to change the vhost flarum `/etc/nginx/conf.d/custom-vhost-flarum.conf` -To use file custom-vhost-flarum.conf add volume `/etc/nginx/conf.d` - -### Custom composer repositories - -To use the composer repository system, add your repo name and json representation in `/mnt/docker/flarum/extensions/composer.repositories.txt`: - -``` -my_private_repo|{"type":"path","url":"extensions/*/"} -my_public_repo|{"type":"vcs","url":"https://github.com/my/repo"} -``` - -Example for a private repository in github - -Add this in `/mnt/docker/flarum/extensions/composer.repositories.txt` -``` -username|{"type":"vcs","url":"https://github.com/username/my-private-repo"} -``` - -Create a token in github with full control of privates repository -https://github.com/settings/tokens - -Add your token in the file `/mnt/docker/flarum/extensions/auth.token.txt` replace by your token -``` -github| -``` - -Add your repo in the list file `/mnt/docker/flarum/extensions/list` -``` -username/my-private-repo:0.1.0 -``` - -https://getcomposer.org/doc/03-cli.md#modifying-repositories diff --git a/rootfs/usr/local/bin/run.sh b/rootfs/usr/local/bin/run.sh index 2e30da1..061a2b2 100644 --- a/rootfs/usr/local/bin/run.sh +++ b/rootfs/usr/local/bin/run.sh @@ -8,6 +8,7 @@ DB_PORT="${DB_PORT:-3306}" FLARUM_TITLE="${FLARUM_TITLE:-Docker-Flarum}" DEBUG="${DEBUG:-false}" LOG_TO_STDOUT="${LOG_TO_STDOUT:-false}" +GITHUB_TOKEN_AUTH="${GITHUB_TOKEN_AUTH:-false}" # Required env variables if [ -z "${DB_PASS}" ]; then @@ -38,16 +39,10 @@ fi cd /flarum/app -# add token authentication (eg. for privates extensions) -if [ -f '/flarum/app/extensions/auth.token.txt' ]; then - while read line; do - site=$(echo $line | cut -d '|' -f1) - token=$(echo $line | cut -d '|' -f2) - if [ $site = "github" ]; then - echo "[INFO] Adding ${site} token authentication" - composer config github-oauth.github.com $token - fi - done < /flarum/app/extensions/auth.token.txt +# add github token authentication (eg. for privates extensions) +if [ "${GITHUB_TOKEN_AUTH}" != false ]; then + echo "[INFO] Adding github token authentication" + composer config github-oauth.github.com "${GITHUB_TOKEN_AUTH}" fi # Custom repositories (eg. for privates extensions) @@ -70,7 +65,7 @@ if [ ! -e '/etc/nginx/conf.d/custom-vhost-flarum.conf' ]; then fi # if no installation was performed before -if [ -e '/flarum/app/public/assets/installed.txt' ]; then +if [ -e '/flarum/app/public/assets/rev-manifest.json' ]; then echo "[INFO] Flarum already installed, init app..." sed -i -e "s||${DEBUG}|g" \ @@ -127,7 +122,6 @@ else su-exec $UID:$GID php /flarum/app/flarum install --file=/flarum/app/config.yml echo "[INFO] End of flarum installation" - echo "Done" > /flarum/app/public/assets/installed.txt fi # Set permissions for /flarum folder