feat(): update to beta8
parent
c77de8962e
commit
6b023d1890
|
@ -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
|
|
@ -1,2 +1,3 @@
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
docker
|
docker
|
||||||
|
flarum.env
|
||||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -1,9 +1,9 @@
|
||||||
FROM alpine:3.8
|
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>"
|
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 \
|
ENV GID=991 \
|
||||||
UID=991 \
|
UID=991 \
|
||||||
|
@ -39,9 +39,8 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.8/community" >> /etc/a
|
||||||
php7-tokenizer@community \
|
php7-tokenizer@community \
|
||||||
php7-zip@community \
|
php7-zip@community \
|
||||||
&& cd /tmp \
|
&& cd /tmp \
|
||||||
&& curl -s http://getcomposer.org/installer | php \
|
&& curl -s http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||||
&& mv /tmp/composer.phar /usr/bin/composer \
|
&& chmod +x /usr/local/bin/composer \
|
||||||
&& chmod +x /usr/bin/composer \
|
|
||||||
&& mkdir -p /flarum/app \
|
&& mkdir -p /flarum/app \
|
||||||
&& chown -R $UID:$GID /flarum \
|
&& chown -R $UID:$GID /flarum \
|
||||||
&& COMPOSER_CACHE_DIR="/tmp" su-exec $UID:$GID composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \
|
&& COMPOSER_CACHE_DIR="/tmp" su-exec $UID:$GID composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \
|
||||||
|
@ -50,6 +49,6 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.8/community" >> /etc/a
|
||||||
|
|
||||||
COPY rootfs /
|
COPY rootfs /
|
||||||
RUN chmod +x /usr/local/bin/* /services/*/run /services/.s6-svscan/*
|
RUN chmod +x /usr/local/bin/* /services/*/run /services/.s6-svscan/*
|
||||||
VOLUME /flarum/app/assets /flarum/app/extensions /etc/nginx/conf.d
|
VOLUME /flarum/app/extensions /etc/nginx/conf.d
|
||||||
EXPOSE 8888
|
EXPOSE 8080
|
||||||
CMD ["run.sh"]
|
CMD ["run.sh"]
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -186,7 +186,7 @@ Apache License
|
||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright 2016 Mondedie.fr
|
Copyright 2018 mondediefr/docker-flarum
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|
87
README.md
87
README.md
|
@ -9,22 +9,22 @@ Simple forum software for building great communities. http://flarum.org/
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Lightweight & secure image
|
- Lightweight & secure image
|
||||||
- Based on Alpine Linux with **nginx** and **PHP 7**
|
- Based on Alpine Linux with **nginx** and **PHP 7.2**
|
||||||
- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.7.2)
|
- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.8)
|
||||||
- MySQL/Mariadb driver
|
- MySQL/Mariadb driver
|
||||||
- OPCache extension configured
|
- OPCache extension configured
|
||||||
|
|
||||||
### Build-time variables
|
### Build-time variables
|
||||||
|
|
||||||
- **VERSION** = Version of flarum (default: *v0.1.0-beta.7*)
|
- **VERSION** = Version of flarum (default: *v0.1.0-beta.8*)
|
||||||
|
|
||||||
### Ports
|
### Ports
|
||||||
|
|
||||||
- **8888**
|
- **8080**
|
||||||
|
|
||||||
### Volume
|
### Volume
|
||||||
|
|
||||||
- **/flarum/app/assets** : Flarum assets directory
|
- **/flarum/app/public/assets** : Flarum assets directory
|
||||||
- **/flarum/app/extensions** : Flarum extension directory
|
- **/flarum/app/extensions** : Flarum extension directory
|
||||||
- **/etc/nginx/conf.d** : Nginx location directory
|
- **/etc/nginx/conf.d** : Nginx location directory
|
||||||
|
|
||||||
|
@ -41,18 +41,28 @@ Simple forum software for building great communities. http://flarum.org/
|
||||||
| **DB_NAME** | MariaDB database name | *optional* | flarum
|
| **DB_NAME** | MariaDB database name | *optional* | flarum
|
||||||
| **DB_PASS** | MariaDB database password | **required** | none
|
| **DB_PASS** | MariaDB database password | **required** | none
|
||||||
| **DB_PREF** | Flarum tables prefix | *optional* | 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
|
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
|
||||||
| **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
|
||||||
|
|
||||||
|
### 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
|
## Installation
|
||||||
|
|
||||||
#### 1 - Pull flarum image
|
#### 1 - Pull flarum image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Pull from hub.docker.com :
|
# 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 :
|
# 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
|
||||||
|
@ -65,11 +75,10 @@ version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
flarum:
|
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
|
container_name: flarum
|
||||||
environment:
|
env_file:
|
||||||
- FORUM_URL=http://flarum.local
|
- /mnt/docker/flarum/flarum.env
|
||||||
- DB_PASS=xxxxxx
|
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/docker/flarum/assets:/flarum/app/assets
|
- /mnt/docker/flarum/assets:/flarum/app/assets
|
||||||
- /mnt/docker/flarum/extensions:/flarum/app/extensions
|
- /mnt/docker/flarum/extensions:/flarum/app/extensions
|
||||||
|
@ -78,13 +87,13 @@ services:
|
||||||
- mariadb
|
- mariadb
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.1
|
image: mariadb:10.2
|
||||||
container_name: mariadb
|
container_name: mariadb
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=xxxxxx
|
- MYSQL_ROOT_PASSWORD=xxxxxxxxxx
|
||||||
- MYSQL_DATABASE=flarum
|
- MYSQL_DATABASE=flarum
|
||||||
- MYSQL_USER=flarum
|
- MYSQL_USER=flarum
|
||||||
- MYSQL_PASSWORD=xxxxxx
|
- MYSQL_PASSWORD=xxxxxxxxxx
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/docker/mysql/db:/var/lib/mysql
|
- /mnt/docker/mysql/db:/var/lib/mysql
|
||||||
```
|
```
|
||||||
|
@ -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).
|
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
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Fill out the installation form :
|
* :warning: Your admin password must contain at least **8 characters**.
|
||||||
|
|
||||||
* 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).
|
* 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.
|
* 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)
|
|
||||||
|
|
||||||
Click on **Install Flarum** and after few seconds the forum homepage should appear.
|
|
||||||
|
|
||||||
![flarum-home](http://i.imgur.com/6kH9iTV.png)
|
![flarum-home](http://i.imgur.com/6kH9iTV.png)
|
||||||
|
|
||||||
### Upgrade from v0.1.0-beta.6
|
### Upgrade to v0.1.0-beta.8 from v0.1.0-beta.7
|
||||||
|
|
||||||
|
:warning: Disable 3rd party extensions prior to upgrading.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker pull mondedie/docker-flarum:0.1.0-beta.7.1-stable && docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
and...
|
||||||
|
|
||||||
|
### Upgrade to v0.1.0-beta.7 from v0.1.0-beta.6
|
||||||
|
|
||||||
:warning: Disable 3rd party extensions prior to upgrading.
|
:warning: Disable 3rd party extensions prior to upgrading.
|
||||||
|
|
||||||
|
@ -151,16 +186,6 @@ docker exec -ti flarum extension remove some/extension
|
||||||
docker exec -ti flarum extension list
|
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
|
### Custom vhost flarum nginx
|
||||||
|
|
||||||
File to change the vhost flarum `/etc/nginx/conf.d/custom-vhost-flarum.conf`
|
File to change the vhost flarum `/etc/nginx/conf.d/custom-vhost-flarum.conf`
|
||||||
|
|
|
@ -53,49 +53,17 @@ http {
|
||||||
image/svg+xml;
|
image/svg+xml;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
listen 8080;
|
||||||
listen 8888;
|
|
||||||
root /flarum/app;
|
|
||||||
index index.php;
|
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
|
||||||
|
root /flarum/app/public;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
client_max_body_size <UPLOAD_MAX_SIZE>;
|
client_max_body_size <UPLOAD_MAX_SIZE>;
|
||||||
fastcgi_buffers 64 4K;
|
fastcgi_buffers 64 4K;
|
||||||
|
|
||||||
error_page 403 /403.html;
|
location / {
|
||||||
error_page 404 /404.html;
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assets cache control
|
# Assets cache control
|
||||||
|
@ -133,7 +101,5 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
include /etc/nginx/conf.d/custom-vhost-flarum.conf;
|
include /etc/nginx/conf.d/custom-vhost-flarum.conf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php return array (
|
<?php return array (
|
||||||
'debug' => <DEBUG>,
|
'debug' => <DEBUG>,
|
||||||
'database' =>
|
'database' => array (
|
||||||
array (
|
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'host' => '<DB_HOST>',
|
'host' => '<DB_HOST>',
|
||||||
'database' => '<DB_NAME>',
|
'database' => '<DB_NAME>',
|
||||||
|
@ -13,8 +12,7 @@
|
||||||
'strict' => false,
|
'strict' => false,
|
||||||
),
|
),
|
||||||
'url' => '<FORUM_URL>',
|
'url' => '<FORUM_URL>',
|
||||||
'paths' =>
|
'paths' => array (
|
||||||
array (
|
|
||||||
'api' => 'api',
|
'api' => 'api',
|
||||||
'admin' => 'admin',
|
'admin' => 'admin',
|
||||||
),
|
),
|
||||||
|
|
|
@ -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,16 +9,13 @@ CRED="${CSI}1;31m"
|
||||||
CGREEN="${CSI}1;32m"
|
CGREEN="${CSI}1;32m"
|
||||||
|
|
||||||
# Composer cache dir and packages list paths
|
# Composer cache dir and packages list paths
|
||||||
CACHE_DIR=extensions/.cache
|
CACHE_DIR=/flarum/app/extensions/.cache
|
||||||
LIST_FILE=extensions/list
|
LIST_FILE=/flarum/app/extensions/list
|
||||||
|
|
||||||
# Cmd ARGS
|
# Cmd ARGS
|
||||||
action=$1
|
action=$1
|
||||||
package=$2
|
package=$2
|
||||||
|
|
||||||
# Move to flarum folder
|
|
||||||
cd /flarum/app
|
|
||||||
|
|
||||||
# Create custom extensions cache folder and list file
|
# Create custom extensions cache folder and list file
|
||||||
su-exec $UID:$GID mkdir -p "$CACHE_DIR"
|
su-exec $UID:$GID mkdir -p "$CACHE_DIR"
|
||||||
su-exec $UID:$GID touch "$LIST_FILE"
|
su-exec $UID:$GID touch "$LIST_FILE"
|
||||||
|
@ -55,6 +52,6 @@ case "$action" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
su-exec $UID:$GID php flarum cache:clear
|
su-exec $UID:$GID php /flarum/app/flarum cache:clear
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Env variables
|
|
||||||
export DB_HOST
|
|
||||||
export DB_USER
|
|
||||||
export DB_NAME
|
|
||||||
export DEBUG
|
|
||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
DB_HOST=${DB_HOST:-mariadb}
|
DB_HOST=${DB_HOST:-mariadb}
|
||||||
DB_USER=${DB_USER:-flarum}
|
DB_USER=${DB_USER:-flarum}
|
||||||
DB_NAME=${DB_NAME:-flarum}
|
DB_NAME=${DB_NAME:-flarum}
|
||||||
|
DB_PORT=${DB_PORT:-3306}
|
||||||
|
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}
|
||||||
|
|
||||||
|
@ -24,6 +20,7 @@ if [ -z "$FORUM_URL" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set file config for nginx and php
|
||||||
sed -i "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf
|
sed -i "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf
|
||||||
sed -i "s/<PHP_MEMORY_LIMIT>/$PHP_MEMORY_LIMIT/g" /etc/php7/php-fpm.conf
|
sed -i "s/<PHP_MEMORY_LIMIT>/$PHP_MEMORY_LIMIT/g" /etc/php7/php-fpm.conf
|
||||||
sed -i "s/<OPCACHE_MEMORY_LIMIT>/$OPCACHE_MEMORY_LIMIT/g" /etc/php7/conf.d/00_opcache.ini
|
sed -i "s/<OPCACHE_MEMORY_LIMIT>/$OPCACHE_MEMORY_LIMIT/g" /etc/php7/conf.d/00_opcache.ini
|
||||||
|
@ -31,8 +28,6 @@ sed -i "s/<OPCACHE_MEMORY_LIMIT>/$OPCACHE_MEMORY_LIMIT/g" /etc/php7/conf.d/00_op
|
||||||
# Set permissions
|
# Set permissions
|
||||||
chown -R $UID:$GID /services /var/log /var/lib/nginx
|
chown -R $UID:$GID /services /var/log /var/lib/nginx
|
||||||
|
|
||||||
cd /flarum/app
|
|
||||||
|
|
||||||
# Set log output to STDOUT if wanted (LOG_TO_STDOUT=true)
|
# Set log output to STDOUT if wanted (LOG_TO_STDOUT=true)
|
||||||
if [ "$LOG_TO_STDOUT" = true ]; then
|
if [ "$LOG_TO_STDOUT" = true ]; then
|
||||||
echo "[INFO] Logging to stdout activated"
|
echo "[INFO] Logging to stdout activated"
|
||||||
|
@ -41,21 +36,8 @@ if [ "$LOG_TO_STDOUT" = true ]; then
|
||||||
sed -i "s/.*error_log.*$/error_log = \/dev\/stdout/" /etc/php7/php-fpm.conf
|
sed -i "s/.*error_log.*$/error_log = \/dev\/stdout/" /etc/php7/php-fpm.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable custom errors pages if debug mode is enabled
|
|
||||||
if [ "$DEBUG" = true ]; then
|
|
||||||
echo "[INFO] Debug mode enabled"
|
|
||||||
sed -i '/error_page/ s/^/#/' /etc/nginx/nginx.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Custom HTTP errors pages
|
|
||||||
if [ -d 'assets/errors' ]; then
|
|
||||||
echo "[INFO] Found custom errors pages"
|
|
||||||
rm -rf vendor/flarum/core/error/*
|
|
||||||
ln -s /flarum/app/assets/errors/* vendor/flarum/core/error
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Custom repositories (eg. for privates extensions)
|
# Custom repositories (eg. for privates extensions)
|
||||||
if [ -f 'extensions/composer.repositories.txt' ]; then
|
if [ -f '/flarum/app/extensions/composer.repositories.txt' ]; then
|
||||||
while read line; do
|
while read line; do
|
||||||
repository=$(echo $line | cut -d '|' -f1)
|
repository=$(echo $line | cut -d '|' -f1)
|
||||||
json=$(echo $line | cut -d '|' -f2)
|
json=$(echo $line | cut -d '|' -f2)
|
||||||
|
@ -66,19 +48,15 @@ fi
|
||||||
|
|
||||||
# Custom vhost flarum nginx
|
# Custom vhost flarum nginx
|
||||||
if [ ! -e '/etc/nginx/conf.d/custom-vhost-flarum.conf' ]; then
|
if [ ! -e '/etc/nginx/conf.d/custom-vhost-flarum.conf' ]; then
|
||||||
|
|
||||||
echo '# Example:
|
echo '# Example:
|
||||||
|
|
||||||
# fix for flagrow/sitemap (https://github.com/flagrow/sitemap)
|
# fix for flagrow/sitemap (https://github.com/flagrow/sitemap)
|
||||||
# location = /sitemap.xml {
|
# location = /sitemap.xml {
|
||||||
# try_files $uri $uri/ /index.php?$query_string;
|
# try_files $uri $uri/ /index.php?$query_string;
|
||||||
# }' > /etc/nginx/conf.d/custom-vhost-flarum.conf
|
# }' > /etc/nginx/conf.d/custom-vhost-flarum.conf
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if no installation was performed before
|
# if no installation was performed before
|
||||||
if [ -e 'assets/rev-manifest.json' ]; then
|
if [ -e '/flarum/app/public/assets/install.txt' ]; 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" \
|
||||||
|
@ -87,13 +65,13 @@ if [ -e 'assets/rev-manifest.json' ]; then
|
||||||
-e "s|<DB_USER>|${DB_USER}|g" \
|
-e "s|<DB_USER>|${DB_USER}|g" \
|
||||||
-e "s|<DB_PASS>|${DB_PASS}|g" \
|
-e "s|<DB_PASS>|${DB_PASS}|g" \
|
||||||
-e "s|<DB_PREF>|${DB_PREF}|g" \
|
-e "s|<DB_PREF>|${DB_PREF}|g" \
|
||||||
-e "s|<FORUM_URL>|${FORUM_URL}|g" config.php
|
-e "s|<FORUM_URL>|${FORUM_URL}|g" /flarum/app/config.php
|
||||||
|
|
||||||
su-exec $UID:$GID php flarum cache:clear
|
su-exec $UID:$GID php /flarum/app/flarum cache:clear
|
||||||
|
|
||||||
# Composer cache dir and packages list paths
|
# Composer cache dir and packages list paths
|
||||||
CACHE_DIR=extensions/.cache
|
CACHE_DIR=/flarum/app/extensions/.cache
|
||||||
LIST_FILE=extensions/list
|
LIST_FILE=/flarum/app/extensions/list
|
||||||
|
|
||||||
# Download extra extensions installed with composer wrapup script
|
# Download extra extensions installed with composer wrapup script
|
||||||
if [ -s "$LIST_FILE" ]; then
|
if [ -s "$LIST_FILE" ]; then
|
||||||
|
@ -108,15 +86,35 @@ if [ -e 'assets/rev-manifest.json' ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[INFO] Init done, launch flarum..."
|
echo "[INFO] Init done, launch flarum..."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
echo "[INFO] First launch, installation..."
|
||||||
|
rm -rf /flarum/app/config.php
|
||||||
|
|
||||||
echo "[INFO] First launch, you must install flarum by opening your browser and setting database parameters."
|
if [ -z "$FLARUM_ADMIN_USER" ] || [ -z "$FLARUM_ADMIN_PASS" ] || [ -z "$FLARUM_ADMIN_MAIL" ]; then
|
||||||
rm -rf config.php
|
echo "[ERROR] User admin info of flarum must be set !"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions
|
sed -i -e "s|<DEBUG>|${DEBUG}|g" \
|
||||||
|
-e "s|<FORUM_URL>|${FORUM_URL}|g" \
|
||||||
|
-e "s|<DB_HOST>|${DB_HOST}|g" \
|
||||||
|
-e "s|<DB_NAME>|${DB_NAME}|g" \
|
||||||
|
-e "s|<DB_USER>|${DB_USER}|g" \
|
||||||
|
-e "s|<DB_PASS>|${DB_PASS}|g" \
|
||||||
|
-e "s|<DB_PREF>|${DB_PREF}|g" \
|
||||||
|
-e "s|<DB_PORT>|${DB_PORT}|g" \
|
||||||
|
-e "s|<FLARUM_ADMIN_USER>|${FLARUM_ADMIN_USER}|g" \
|
||||||
|
-e "s|<FLARUM_ADMIN_PASS>|${FLARUM_ADMIN_PASS}|g" \
|
||||||
|
-e "s|<FLARUM_ADMIN_MAIL>|${FLARUM_ADMIN_MAIL}|g" \
|
||||||
|
-e "s|<FLARUM_TITLE>|${FLARUM_TITLE}|g" /flarum/app/config.yml
|
||||||
|
|
||||||
|
php /flarum/app/flarum install --file=/flarum/app/config.yml
|
||||||
|
|
||||||
|
echo "[INFO] End of flarum installation"
|
||||||
|
echo "Done" > /flarum/app/public/assets/install.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set permissions for /flarum folder
|
||||||
find /flarum ! -user $UID -print0 | xargs -0 -r chown $UID:$GID
|
find /flarum ! -user $UID -print0 | xargs -0 -r chown $UID:$GID
|
||||||
find /flarum ! -group $GID -print0 | xargs -0 -r chown $UID:$GID
|
find /flarum ! -group $GID -print0 | xargs -0 -r chown $UID:$GID
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue