Skip to content

Commit

Permalink
feat(): update to beta8
Browse files Browse the repository at this point in the history
  • Loading branch information
Magicalex committed Nov 30, 2018
1 parent c77de89 commit 6b023d1
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 123 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false

[*.php]
indent_size = 4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker-compose.yml
docker
docker
flarum.env
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM alpine:3.8

LABEL description "Next-generation forum software that makes online discussion fun" \
LABEL description "Simple forum software for building great communities" \
maintainer="Hardware <hardware@mondedie.fr>, Magicalex <magicalex@mondedie.fr>"

ARG VERSION=v0.1.0-beta.7
ARG VERSION=v0.1.0-beta.8

ENV GID=991 \
UID=991 \
Expand Down Expand Up @@ -39,9 +39,8 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.8/community" >> /etc/a
php7-tokenizer@community \
php7-zip@community \
&& cd /tmp \
&& curl -s http://getcomposer.org/installer | php \
&& mv /tmp/composer.phar /usr/bin/composer \
&& chmod +x /usr/bin/composer \
&& curl -s http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& chmod +x /usr/local/bin/composer \
&& mkdir -p /flarum/app \
&& chown -R $UID:$GID /flarum \
&& COMPOSER_CACHE_DIR="/tmp" su-exec $UID:$GID composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \
Expand All @@ -50,6 +49,6 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.8/community" >> /etc/a

COPY rootfs /
RUN chmod +x /usr/local/bin/* /services/*/run /services/.s6-svscan/*
VOLUME /flarum/app/assets /flarum/app/extensions /etc/nginx/conf.d
EXPOSE 8888
VOLUME /flarum/app/extensions /etc/nginx/conf.d
EXPOSE 8080
CMD ["run.sh"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Apache License
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2016 Mondedie.fr
Copyright 2018 mondediefr/docker-flarum

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
85 changes: 55 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ Simple forum software for building great communities. http://flarum.org/
### Features

- Lightweight & secure image
- Based on Alpine Linux with **nginx** and **PHP 7**
- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.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)
- MySQL/Mariadb driver
- OPCache extension configured

### Build-time variables

- **VERSION** = Version of flarum (default: *v0.1.0-beta.7*)
- **VERSION** = Version of flarum (default: *v0.1.0-beta.8*)

### Ports

- **8888**
- **8080**

### Volume

- **/flarum/app/assets** : Flarum assets directory
- **/flarum/app/public/assets** : Flarum assets directory
- **/flarum/app/extensions** : Flarum extension directory
- **/etc/nginx/conf.d** : Nginx location directory

Expand All @@ -41,18 +41,28 @@ Simple forum software for building great communities. http://flarum.org/
| **DB_NAME** | MariaDB database name | *optional* | flarum
| **DB_PASS** | MariaDB database password | **required** | none
| **DB_PREF** | Flarum tables prefix | *optional* | none
| **DB_PORT** | MariaDB database port | *optional* | 3306
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
| **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

### Required environment variable for installation

| Variable | Description | Type | Default value |
| -------- | ----------- | ---- | ------------- |
| **FLARUM_ADMIN_USER** | Name of your user admin | **required** | none
| **FLARUM_ADMIN_PASS** | User admin password | **required** | none
| **FLARUM_ADMIN_MAIL** | User admin adress mail | **required** | none
| **FLARUM_TITLE** | Set a name of your flarum | *optional* | Docker-Flarum

## Installation

#### 1 - Pull flarum image

```bash
# Pull from hub.docker.com :
docker pull mondedie/docker-flarum:0.1.0-beta.7.2-stable
docker pull mondedie/docker-flarum:0.1.0-beta.8-stable

# or build it manually :
docker build -t mondedie/docker-flarum https://github.com/mondediefr/flarum.git#master
Expand All @@ -65,11 +75,10 @@ version: "3"

services:
flarum:
image: mondedie/docker-flarum:0.1.0-beta.7.2-stable
image: mondedie/docker-flarum:0.1.0-beta.8-stable
container_name: flarum
environment:
- FORUM_URL=http://flarum.local
- DB_PASS=xxxxxx
env_file:
- /mnt/docker/flarum/flarum.env
volumes:
- /mnt/docker/flarum/assets:/flarum/app/assets
- /mnt/docker/flarum/extensions:/flarum/app/extensions
Expand All @@ -78,13 +87,13 @@ services:
- mariadb

mariadb:
image: mariadb:10.1
image: mariadb:10.2
container_name: mariadb
environment:
- MYSQL_ROOT_PASSWORD=xxxxxx
- MYSQL_ROOT_PASSWORD=xxxxxxxxxx
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=xxxxxx
- MYSQL_PASSWORD=xxxxxxxxxx
volumes:
- /mnt/docker/mysql/db:/var/lib/mysql
```
Expand All @@ -93,23 +102,49 @@ services:
You need a reverse proxy to access flarum, this is not described here. You can use the solution of your choice (Traefik, Nginx, Apache, Haproxy, Caddy, H2O...etc).
Create a env file (see docker-compose -> /mnt/docker/flarum/flarum.env)
```
DEBUG=false
FORUM_URL=http://domain.tld

# Database configuration
DB_HOST=mariadb
DB_NAME=flarum
DB_USER=flarum
DB_PASS=xxxxxxxxxx
DB_PREF=flarum_
DB_PORT=3306

# User admin flarum
## admin password must contain at least 8 characters
FLARUM_ADMIN_USER=admin
FLARUM_ADMIN_PASS=xxxxxxxxxx
FLARUM_ADMIN_MAIL=admin@domain.tld
FLARUM_TITLE=Test flarum
```
run docker-flarum
```
docker-compose up -d
```

