docs(): update readme & dockerfile

pull/3/head
Hardware 2016-07-18 07:34:39 +02:00
parent f33e22d234
commit 3d03766d59
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
3 changed files with 65 additions and 27 deletions

View File

@ -4,16 +4,10 @@ MAINTAINER hardware <https://github.com/hardware>
ARG VERSION=v0.1.0-beta.5 ARG VERSION=v0.1.0-beta.5
ENV GID=991 \ ENV GID=991 UID=991
UID=991 \
DB_HOST=mariadb \
DB_USER=flarum \
DB_NAME=flarum
RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& export BUILD_DEPS="git" \ && apk --no-cache add nginx \
&& apk --no-cache add ${BUILD_DEPS} \
nginx \
curl \ curl \
supervisor \ supervisor \
mariadb-client \ mariadb-client \
@ -30,22 +24,22 @@ RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/r
php7-session@testing \ php7-session@testing \
&& cd /tmp \ && cd /tmp \
&& ln -s /usr/bin/php7 /usr/bin/php \ && ln -s /usr/bin/php7 /usr/bin/php \
# && curl -s http://getcomposer.org/installer | php \ && curl -s http://getcomposer.org/installer | php \
# && mv /tmp/composer.phar /usr/bin/composer \ && mv /tmp/composer.phar /usr/bin/composer \
# && chmod +x /usr/bin/composer \ && chmod +x /usr/bin/composer \
&& mkdir -p /flarum/app \ && mkdir -p /flarum/app \
&& addgroup -g ${GID} flarum && adduser -h /flarum -s /bin/sh -D -G flarum -u ${UID} flarum \ && addgroup -g ${GID} flarum && adduser -h /flarum -s /bin/sh -D -G flarum -u ${UID} flarum \
&& chown -R flarum:flarum /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 \
# && su-exec flarum:flarum composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \ && composer clear-cache \
# && composer clear-cache \ && rm -rf /flarum/.composer /var/cache/apk/*
# && rm -rf /flarum/.composer
COPY config.sql /flarum/app/config.sql COPY config.sql /flarum/app/config.sql
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
COPY php-fpm.conf /etc/php7/php-fpm.conf COPY php-fpm.conf /etc/php7/php-fpm.conf
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY startup /usr/local/bin/startup COPY startup /usr/local/bin/startup
RUN chmod +x /usr/local/bin/startup RUN chmod +x /usr/local/bin/startup
VOLUME /flarum/www VOLUME /flarum/www

View File

@ -18,8 +18,8 @@ Flarum is the next-generation forum software that makes online discussion fun. I
### Environment variables ### Environment variables
- **GID** = vmail user id (*optional*, default: 991) - **GID** = Flarum user id (*optional*, default: 991)
- **UID** = vmail user id (*optional*, default: 991) - **UID** = Flarum group id (*optional*, default: 991)
- **FORUM_URL** = Forum URL (**required**) - **FORUM_URL** = Forum URL (**required**)
- **DB_HOST** = MariaDB instance ip/hostname (*optional*, default: mariadb) - **DB_HOST** = MariaDB instance ip/hostname (*optional*, default: mariadb)
- **DB_USER** = MariaDB database username (*optional*, default: flarum) - **DB_USER** = MariaDB database username (*optional*, default: flarum)
@ -47,6 +47,39 @@ MAIL_PASS = xxxxxxxx
* /flarum/www : Flarum directory * /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
#### Docker-compose.yml #### Docker-compose.yml
@ -55,17 +88,9 @@ MAIL_PASS = xxxxxxxx
flarum: flarum:
image: flarum image: flarum
container_name: mondedie/flarum container_name: mondedie/flarum
env_file: ~/.config/flarum/.env
links: links:
- mariadb:mariadb - 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: volumes:
- /mnt/docker/flarum:/flarum/www - /mnt/docker/flarum:/flarum/www
@ -87,6 +112,10 @@ mariadb:
docker-compose up -d docker-compose up -d
``` ```
### Reverse proxy example
https://github.com/mondediefr/flarum/wiki/Reverse-proxy-example
### Default account ### Default account
* **Username** : *admin* * **Username** : *admin*
@ -95,3 +124,7 @@ docker-compose up -d
### Configuration file ### Configuration file
The main configuration file is located here : **/mnt/docker/flarum/app/config.php** The main configuration file is located here : **/mnt/docker/flarum/app/config.php**
### Screenshot
![flarum](https://i.imgur.com/teqg3od.pngP)

13
startup
View File

@ -1,5 +1,16 @@
#!/bin/sh #!/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 if [ -z "$DB_PASS" ]; then
echo "[ERROR] Mariadb database password must be set !" echo "[ERROR] Mariadb database password must be set !"
exit 1 exit 1
@ -68,4 +79,4 @@ fi
chown -R flarum:flarum /flarum/www chown -R flarum:flarum /flarum/www
# RUN ! # RUN !
supervisord -c /etc/supervisor/supervisord.conf exec supervisord -c /etc/supervisor/supervisord.conf