feat(): update flarum beta9 and some improvements

pull/43/head
Magicalex 2019-10-10 14:24:53 +02:00
parent f024b57bbf
commit 086fa572f4
No known key found for this signature in database
GPG Key ID: A89B48B1788C3CB5
3 changed files with 81 additions and 78 deletions

View File

@ -1,9 +1,9 @@
FROM alpine:3.8 FROM alpine:3.10
LABEL description "Simple forum software for building great communities" \ LABEL description "Simple forum software for building great communities" \
maintainer="Hardware <hardware@mondedie.fr>, Magicalex <magicalex@mondedie.fr>" maintainer="Hardware <hardware@mondedie.fr>, Magicalex <magicalex@mondedie.fr>"
ARG VERSION=v0.1.0-beta.8.1 ARG VERSION=v0.1.0-beta.9
ENV GID=991 \ ENV GID=991 \
UID=991 \ UID=991 \
@ -11,7 +11,7 @@ ENV GID=991 \
PHP_MEMORY_LIMIT=128M \ PHP_MEMORY_LIMIT=128M \
OPCACHE_MEMORY_LIMIT=128 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 \ && apk add -U \
nginx \ nginx \
s6 \ s6 \

135
README.md
View File

@ -10,13 +10,13 @@ Simple forum software for building great communities. http://flarum.org/
- Lightweight & secure image - Lightweight & secure image
- Based on Alpine Linux with **nginx** and **PHP 7.2** - 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 - MySQL/Mariadb driver
- OPCache extension configured - OPCache extension configured
### Build-time variables ### 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 ### Ports
@ -46,6 +46,7 @@ Simple forum software for building great communities. http://flarum.org/
| **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M | | **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M |
| **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128 | **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128
| **LOG_TO_STDOUT** | Enable nginx and php error logs to stdout | *optional* | false | **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 ### Required environment variable for first installation
@ -62,7 +63,7 @@ Simple forum software for building great communities. http://flarum.org/
```bash ```bash
# Pull from hub.docker.com : # 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 : # or build it manually :
docker build -t mondedie/docker-flarum https://github.com/mondediefr/flarum.git#master docker build -t mondedie/docker-flarum https://github.com/mondediefr/flarum.git#master
@ -75,7 +76,7 @@ version: "3"
services: services:
flarum: 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 container_name: flarum
env_file: env_file:
- /mnt/docker/flarum/flarum.env - /mnt/docker/flarum/flarum.env
@ -87,7 +88,7 @@ services:
- mariadb - mariadb
mariadb: mariadb:
image: mariadb:10.2 image: mariadb:10.4
container_name: mariadb container_name: mariadb
environment: environment:
- MYSQL_ROOT_PASSWORD=xxxxxxxxxx - MYSQL_ROOT_PASSWORD=xxxxxxxxxx
@ -137,6 +138,72 @@ docker-compose up -d
![flarum-home](http://i.imgur.com/6kH9iTV.png) ![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 ### 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 :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 rm flarum
docker-compose up -d 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 <TOKEN> by your token
```
github|<TOKEN>
```
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

View File

@ -8,6 +8,7 @@ DB_PORT="${DB_PORT:-3306}"
FLARUM_TITLE="${FLARUM_TITLE:-Docker-Flarum}" FLARUM_TITLE="${FLARUM_TITLE:-Docker-Flarum}"
DEBUG="${DEBUG:-false}" DEBUG="${DEBUG:-false}"
LOG_TO_STDOUT="${LOG_TO_STDOUT:-false}" LOG_TO_STDOUT="${LOG_TO_STDOUT:-false}"
GITHUB_TOKEN_AUTH="${GITHUB_TOKEN_AUTH:-false}"
# Required env variables # Required env variables
if [ -z "${DB_PASS}" ]; then if [ -z "${DB_PASS}" ]; then
@ -38,16 +39,10 @@ fi
cd /flarum/app cd /flarum/app
# add token authentication (eg. for privates extensions) # add github token authentication (eg. for privates extensions)
if [ -f '/flarum/app/extensions/auth.token.txt' ]; then if [ "${GITHUB_TOKEN_AUTH}" != false ]; then
while read line; do echo "[INFO] Adding github token authentication"
site=$(echo $line | cut -d '|' -f1) composer config github-oauth.github.com "${GITHUB_TOKEN_AUTH}"
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
fi fi
# Custom repositories (eg. for privates extensions) # Custom repositories (eg. for privates extensions)
@ -70,7 +65,7 @@ if [ ! -e '/etc/nginx/conf.d/custom-vhost-flarum.conf' ]; then
fi fi
# if no installation was performed before # 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..." echo "[INFO] Flarum already installed, init app..."
sed -i -e "s|<DEBUG>|${DEBUG}|g" \ sed -i -e "s|<DEBUG>|${DEBUG}|g" \
@ -127,7 +122,6 @@ else
su-exec $UID:$GID php /flarum/app/flarum install --file=/flarum/app/config.yml su-exec $UID:$GID php /flarum/app/flarum install --file=/flarum/app/config.yml
echo "[INFO] End of flarum installation" echo "[INFO] End of flarum installation"
echo "Done" > /flarum/app/public/assets/installed.txt
fi fi
# Set permissions for /flarum folder # Set permissions for /flarum folder