add(): persistent mount point

pull/3/head
Hardware 2016-07-17 16:57:27 +02:00
parent c3f6d010c6
commit 3e16d4d2a3
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
4 changed files with 23 additions and 11 deletions

View File

@ -37,7 +37,8 @@ RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/r
&& 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 composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \
&& composer clear-cache
&& composer clear-cache \
&& rm -rf /flarum/.composer
COPY config.sql /flarum/app/config.sql
COPY nginx.conf /etc/nginx/nginx.conf
@ -46,5 +47,6 @@ COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY startup /usr/local/bin/startup
RUN chmod +x /usr/local/bin/startup
VOLUME /flarum/www
EXPOSE 8080
CMD ["/usr/bin/tini","--","startup"]

View File

@ -45,7 +45,7 @@ MAIL_PASS = xxxxxxxx
### Volume
* /flarum : Flarum directory
* /flarum/www : Flarum directory
### Docker-compose
@ -67,7 +67,7 @@ flarum:
- MAIL_PASS=zzzzzzzz
- MAIL_ENCR=ssl
volumes:
- /mnt/docker/flarum:/flarum
- /mnt/docker/flarum:/flarum/www
mariadb:
image: mariadb:10.1
@ -79,7 +79,6 @@ mariadb:
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=yyyyyyyy
```
#### Run !
@ -95,4 +94,4 @@ docker-compose up -d
### Configuration file
The main configuration file is located here : **/mnt/docker/flarum/config.php**
The main configuration file is located here : **/mnt/docker/flarum/app/config.php**

View File

@ -48,7 +48,7 @@ http {
server {
listen 8080;
root /flarum/app;
root /flarum/www/app;
index index.php;
access_log /var/log/nginx/access.log;

21
startup
View File

@ -10,10 +10,12 @@ if [ -z "$FORUM_URL" ]; then
exit 1
fi
if [ ! -e '/flarum/app/config.php' ]; then
# if no installation was performed before
if [ ! -e '/flarum/www/app/config.php' ]; then
cd /flarum/app/
# Flarum settings
cat > config.yml <<EOF
databaseConfiguration:
driver: mysql
@ -33,7 +35,7 @@ sed -i -e "s|{{ MAIL_FROM }}|${MAIL_FROM}|g" \
-e "s|{{ MAIL_PASS }}|${MAIL_PASS}|g" \
-e "s|{{ MAIL_ENCR }}|${MAIL_ENCR}|g" config.sql
# Fix installer, wait fix in beta 6
# 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
@ -41,7 +43,7 @@ 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
# Set permissions
chown -R flarum:flarum /flarum
chown -R flarum:flarum /flarum/app
# Install flarum (migrate database + assets)
su-exec flarum:flarum php flarum install --file config.yml
@ -49,12 +51,21 @@ su-exec flarum:flarum 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
# Removing installation files
rm -f config.sql config.yml
# Moving sources to the final web directory
cd / && mv /flarum/app /flarum/www
else
echo "[INFO] Flarum already installed, launch app..."
# Removing the source directory
rm -rf /flarum/app
fi
# Set permissions
chown -R flarum:flarum /flarum
# Set web directory permissions
chown -R flarum:flarum /flarum/www
# RUN !
supervisord -c /etc/supervisor/supervisord.conf