From 2b77e9d96dd2ca39bc7173cc4b8105e6250dac6e Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 27 Dec 2018 06:04:49 +0100 Subject: [PATCH] Update Docker files. --- .deploy/docker/apache2.conf | 70 -------------------- .deploy/docker/cronjob.conf | 11 ---- .deploy/docker/docker.env | 6 -- .deploy/docker/entrypoint.sh | 9 ++- .deploy/docker/firefly-iii.conf | 6 -- .deploy/docker/supervisord.conf | 30 --------- Dockerfile | 109 ++++++++++---------------------- composer.lock | 25 ++++---- 8 files changed, 50 insertions(+), 216 deletions(-) delete mode 100644 .deploy/docker/cronjob.conf delete mode 100644 .deploy/docker/docker.env delete mode 100644 .deploy/docker/firefly-iii.conf delete mode 100644 .deploy/docker/supervisord.conf diff --git a/.deploy/docker/apache2.conf b/.deploy/docker/apache2.conf index e00594817e..da5454d87d 100644 --- a/.deploy/docker/apache2.conf +++ b/.deploy/docker/apache2.conf @@ -1,73 +1,3 @@ -# This is the main Apache server configuration file. It contains the -# configuration directives that give the server its instructions. -# See http://httpd.apache.org/docs/2.4/ for detailed information about -# the directives and /usr/share/doc/apache2/README.Debian about Debian specific -# hints. -# -# -# Summary of how the Apache 2 configuration works in Debian: -# The Apache 2 web server configuration in Debian is quite different to -# upstream's suggested way to configure the web server. This is because Debian's -# default Apache2 installation attempts to make adding and removing modules, -# virtual hosts, and extra configuration directives as flexible as possible, in -# order to make automating the changes and administering the server as easy as -# possible. - -# It is split into several files forming the configuration hierarchy outlined -# below, all located in the /etc/apache2/ directory: -# -# /etc/apache2/ -# |-- apache2.conf -# | `-- ports.conf -# |-- mods-enabled -# | |-- *.load -# | `-- *.conf -# |-- conf-enabled -# | `-- *.conf -# `-- sites-enabled -# `-- *.conf -# -# -# * apache2.conf is the main configuration file (this file). It puts the pieces -# together by including all remaining configuration files when starting up the -# web server. -# -# * ports.conf is always included from the main configuration file. It is -# supposed to determine listening ports for incoming connections which can be -# customized anytime. -# -# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ -# directories contain particular configuration snippets which manage modules, -# global configuration fragments, or virtual host configurations, -# respectively. -# -# They are activated by symlinking available configuration files from their -# respective *-available/ counterparts. These should be managed by using our -# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See -# their respective man pages for detailed information. -# -# * The binary is called apache2. Due to the use of environment variables, in -# the default configuration, apache2 needs to be started/stopped with -# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not -# work with the default configuration. - - -# Global configuration -# - -# -# ServerRoot: The top of the directory tree under which the server's -# configuration, error, and log files are kept. -# -# NOTE! If you intend to place this on an NFS (or otherwise network) -# mounted filesystem then please read the Mutex documentation (available -# at ); -# you will save yourself a lot of trouble. -# -# Do NOT add a slash at the end of the directory path. -# -#ServerRoot "/etc/apache2" - # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # diff --git a/.deploy/docker/cronjob.conf b/.deploy/docker/cronjob.conf deleted file mode 100644 index 71aacd84eb..0000000000 --- a/.deploy/docker/cronjob.conf +++ /dev/null @@ -1,11 +0,0 @@ -[program:cron] -command=/usr/sbin/cron -f -L 15 -user=root -autostart=true -autorestart=true -stdout_events_enabled=true -stderr_events_enabled=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -startsecs=10 -startretries=3 diff --git a/.deploy/docker/docker.env b/.deploy/docker/docker.env deleted file mode 100644 index 7ba55b06fe..0000000000 --- a/.deploy/docker/docker.env +++ /dev/null @@ -1,6 +0,0 @@ -FF_APP_ENV=local -FF_APP_KEY=S0m3R@nd0mString0f32Ch@rsEx@ct1y -FF_DB_HOST= -FF_DB_NAME= -FF_DB_USER= -FF_DB_PASSWORD= \ No newline at end of file diff --git a/.deploy/docker/entrypoint.sh b/.deploy/docker/entrypoint.sh index e00eb3164e..a7062180d9 100755 --- a/.deploy/docker/entrypoint.sh +++ b/.deploy/docker/entrypoint.sh @@ -1,13 +1,11 @@ #!/bin/bash # make sure the correct directories exists (suggested by @chrif): -mkdir -p $FIREFLY_PATH/storage/app mkdir -p $FIREFLY_PATH/storage/app/public mkdir -p $FIREFLY_PATH/storage/build mkdir -p $FIREFLY_PATH/storage/database mkdir -p $FIREFLY_PATH/storage/debugbar mkdir -p $FIREFLY_PATH/storage/export -mkdir -p $FIREFLY_PATH/storage/framework/cache mkdir -p $FIREFLY_PATH/storage/framework/cache/data mkdir -p $FIREFLY_PATH/storage/framework/sessions mkdir -p $FIREFLY_PATH/storage/framework/testing @@ -22,8 +20,8 @@ then fi # make sure we own the volumes: -chown -R www-data:www-data -R $FIREFLY_PATH/storage -chmod -R 775 $FIREFLY_PATH/storage +chown -R www-data:www-data -R $FIREFLY_PATH +chmod -R 775 $FIREFLY_PATH # remove any lingering files that may break upgrades: rm -f $FIREFLY_PATH/storage/logs/laravel.log @@ -39,4 +37,5 @@ php artisan passport:install php artisan cache:clear php artisan firefly:instructions install -exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf --nodaemon \ No newline at end of file + +exec /bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND" \ No newline at end of file diff --git a/.deploy/docker/firefly-iii.conf b/.deploy/docker/firefly-iii.conf deleted file mode 100644 index 5ee1c2eb28..0000000000 --- a/.deploy/docker/firefly-iii.conf +++ /dev/null @@ -1,6 +0,0 @@ -[program:apache2] -command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND" -stdout_events_enabled=true -stderr_events_enabled=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 \ No newline at end of file diff --git a/.deploy/docker/supervisord.conf b/.deploy/docker/supervisord.conf deleted file mode 100644 index 479120ed38..0000000000 --- a/.deploy/docker/supervisord.conf +++ /dev/null @@ -1,30 +0,0 @@ -# supervisor config file -# Adapted from the config file distributed with the supervisor package on Debian -# Jessie - -# Enable supervisord in non-daemon mode. Disable the logfile as we receive -# log messages via stdout/err. Set up the child process log directory in case -# the user doesn't set logging to stdout/err. -[supervisord] -nodaemon = true -logfile = NONE -pidfile = /var/run/supervisord.pid -childlogdir = /var/log/supervisor -loglevel=debug - -# Enable supervisorctl via RPC interface over Unix socket -[unix_http_server] -file = /var/run/supervisor.sock -chmod = 0700 - -[rpcinterface:supervisor] -supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - -[supervisorctl] -serverurl = unix:///var/run/supervisor.sock - - -# Include conf files for child processes -# Debian/Ubuntu packages use /etc/supervisor/conf.d -[include] -files = /etc/supervisor/conf.d/*.conf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a31ac9354d..5f161759ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,89 +1,46 @@ FROM php:7.2-apache -# If building on a RPi, use --build-arg cores=3 to use all cores when compiling -# to speed up the image build -ARG CORES -ENV CORES ${CORES:-1} - -ENV FIREFLY_PATH=/var/www/firefly-iii/ CURL_VERSION=7.60.0 OPENSSL_VERSION=1.1.1-pre6 COMPOSER_ALLOW_SUPERUSER=1 -LABEL version="1.2" maintainer="thegrumpydictator@gmail.com" - -# install packages -RUN apt-get update -y && \ - apt-get install -y --no-install-recommends libcurl4-openssl-dev \ - zlib1g-dev \ - libjpeg62-turbo-dev \ - wget \ - libpng-dev \ - libicu-dev \ - libldap2-dev \ - libedit-dev \ - libtidy-dev \ - libxml2-dev \ - unzip \ - libsqlite3-dev \ - nano \ - curl \ - openssl \ - libpq-dev \ - libbz2-dev \ - gettext-base \ - cron \ - rsyslog \ - supervisor \ - locales && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \ - docker-php-ext-install ldap - - -# Make sure that libcurl is using the newer curl libaries -#RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/00-curl.conf && ldconfig - -# Mimic the Debian/Ubuntu config file structure for supervisor -COPY .deploy/docker/supervisord.conf /etc/supervisor/supervisord.conf -RUN mkdir -p /etc/supervisor/conf.d /var/log/supervisor - -# copy Firefly III supervisor conf file. -COPY ./.deploy/docker/firefly-iii.conf /etc/supervisor/conf.d/firefly-iii.conf - -# copy cron job supervisor conf file. -COPY ./.deploy/docker/cronjob.conf /etc/supervisor/conf.d/cronjob.conf - -# copy ca certs to correct location -COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem - -# test crons added via crontab -RUN echo "0 3 * * * /usr/local/bin/php /var/www/firefly-iii/artisan firefly:cron" | crontab - -#RUN (crontab -l ; echo "*/1 * * * * free >> /var/www/firefly-iii/public/cron.html") 2>&1 | crontab - - -# Install PHP exentions, install composer, update languages. -RUN docker-php-ext-install -j$(nproc) gd intl tidy zip curl bcmath pdo_mysql bz2 pdo_pgsql && \ - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ - echo "en_US.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\n\n" > /etc/locale.gen && locale-gen - -# copy Apache config to correct spot. -COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf - -# Enable apache mod rewrite and mod ssl.. -RUN a2enmod rewrite && a2enmod ssl +ENV FIREFLY_PATH=/var/www/firefly-iii CURL_VERSION=7.60.0 OPENSSL_VERSION=1.1.1-pre6 COMPOSER_ALLOW_SUPERUSER=1 +LABEL version="1.3" maintainer="thegrumpydictator@gmail.com" # Create volumes VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload -# Enable default site (Firefly III) -COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf +# Install some stuff +RUN apt-get update && apt-get install -y libpng-dev \ + libicu-dev \ + unzip \ + gettext-base \ + libldap2-dev \ + libpq-dev \ + locales && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* -# Make sure we own Firefly III directory -RUN chown -R www-data:www-data /var/www && chmod -R 775 $FIREFLY_PATH/storage - -# Copy in Firefly Source +# Copy in Firefly III source WORKDIR $FIREFLY_PATH ADD . $FIREFLY_PATH -# Fix the link to curl: -#RUN rm -rf /usr/local/lib/libcurl.so.4 && ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0 /usr/local/lib/libcurl.so.4 +# copy ca certs to correct location +COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem + +# copy Apache config to correct spot. +COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf + +# Enable default site (Firefly III) +COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf + +# Make sure we own Firefly III directory and enable rewrite + SSL +RUN chown -R www-data:www-data /var/www && chmod -R 775 $FIREFLY_PATH/storage && a2enmod rewrite && a2enmod ssl + +# Install PHP exentions, install composer, update languages. +RUN docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl + +# Install Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Update language data. +RUN echo "de_DE.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\n\n" > /etc/locale.gen && locale-gen # Run composer RUN composer install --prefer-dist --no-dev --no-scripts --no-suggest diff --git a/composer.lock b/composer.lock index ef8ccc9302..ec69dc151b 100644 --- a/composer.lock +++ b/composer.lock @@ -6474,12 +6474,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "3557820049b07ea0fd088e4151ec200f474b58de" + "reference": "ac7afcafc8d63cd3d4ae4929291bb2fec9a4b688" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/3557820049b07ea0fd088e4151ec200f474b58de", - "reference": "3557820049b07ea0fd088e4151ec200f474b58de", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/ac7afcafc8d63cd3d4ae4929291bb2fec9a4b688", + "reference": "ac7afcafc8d63cd3d4ae4929291bb2fec9a4b688", "shasum": "" }, "conflict": { @@ -6576,7 +6576,7 @@ "silverstripe/userforms": "<3", "simple-updates/phpwhois": "<=1", "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", - "simplesamlphp/simplesamlphp": "<1.15.2", + "simplesamlphp/simplesamlphp": "<1.16.3", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "slim/slim": "<2.6", "smarty/smarty": "<3.1.33", @@ -6610,7 +6610,7 @@ "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", "tecnickcom/tcpdf": "<6.2.22", "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3", + "thelia/thelia": ">=2.1.0-beta1,<2.1.3|>=2.1,<2.1.2", "theonedemon/phpwhois": "<=4.2.5", "titon/framework": ">=0,<9.9.99", "truckersmp/phpwhois": "<=4.3.1", @@ -6668,7 +6668,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2018-12-14T13:12:19+00:00" + "time": "2018-12-25T09:41:12+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -7590,20 +7590,21 @@ }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -7636,7 +7637,7 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2018-12-25T11:19:39+00:00" } ], "aliases": [],