From 3d03766d59b796556ac27b09f74516bd83274228 Mon Sep 17 00:00:00 2001 From: Hardware Date: Mon, 18 Jul 2016 07:34:39 +0200 Subject: [PATCH] docs(): update readme & dockerfile --- Dockerfile | 24 +++++++++--------------- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++----------- startup | 13 ++++++++++++- 3 files changed, 65 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8dbe1af..de4ac84 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,10 @@ MAINTAINER hardware ARG VERSION=v0.1.0-beta.5 -ENV GID=991 \ - UID=991 \ - DB_HOST=mariadb \ - DB_USER=flarum \ - DB_NAME=flarum +ENV GID=991 UID=991 RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ - && export BUILD_DEPS="git" \ - && apk --no-cache add ${BUILD_DEPS} \ - nginx \ + && apk --no-cache add nginx \ curl \ supervisor \ mariadb-client \ @@ -30,22 +24,22 @@ RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/r php7-session@testing \ && cd /tmp \ && ln -s /usr/bin/php7 /usr/bin/php \ - # && 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 \ + && mv /tmp/composer.phar /usr/bin/composer \ + && chmod +x /usr/bin/composer \ && mkdir -p /flarum/app \ && addgroup -g ${GID} flarum && adduser -h /flarum -s /bin/sh -D -G flarum -u ${UID} flarum \ && chown -R flarum:flarum /flarum \ - && su-exec flarum:flarum git clone https://github.com/hardware/flarum-src.git /flarum/app - # && su-exec flarum:flarum composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \ - # && composer clear-cache \ - # && rm -rf /flarum/.composer + && su-exec flarum:flarum 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 supervisord.conf /etc/supervisor/supervisord.conf COPY startup /usr/local/bin/startup + RUN chmod +x /usr/local/bin/startup VOLUME /flarum/www diff --git a/README.md b/README.md index a60e4ba..36db49f 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Flarum is the next-generation forum software that makes online discussion fun. I ### Environment variables -- **GID** = vmail user id (*optional*, default: 991) -- **UID** = vmail user id (*optional*, default: 991) +- **GID** = Flarum user id (*optional*, default: 991) +- **UID** = Flarum group id (*optional*, default: 991) - **FORUM_URL** = Forum URL (**required**) - **DB_HOST** = MariaDB instance ip/hostname (*optional*, default: mariadb) - **DB_USER** = MariaDB database username (*optional*, default: flarum) @@ -47,6 +47,39 @@ MAIL_PASS = xxxxxxxx * /flarum/www : Flarum directory +### Installation + +``` +docker pull mondedie/flarum + +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 # Optional +GID=991 # Optional + +FORUM_URL=https://forum.domain.tld/ # Required + +DB_HOST=mariadb # Optional +DB_NAME=flarum # Optional +DB_USER=flarum # Optional +DB_PASS=yyyyyyyy # Required + +MAIL_FROM=noreply@domain.tld # Optional +MAIL_HOST=mail.domain.tld # Optional +MAIL_PORT=465 # Optional +MAIL_ENCR=ssl # Optional +MAIL_USER=admin@domain.tld # Optional +MAIL_PASS=xxxxxxxx # Optional +``` + ### Docker-compose #### Docker-compose.yml @@ -55,17 +88,9 @@ MAIL_PASS = xxxxxxxx flarum: image: flarum container_name: mondedie/flarum + env_file: ~/.config/flarum/.env links: - mariadb:mariadb - environment: - - DB_PASS=yyyyyyyy - - FORUM_URL=https://forum.domain.tld/ - - MAIL_FROM=noreply@domain.tld - - MAIL_HOST=mail.domain.tld - - MAIL_PORT=465 - - MAIL_USER=noreply@domain.tld - - MAIL_PASS=zzzzzzzz - - MAIL_ENCR=ssl volumes: - /mnt/docker/flarum:/flarum/www @@ -87,6 +112,10 @@ mariadb: docker-compose up -d ``` +### Reverse proxy example + +https://github.com/mondediefr/flarum/wiki/Reverse-proxy-example + ### Default account * **Username** : *admin* @@ -95,3 +124,7 @@ docker-compose up -d ### Configuration file The main configuration file is located here : **/mnt/docker/flarum/app/config.php** + +### Screenshot + +![flarum](https://i.imgur.com/teqg3od.pngP) diff --git a/startup b/startup index 412bd89..f1807cc 100644 --- a/startup +++ b/startup @@ -1,5 +1,16 @@ #!/bin/sh +# Env variables +export DB_HOST +export DB_USER +export DB_NAME + +# Default values +DB_HOST=${DB_HOST:-mariadb} +DB_USER=${DB_USER:-flarum} +DB_NAME=${DB_NAME:-flarum} + +# Required env variables if [ -z "$DB_PASS" ]; then echo "[ERROR] Mariadb database password must be set !" exit 1 @@ -68,4 +79,4 @@ fi chown -R flarum:flarum /flarum/www # RUN ! -supervisord -c /etc/supervisor/supervisord.conf +exec supervisord -c /etc/supervisor/supervisord.conf