2016-12-11 01:35:16 -05:00
# mondedie/docker-flarum
2016-07-17 05:35:13 -04:00
![logo ](https://i.imgur.com/Bjrtbsc.png "logo" )
### What is this ?
2018-10-29 16:58:21 -04:00
Simple forum software for building great communities. http://flarum.org/
2016-07-17 05:35:13 -04:00
### Features
2016-07-18 02:35:38 -04:00
- Lightweight & secure image
2018-11-29 22:00:50 -05:00
- Based on Alpine Linux with **nginx** and **PHP 7.2**
2018-12-05 19:52:51 -05:00
- Latest [Flarum Core ](https://github.com/flarum/core ) (v0.1.0-beta.8.1)
2016-07-17 05:35:13 -04:00
- MySQL/Mariadb driver
2016-07-18 02:35:38 -04:00
- OPCache extension configured
2016-07-17 05:35:13 -04:00
### Build-time variables
2018-11-29 22:00:50 -05:00
- **VERSION** = Version of flarum (default: *v0.1.0-beta.8* )
2016-07-17 05:35:13 -04:00
2017-05-13 05:12:25 -04:00
### Ports
2016-09-25 05:27:13 -04:00
2018-11-30 04:26:05 -05:00
- **8888**
2016-09-25 05:27:13 -04:00
### Volume
2018-11-29 22:00:50 -05:00
- **/flarum/app/public/assets** : Flarum assets directory
2016-12-19 02:38:23 -05:00
- **/flarum/app/extensions** : Flarum extension directory
2018-10-29 16:58:21 -04:00
- **/etc/nginx/conf.d** : Nginx location directory
2016-09-25 05:27:13 -04:00
2016-07-17 05:35:13 -04:00
### Environment variables
2016-07-18 02:35:38 -04:00
| Variable | Description | Type | Default value |
| -------- | ----------- | ---- | ------------- |
2016-12-11 01:35:16 -05:00
| **UID** | Flarum user id | *optional* | 991
| **GID** | Flarum group id | *optional* | 991
2016-08-08 02:09:01 -04:00
| **DEBUG** | Flarum debug mode | *optional* | false
2016-07-18 02:35:38 -04:00
| **FORUM_URL** | Forum URL | **required** | none
| **DB_HOST** | MariaDB instance ip/hostname | *optional* | mariadb
| **DB_USER** | MariaDB database username | *optional* | flarum
| **DB_NAME** | MariaDB database name | *optional* | flarum
| **DB_PASS** | MariaDB database password | **required** | none
2016-10-28 13:29:42 -04:00
| **DB_PREF** | Flarum tables prefix | *optional* | none
2018-11-29 22:00:50 -05:00
| **DB_PORT** | MariaDB database port | *optional* | 3306
2017-05-13 05:12:25 -04:00
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
2018-02-17 04:21:10 -05:00
| **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M |
| **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128
2018-06-22 03:16:19 -04:00
| **LOG_TO_STDOUT** | Enable nginx and php error logs to stdout | *optional* | false
2016-07-17 05:35:13 -04:00
2018-11-30 04:26:05 -05:00
### Required environment variable for first installation
2018-11-29 22:00:50 -05:00
| 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
2016-07-18 02:35:38 -04:00
## Installation
#### 1 - Pull flarum image
2016-07-18 01:34:39 -04:00
2018-01-30 15:35:42 -05:00
```bash
2016-10-23 17:18:57 -04:00
# Pull from hub.docker.com :
2018-12-05 19:52:51 -05:00
docker pull mondedie/docker-flarum:0.1.0-beta.8.1-stable
2016-10-23 17:18:57 -04:00
# or build it manually :
2016-12-11 01:35:16 -05:00
docker build -t mondedie/docker-flarum https://github.com/mondediefr/flarum.git#master
2016-07-18 02:35:38 -04:00
```
2018-08-09 03:10:54 -04:00
#### 2 - Docker-compose.yml
2018-01-30 15:35:42 -05:00
```yml
version: "3"
2016-07-17 05:35:13 -04:00
2018-01-30 15:35:42 -05:00
services:
flarum:
2018-12-05 19:52:51 -05:00
image: mondedie/docker-flarum:0.1.0-beta.8.1-stable
2018-01-30 15:35:42 -05:00
container_name: flarum
2018-11-29 22:00:50 -05:00
env_file:
- /mnt/docker/flarum/flarum.env
2018-01-30 15:35:42 -05:00
volumes:
2018-11-29 22:47:57 -05:00
- /mnt/docker/flarum/assets:/flarum/app/public/assets
2018-01-30 15:35:42 -05:00
- /mnt/docker/flarum/extensions:/flarum/app/extensions
2018-10-29 16:58:21 -04:00
- /mnt/docker/flarum/nginx:/etc/nginx/conf.d
2018-01-30 15:35:42 -05:00
depends_on:
- mariadb
2016-07-17 05:35:13 -04:00
2018-01-30 15:35:42 -05:00
mariadb:
2018-11-29 22:00:50 -05:00
image: mariadb:10.2
2018-01-30 15:35:42 -05:00
container_name: mariadb
environment:
2018-11-29 22:00:50 -05:00
- MYSQL_ROOT_PASSWORD=xxxxxxxxxx
2018-01-30 15:35:42 -05:00
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
2018-11-29 22:00:50 -05:00
- MYSQL_PASSWORD=xxxxxxxxxx
2018-01-30 15:35:42 -05:00
volumes:
- /mnt/docker/mysql/db:/var/lib/mysql
```
2016-07-18 02:35:38 -04:00
2018-01-30 15:35:42 -05:00
#### 3 - Run it
2016-07-18 02:35:38 -04:00
2018-08-09 03:10:54 -04:00
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).
2016-07-17 05:35:13 -04:00
2018-11-30 04:26:05 -05:00
Create a environment file (see docker-compose: /mnt/docker/flarum/flarum.env [here ](https://github.com/mondediefr/docker-flarum/tree/master#2---docker-composeyml ))
2018-11-29 22:00:50 -05:00
```
2018-11-30 04:26:05 -05:00
# vi /mnt/docker/flarum/flarum.env
2018-11-29 22:00:50 -05:00
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
2018-11-30 04:26:05 -05:00
# User admin flarum (environment variable for first installation)
# /!\ admin password must contain at least 8 characters /!\
2018-11-29 22:00:50 -05:00
FLARUM_ADMIN_USER=admin
FLARUM_ADMIN_PASS=xxxxxxxxxx
FLARUM_ADMIN_MAIL=admin@domain.tld
FLARUM_TITLE=Test flarum
```
2018-11-30 04:26:05 -05:00
Run your docker-compose
```sh
2016-07-17 05:35:13 -04:00
docker-compose up -d
```
2018-11-30 04:26:05 -05:00
* :warning: Your admin password must contain at least **8 characters** (FLARUM_ADMIN_PASS).
2018-01-30 15:35:42 -05:00
* 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.
2018-11-29 22:00:50 -05:00
![flarum-home ](http://i.imgur.com/6kH9iTV.png )
2018-12-05 19:52:51 -05:00
### Upgrade to v0.1.0-beta.8.1 from v0.1.0-beta.7.2
2018-01-30 15:35:42 -05:00
2018-11-30 04:26:05 -05:00
:warning: Backup your database, config.php, composer.lock and assets folder
:warning: Disable all 3rd party extensions prior to upgrading in panel admin.
2018-11-29 22:47:57 -05:00
2018-11-30 04:26:05 -05:00
1 - Add `installed.txt` file in assets folder
Make sure to mount your assets folder with the folder /flarum/app/public/assets
2018-11-29 23:24:19 -05:00
2018-11-30 04:26:05 -05:00
```sh
2018-11-29 22:47:57 -05:00
touch /mnt/docker/flarum/assets/installed.txt
2018-11-30 04:26:05 -05:00
chown UID:GID /mnt/docker/flarum/assets/installed.txt
2018-11-29 22:47:57 -05:00
```
2018-11-30 04:26:05 -05:00
2 - Create your own environment file
2018-11-29 22:47:57 -05:00
```
2018-11-30 04:26:05 -05:00
# vi /mnt/docker/flarum/flarum.env
DEBUG=false
FORUM_URL=http://domain.tld
2018-11-29 22:47:57 -05:00
2018-11-30 04:26:05 -05:00
# Database configuration
DB_HOST=mariadb
DB_NAME=flarum
DB_USER=flarum
DB_PASS=xxxxxxxxxx
DB_PREF=flarum_
DB_PORT=3306
2018-01-30 15:35:42 -05:00
2018-11-30 04:26:05 -05:00
# environment variable not required
#FLARUM_ADMIN_USER=admin
#FLARUM_ADMIN_PASS=xxxxxxxxxx
#FLARUM_ADMIN_MAIL=admin@domain.tld
#FLARUM_TITLE=Test flarum
2018-11-29 22:00:50 -05:00
```
2018-11-30 04:26:05 -05:00
```sh
chown UID:GID /mnt/docker/flarum/flarum.env
```
3 - Update your docker-compose file, see an example [here ](https://github.com/mondediefr/docker-flarum/tree/master#2---docker-composeyml )
4 - Pull the last docker images
```sh
2018-12-05 19:52:51 -05:00
docker pull mondedie/docker-flarum:0.1.0-beta.8.1-stable
2018-11-30 04:26:05 -05:00
docker-compose stop flarum
docker-compose rm flarum
2018-11-29 22:47:57 -05:00
docker-compose up -d
2018-11-29 22:00:50 -05:00
```
2018-01-30 15:35:42 -05:00
2018-12-02 11:43:56 -05:00
5 - Updating your database and removing old assets:
2018-11-29 22:00:50 -05:00
2018-11-30 04:26:05 -05:00
```sh
docker exec -ti flarum php /flarum/app/flarum migrate
docker exec -ti flarum php /flarum/app/flarum cache:clear
```
Since the flarum-english extension has been renamed to flarum-lang-english, you'll need to to re-enable it from the admin panel.
After that your upgrade is finish. :tada: :tada:
### Upgrade to v0.1.0-beta.7.2 from v0.1.0-beta.6
2016-10-24 17:23:29 -04:00
:warning: Disable 3rd party extensions prior to upgrading.
2018-11-30 04:26:05 -05:00
```sh
docker pull mondedie/docker-flarum:0.1.0-beta.7.2-stable
2018-11-29 22:47:57 -05:00
docker-compose up -d
2016-10-24 17:23:29 -04:00
```
Navigate to `yourforum.com/admin` , enter your database password and update.
![flarum-update ](https://images.mondedie.fr/udl8j4Ue/PueJSigV.png )
2018-11-30 04:26:05 -05:00
Remove and restart your container:
2016-10-24 17:23:29 -04:00
2018-11-30 04:26:05 -05:00
```sh
2016-10-24 17:23:29 -04:00
docker-compose stop flarum
docker-compose rm flarum
docker-compose up -d
```
2016-07-23 11:46:59 -04:00
### Install custom extensions
2018-11-30 04:26:05 -05:00
**Flarum extensions list :** https://flagrow.io/extensions
2016-07-23 11:46:59 -04:00
#### Install an extension
2018-11-30 04:26:05 -05:00
```sh
2016-10-05 02:40:34 -04:00
docker exec -ti flarum extension require some/extension
2016-07-23 11:46:59 -04:00
```
#### Remove an extension
2018-11-30 04:26:05 -05:00
```sh
2016-10-05 02:40:34 -04:00
docker exec -ti flarum extension remove some/extension
2016-07-23 11:46:59 -04:00
```
#### List all extensions
2018-11-30 04:26:05 -05:00
```sh
2016-10-05 02:40:34 -04:00
docker exec -ti flarum extension list
2016-07-23 11:46:59 -04:00
```
2018-10-29 16:58:21 -04:00
### Custom vhost flarum nginx
2018-11-05 12:53:30 -05:00
File to change the vhost flarum `/etc/nginx/conf.d/custom-vhost-flarum.conf`
2018-10-29 16:58:21 -04:00
To use file custom-vhost-flarum.conf add volume `/etc/nginx/conf.d`
2016-12-02 02:23:11 -05:00
### Custom composer repositories
2018-11-30 04:26:05 -05:00
To use the composer repository system, add your repo name and json representation in `/mnt/docker/flarum/extensions/composer.repositories.txt` :
2016-12-02 02:23:11 -05:00
2016-11-06 03:01:52 -05:00
```
2016-12-02 02:23:11 -05:00
my_private_repo|{"type":"path","url":"extensions/*/"}
my_public_repo|{"type":"vcs","url":"https://github.com/my/repo"}
```
https://getcomposer.org/doc/03-cli.md#modifying-repositories