Fill out the installation form :

* Your admin password must contain at least **8 characters**.
* :warning: Your admin password must contain at least **8 characters**.
* You can't use MariaDB **10.2** or **10.3** for the moment. More information on this issue [here](https://github.com/flarum/core/issues/1211).
* If you get an error 500 with _Something went wrong_ message, switch the `DEBUG` environment variable to `true` to see the actual error message in your browser.

![flarum-installation](http://i.imgur.com/e3Hscp4.png)
![flarum-home](http://i.imgur.com/6kH9iTV.png)

### Upgrade to v0.1.0-beta.8 from v0.1.0-beta.7

Click on **Install Flarum** and after few seconds the forum homepage should appear.
:warning: Disable 3rd party extensions prior to upgrading.

![flarum-home](http://i.imgur.com/6kH9iTV.png)
```
docker pull mondedie/docker-flarum:0.1.0-beta.7.1-stable && docker-compose up -d
```

### Upgrade from v0.1.0-beta.6
and...

### Upgrade to v0.1.0-beta.7 from v0.1.0-beta.6

:warning: Disable 3rd party extensions prior to upgrading.

Expand Down Expand Up @@ -151,16 +186,6 @@ docker exec -ti flarum extension remove some/extension
docker exec -ti flarum extension list
```

### Custom error pages

To use custom error pages, add your .html files in `/mnt/docker/flarum/assets/errors` folder :

```bash
mkdir -p /mnt/docker/flarum/assets/errors
touch 403.html 404.html 500.html 503.html
chown -R 991:991 /mnt/docker/flarum
```

### Custom vhost flarum nginx

File to change the vhost flarum `/etc/nginx/conf.d/custom-vhost-flarum.conf`
Expand Down
44 changes: 5 additions & 39 deletions rootfs/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,49 +53,17 @@ http {
image/svg+xml;

server {
listen 8080;
charset utf-8;

listen 8888;
root /flarum/app;
root /flarum/app/public;
index index.php;
charset utf-8;

client_max_body_size <UPLOAD_MAX_SIZE>;
fastcgi_buffers 64 4K;

error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
error_page 503 /503.html;

location = /403.html { alias /flarum/app/vendor/flarum/core/error/403.html; }
location = /404.html { alias /flarum/app/vendor/flarum/core/error/404.html; }
location = /500.html { alias /flarum/app/vendor/flarum/core/error/500.html; }
location = /503.html { alias /flarum/app/vendor/flarum/core/error/503.html; }

location / { try_files $uri $uri/ /index.php?$query_string; }
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }

# Access path list
# --------------------------------------
location ~ /\. {
deny all;
return 404;
}

location ~* ^/(Procfile|storage|Vagrantfile|config\.php|LICENSE|vendor|flarum|scripts) {
deny all;
return 404;
}

location ~* composer(.*?) {
deny all;
return 404;
}

location ~* (.*?)\.md {
deny all;
return 404;
location / {
try_files $uri $uri/ /index.php?$query_string;
}

# Assets cache control
Expand Down Expand Up @@ -133,7 +101,5 @@ http {
}

include /etc/nginx/conf.d/custom-vhost-flarum.conf;

}

}
6 changes: 2 additions & 4 deletions rootfs/flarum/app/config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php return array (
'debug' => <DEBUG>,
'database' =>
array (
'database' => array (
'driver' => 'mysql',
'host' => '<DB_HOST>',
'database' => '<DB_NAME>',
Expand All @@ -13,8 +12,7 @@
'strict' => false,
),
'url' => '<FORUM_URL>',
'paths' =>
array (
'paths' => array (
'api' => 'api',
'admin' => 'admin',
),
Expand Down
17 changes: 17 additions & 0 deletions rootfs/flarum/app/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
debug: <DEBUG>
baseUrl: <FORUM_URL>
databaseConfiguration:
driver: mysql
host: <DB_HOST>
database: <DB_NAME>
username: <DB_USER>
password: <DB_PASS>
prefix: <DB_PREF>
port: <DB_PORT>
adminUser:
username: <FLARUM_ADMIN_USER>
password: <FLARUM_ADMIN_PASS>
password_confirmation: <FLARUM_ADMIN_PASS>
email: <FLARUM_ADMIN_MAIL>
settings:
forum_title: <FLARUM_TITLE>
9 changes: 3 additions & 6 deletions rootfs/usr/local/bin/extension
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ CRED="${CSI}1;31m"
CGREEN="${CSI}1;32m"

# Composer cache dir and packages list paths
CACHE_DIR=extensions/.cache
LIST_FILE=extensions/list
CACHE_DIR=/flarum/app/extensions/.cache
LIST_FILE=/flarum/app/extensions/list

# Cmd ARGS
action=$1
package=$2

# Move to flarum folder
cd /flarum/app

# Create custom extensions cache folder and list file
su-exec $UID:$GID mkdir -p "$CACHE_DIR"
su-exec $UID:$GID touch "$LIST_FILE"
Expand Down Expand Up @@ -55,6 +52,6 @@ case "$action" in
;;
esac

su-exec $UID:$GID php flarum cache:clear
su-exec $UID:$GID php /flarum/app/flarum cache:clear

exit 0
Loading

0 comments on commit 6b023d1

Please sign in to comment.