chore(): bump to beta 6

pull/3/head
Hardware 2016-10-23 23:01:02 +02:00
parent 34d12f8b66
commit 9c1c71d07a
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
5 changed files with 51 additions and 134 deletions

View File

@ -1,8 +1,8 @@
FROM alpine:3.4
FROM alpine:edge
MAINTAINER xataz <https://github.com/xataz>
MAINTAINER hardware <https://github.com/hardware>
ARG VERSION=v0.1.0-beta.5
ARG VERSION=v0.1.0-beta.6
ENV GID=991 UID=991
@ -12,7 +12,6 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a
s6 \
su-exec \
curl \
mariadb-client \
php7-phar@commuedge \
php7-fpm@commuedge \
php7-curl@commuedge \
@ -32,14 +31,14 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a
&& chmod +x /usr/bin/composer \
&& mkdir -p /flarum/app \
&& chown -R $UID:$GID /flarum \
&& 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 \
&& composer clear-cache \
&& rm -rf /flarum/.composer /var/cache/apk/*
COPY config.sql /flarum/app/config.sql
COPY nginx.conf /etc/nginx/nginx.conf
COPY php-fpm.conf /etc/php7/php-fpm.conf
COPY opcache.ini /etc/php7/conf.d/00_opcache.ini
COPY config.php /flarum/app/config.php
COPY extension /usr/local/bin/extension
COPY s6.d /etc/s6.d
COPY run.sh /usr/local/bin/run.sh

View File

@ -9,14 +9,14 @@ Flarum is the next-generation forum software that makes online discussion fun. I
### Features
- Lightweight & secure image
- Based on Alpine Linux 3.4 with **nginx** and **PHP 7**
- Latest Flarum Beta (v0.1.0-beta.5)
- Based on Alpine Linux with **nginx** and **PHP 7**
- Latest Flarum Beta (v0.1.0-beta.6)
- MySQL/Mariadb driver
- OPCache extension configured
### Build-time variables
- **VERSION** = Version of flarum (default: *v0.1.0-beta.5*)
- **VERSION** = Version of flarum (default: *v0.1.0-beta.6*)
### Ports
@ -38,12 +38,6 @@ Flarum is the next-generation forum software that makes online discussion fun. I
| **DB_USER** | MariaDB database username | *optional* | flarum
| **DB_NAME** | MariaDB database name | *optional* | flarum
| **DB_PASS** | MariaDB database password | **required** | none
| **MAIL_FROM** | Mail 'from address' | *optional* | none
| **MAIL_HOST** | Mail server FQDN | *optional* | none
| **MAIL_PORT** | Mail server smtp port | *optional* | none
| **MAIL_ENCR** | Encryption protocol, tls (587) or ssl (465) | *optional* | none
| **MAIL_USER** | Username | *optional* | none
| **MAIL_PASS** | Password | *optional* | none
## Installation
@ -53,41 +47,7 @@ Flarum is the next-generation forum software that makes online discussion fun. I
docker pull mondedie/flarum
```
#### 2 - Create environment file
```
mkdir -p ~/.config/flarum
touch ~/.config/flarum/.env
chmod 600 ~/.config/flarum/.env
```
Create an `.env` file with your environment variables :
```bash
# vim ~/.config/flarum/.env
# UID=991
# GID=991
# URL required
FORUM_URL=https://forum.domain.tld/
# DB_HOST=mariadb
# DB_NAME=flarum
# DB_USER=flarum
# Database password required
DB_PASS=yyyyyyyy
# MAIL_FROM=noreply@domain.tld
# MAIL_HOST=mail.domain.tld
# MAIL_PORT=465
# MAIL_ENCR=ssl
# MAIL_USER=admin@domain.tld
# MAIL_PASS=xxxxxxxx
```
#### 3 - Docker-compose.yml
#### 2 - Docker-compose.yml
Adapt to your needs :
@ -95,9 +55,11 @@ Adapt to your needs :
flarum:
image: mondedie/flarum
container_name: flarum
env_file: ~/.config/flarum/.env
links:
- mariadb:mariadb
environment:
- FORUM_URL=https://forum.domain.tld
- DB_PASS=xxxxxxxx
volumes:
- /mnt/docker/flarum:/flarum/app/assets
@ -110,7 +72,7 @@ mariadb:
- MYSQL_ROOT_PASSWORD=xxxxxxxx
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=yyyyyyyy
- MYSQL_PASSWORD=xxxxxxxx
```
#### 4 - Reverse proxy setup
@ -125,11 +87,6 @@ You can now run Flarum :
docker-compose up -d
```
### Default account
* **Username** : *admin*
* **Password** : *password*
### Install custom extensions
**Flarum extensions list :** https://packagist.org/search/?q=flarum-ext

21
config.php Normal file
View File

@ -0,0 +1,21 @@
<?php return array (
'debug' => <DEBUG>,
'database' =>
array (
'driver' => 'mysql',
'host' => '<DB_HOST>',
'database' => '<DB_NAME>',
'username' => '<DB_USER>',
'password' => '<DB_PASS>',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '<DB_PREF>',
'strict' => false,
),
'url' => '<FORUM_URL>',
'paths' =>
array (
'api' => 'api',
'admin' => 'admin',
),
);

View File

@ -1,9 +0,0 @@
INSERT INTO `{{ DB_NAME }}`.`settings`(`key`,`value`) VALUES
('mail_host','{{ MAIL_HOST }}'),
('mail_port','{{ MAIL_PORT }}'),
('mail_username','{{ MAIL_USER }}'),
('mail_password','{{ MAIL_PASS }}'),
('mail_encryption','{{ MAIL_ENCR }}');
UPDATE `{{ DB_NAME }}`.`settings` SET `value`='smtp' WHERE `key`='mail_driver';
UPDATE `{{ DB_NAME }}`.`settings` SET `value`='{{ MAIL_FROM }}' WHERE `key`='mail_from';

87
run.sh
View File

@ -26,76 +26,27 @@ fi
# Set permissions
chown -R $UID:$GID /flarum /etc/nginx /etc/php7 /var/log /var/lib/nginx /tmp /etc/s6.d
cd /flarum/app/
# Installation settings
cat > config.yml <<EOF
databaseConfiguration:
driver: mysql
host: ${DB_HOST}
database: ${DB_NAME}
username: ${DB_USER}
password: ${DB_PASS}
baseUrl: ${FORUM_URL}
EOF
# Installer problem, wait fix in beta 6
# PHP Fatal error: Uncaught ReflectionException: Class flarum.config does not
# exist in /flarum/vendor/illuminate/container/Container.php
# https://github.com/flarum/core/commit/7192c4391bee006ccc2de3db6caa89803d72d130
sed -i -e 's|InfoCommand::class,||g' \
-e "s|\['config' => \$app->make('flarum.config')\]|['config' => \$app->isInstalled() ? \$app->make('flarum.config') : []]|g" vendor/flarum/core/src/Console/Server.php
cd /flarum/app
# if no installation was performed before
if [ ! -e 'assets/rev-manifest.json' ]; then
echo "[INFO] First launch, installing flarum..."
# Mail settings
sed -i -e "s|{{ DB_NAME }}|${DB_NAME}|g" \
-e "s|{{ MAIL_FROM }}|${MAIL_FROM}|g" \
-e "s|{{ MAIL_HOST }}|${MAIL_HOST}|g" \
-e "s|{{ MAIL_PORT }}|${MAIL_PORT}|g" \
-e "s|{{ MAIL_USER }}|${MAIL_USER}|g" \
-e "s|{{ MAIL_PASS }}|${MAIL_PASS}|g" \
-e "s|{{ MAIL_ENCR }}|${MAIL_ENCR}|g" config.sql
# Install flarum
su-exec $UID:$GID php flarum install --file config.yml
# Define flarum settings in database
mysql -h"${DB_HOST}" -u"${DB_USER}" -p"${DB_PASS}" "${DB_NAME}" < config.sql
echo "[INFO] Installation done, launch flarum..."
else
if [ -e 'assets/rev-manifest.json' ]; then
echo "[INFO] Flarum already installed, init app..."
# Disable already done steps during installation
# ----------------------------------------------
#
# See : flarum/core/src/Install/Console/DefaultsDataProvider.php
# flarum/core/src/Install/Console/InstallCommand.php
#
# runMigrations() = Database migration (Flarum\Database\Migrator)
# writeSettings() = Writing default flarum settings (Flarum\Settings\SettingsRepositoryInterface)
# seedGroups() = Create default groups
# seedPermissions() = Create default permissions
# createAdminUser() = Create default admin user
sed -i -e '/$this->runMigrations();/ s/^/#/' \
-e '/$this->writeSettings();/ s/^/#/' \
-e '/$this->seedGroups();/ s/^/#/' \
-e '/$this->seedPermissions();/ s/^/#/' \
-e '/$this->createAdminUser();/ s/^/#/' vendor/flarum/core/src/Install/Console/InstallCommand.php
sed -i -e "s|<DEBUG>|${DEBUG}|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|<FORUM_URL>|${FORUM_URL}|g" config.php
# Init flarum (without steps above)
su-exec $UID:$GID php flarum install --file config.yml
su-exec $UID:$GID php flarum migrate
su-exec $UID:$GID php flarum cache:clear
# Composer cache dir and packages list paths
CACHE_DIR=/flarum/app/assets/.extensions
LIST_FILE=assets/.extensions/list
CACHE_DIR=assets/.extensions
LIST_FILE=$CACHE_DIR/list
# Download extra extensions installed with composer wrapup script
if [ -s "$LIST_FILE" ]; then
@ -105,19 +56,17 @@ else
COMPOSER_CACHE_DIR="$CACHE_DIR" su-exec $UID:$GID composer require "$extension"
done < "$LIST_FILE"
echo "[INFO] Install extra bundled extensions. DONE."
else
echo "[INFO] No installed extensions"
fi
echo "[INFO] Init done, launch flarum..."
fi
else
# Set flarum debug mode
if [ -f "config.php" ]; then
sed -i "s|\('debug' =>\) .*|\1 ${DEBUG},|" config.php
fi
echo "[INFO] First launch, you must install flarum by opening your browser and setting database parameters."
# Removing installation files
rm -f config.sql config.yml
fi
# Set permissions
chown -R $UID:$GID /flarum