From eb6f07d27dd9cfbdfbf3a701fdd83bfaadbaa5ee Mon Sep 17 00:00:00 2001 From: Yuriy Chegel Date: Sat, 17 Jun 2017 13:29:02 +0300 Subject: [PATCH 01/16] update to verision 1.5.3 --- Changelog.md | 3 +++ Dockerfile | 4 ++-- README.md | 18 +++++++++--------- VERSION | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Changelog.md b/Changelog.md index fd231ac..ad4f102 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,6 @@ +**1.5.3** +- invoiceplane: upgrade to 1.5.3 + **1.4.10** - invoiceplane: security update to 1.4.10 diff --git a/Dockerfile b/Dockerfile index 318f9e9..d6eab66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM sameersbn/ubuntu:14.04.20170123 MAINTAINER sameer@damagehead.com ENV PHP_VERSION=7.0 \ - INVOICEPLANE_VERSION=1.4.10 \ + INVOICEPLANE_VERSION=1.5.3 \ INVOICEPLANE_USER=www-data \ INVOICEPLANE_INSTALL_DIR=/var/www/invoiceplane \ INVOICEPLANE_DATA_DIR=/var/lib/invoiceplane \ @@ -20,7 +20,7 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 14AA40EC0831756 php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-mysql \ php${PHP_VERSION}-gd php${PHP_VERSION}-json php${PHP_VERSION}-mbstring \ php${PHP_VERSION}-mcrypt php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc \ - mysql-client nginx gettext-base git \ + php${PHP_VERSION}-curl mysql-client nginx gettext-base git \ && sed -i 's/^listen = .*/listen = 0.0.0.0:9000/' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf \ && phpenmod -v ALL mcrypt \ && wget -nv "https://getcomposer.org/composer.phar" -O /usr/local/bin/composer \ diff --git a/README.md b/README.md index 6a20022..c1b27dd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/invoiceplane/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/invoiceplane) -# sameersbn/invoiceplane:1.4.10-2 +# sameersbn/invoiceplane:1.5.3 - [Introduction](#introduction) - [Contributing](#contributing) @@ -50,7 +50,7 @@ Automated builds of the image are available on [Dockerhub](https://hub.docker.co > **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/invoiceplane) ```bash -docker pull sameersbn/invoiceplane:1.4.10-2 +docker pull sameersbn/invoiceplane:1.5.3 ``` Alternatively you can build the image yourself. @@ -93,7 +93,7 @@ docker run --name invoiceplane -itd --restart=always \ --env 'INVOICEPLANE_FQDN=invoice.example.com' \ --env 'INVOICEPLANE_TIMEZONE=Asia/Kolkata' \ --volume /srv/docker/invoiceplane/invoiceplane:/var/lib/invoiceplane \ - sameersbn/invoiceplane:1.4.10-2 app:invoiceplane + sameersbn/invoiceplane:1.5.3 app:invoiceplane ``` Step 3. Launch a NGINX frontend container @@ -103,7 +103,7 @@ docker run --name invoiceplane-nginx -itd --restart=always \ --link invoiceplane:php-fpm \ --volumes-from invoiceplane \ --publish 10080:80 \ - sameersbn/invoiceplane:1.4.10-2 app:nginx + sameersbn/invoiceplane:1.5.3 app:nginx ``` Point your browser to [http://invoice.example.com:10080/setup](http://invoice.example.com:10080/setup) to complete the setup. @@ -137,7 +137,7 @@ Relaunch the container with the `app:backup:create` argument. ```bash docker run --name invoiceplane -it --rm [OPTIONS] \ - sameersbn/invoiceplane:1.4.10-2 app:backup:create + sameersbn/invoiceplane:1.5.3 app:backup:create ``` The backup will be created in the `backups/` folder of the [Persistent](#persistence) volume. You can change the location using the `INVOICEPLANE_BACKUPS_DIR` configuration parameter. @@ -166,7 +166,7 @@ Relaunch the container with the `app:backup:restore` argument. Ensure you launch ```bash docker run --name invoiceplane -it --rm [OPTIONS] \ - sameersbn/invoiceplane:1.4.10-2 app:backup:restore + sameersbn/invoiceplane:1.5.3 app:backup:restore ``` A list of existing backups will be displayed. Select a backup you wish to restore. @@ -175,7 +175,7 @@ To avoid this interaction you can specify the backup filename using the `BACKUP` ```bash docker run --name invoiceplane -it --rm [OPTIONS] \ - sameersbn/invoiceplane:1.4.10-2 app:backup:restore BACKUP=1417624827_invoiceplane_backup.tar + sameersbn/invoiceplane:1.5.3 app:backup:restore BACKUP=1417624827_invoiceplane_backup.tar ``` ## Upgrading @@ -185,7 +185,7 @@ To upgrade to newer releases: 1. Download the updated Docker image: ```bash - docker pull sameersbn/invoiceplane:1.4.10-2 + docker pull sameersbn/invoiceplane:1.5.3 ``` 2. Stop the currently running image: @@ -205,7 +205,7 @@ To upgrade to newer releases: ```bash docker run -name invoiceplane -itd \ [OPTIONS] \ - sameersbn/invoiceplane:1.4.10-2 + sameersbn/invoiceplane:1.5.3 ``` Point your browser to [http://invoice.example.com:10080/setup](http://invoice.example.com:10080/setup) to complete the upgrade. diff --git a/VERSION b/VERSION index 2b8fc45..8af85be 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.10-2 +1.5.3 From 752c500ac41d46701983f8b4bae1521858bcfdf3 Mon Sep 17 00:00:00 2001 From: Yuriy Chegel Date: Mon, 19 Jun 2017 22:56:19 +0300 Subject: [PATCH 02/16] updated docker image version to 1.5.3 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 53cd121..f9ed0ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: invoiceplane: restart: always - image: sameersbn/invoiceplane:1.4.10-2 + image: sameersbn/invoiceplane:1.5.3 command: app:invoiceplane environment: - DEBUG=false @@ -34,7 +34,7 @@ services: nginx: restart: always - image: sameersbn/invoiceplane:1.4.10-2 + image: sameersbn/invoiceplane:1.5.3 command: app:nginx environment: - INVOICEPLANE_PHP_FPM_HOST=invoiceplane From dc18241c06bf478e6df09a9a21c4aee0aeb7dd95 Mon Sep 17 00:00:00 2001 From: Yuriy Chegel Date: Sat, 22 Jul 2017 19:09:42 +0300 Subject: [PATCH 03/16] added nodejs, assets compilation and ipconfig.php copy --- Dockerfile | 9 ++++++--- assets/build/install.sh | 7 +++++++ docker-compose.yml | 2 +- entrypoint.sh | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6eab66..55fe980 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,14 +19,17 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 14AA40EC0831756 && DEBIAN_FRONTEND=noninteractive apt-get install -y \ php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-mysql \ php${PHP_VERSION}-gd php${PHP_VERSION}-json php${PHP_VERSION}-mbstring \ - php${PHP_VERSION}-mcrypt php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc \ + php${PHP_VERSION}-mcrypt php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc \ php${PHP_VERSION}-curl mysql-client nginx gettext-base git \ + nano curl \ && sed -i 's/^listen = .*/listen = 0.0.0.0:9000/' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf \ && phpenmod -v ALL mcrypt \ && wget -nv "https://getcomposer.org/composer.phar" -O /usr/local/bin/composer \ && chmod +x /usr/local/bin/composer \ - && rm -rf /var/lib/apt/lists/* - + && rm -rf /var/lib/apt/lists/* \ + && curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - \ + && apt-get install -y nodejs + COPY assets/build/ ${INVOICEPLANE_BUILD_DIR}/ RUN bash ${INVOICEPLANE_BUILD_DIR}/install.sh diff --git a/assets/build/install.sh b/assets/build/install.sh index a06a7b7..3d63094 100644 --- a/assets/build/install.sh +++ b/assets/build/install.sh @@ -18,6 +18,11 @@ echo "Installing composer dependencies..." cd ${INVOICEPLANE_INSTALL_DIR} composer install --prefer-source --no-interaction --no-dev -o +echo "Building assets..." +npm install +npm install -g grunt-cli +grunt build + ( echo "default_charset = 'UTF-8'" echo "output_buffering = off" @@ -30,6 +35,7 @@ mkdir -p /run/php/ rm -rf /etc/nginx/sites-enabled/default # set directory permissions +cp ${INVOICEPLANE_INSTALL_DIR}/ipconfig.php.example ${INVOICEPLANE_INSTALL_DIR}/ipconfig.php find ${INVOICEPLANE_INSTALL_DIR}/ -type f -print0 | xargs -0 chmod 0640 find ${INVOICEPLANE_INSTALL_DIR}/ -type d -print0 | xargs -0 chmod 0750 chown -R root:${INVOICEPLANE_USER} ${INVOICEPLANE_INSTALL_DIR}/ @@ -37,3 +43,4 @@ chown -R ${INVOICEPLANE_USER}: ${INVOICEPLANE_INSTALL_DIR}/application/config/ chown -R ${INVOICEPLANE_USER}: ${INVOICEPLANE_INSTALL_DIR}/application/logs/ chown root:${INVOICEPLANE_USER} ${INVOICEPLANE_INSTALL_DIR}/.user.ini chmod 0644 ${INVOICEPLANE_INSTALL_DIR}/.user.ini +chmod 0660 ${INVOICEPLANE_INSTALL_DIR}/ipconfig.php diff --git a/docker-compose.yml b/docker-compose.yml index f9ed0ee..f820c2b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: - DB_PASS=password - DB_NAME=invoiceplane_db - - INVOICEPLANE_URL=http://invoice.example.com:10080 + - INVOICEPLANE_URL=http://localhost:10080 - INVOICEPLANE_BACKUPS_EXPIRY=0 depends_on: - mysql diff --git a/entrypoint.sh b/entrypoint.sh index 30e61ef..64abbd2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,8 +12,8 @@ case ${1} in case ${1} in app:invoiceplane) configure_invoiceplane - echo "Starting InvoicePlane php5-fpm..." - exec $(which php-fpm${PHP_VERSION}) -F + echo "Starting InvoicePlane php"${PHP_VERSION}"-fpm..." + exec $(which php-fpm${PHP_VERSION}) -F ;; app:nginx) configure_nginx From 0b1df58a1c6c7cf7f9362e1c86d8317c38e5be7d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Hoelt Date: Wed, 18 Oct 2017 11:04:50 +0300 Subject: [PATCH 04/16] Add PROXY_IPS setting --- assets/runtime/functions | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 01925ed..d6673fa 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -4,6 +4,7 @@ source ${INVOICEPLANE_RUNTIME_DIR}/env-defaults INVOICEPLANE_TEMPLATES_DIR=${INVOICEPLANE_RUNTIME_DIR}/config INVOICEPLANE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/index.php +INVOICEPLANE_CODEIGNITER_CONFIG=${INVOICEPLANE_INSTALL_DIR}/application/config/config.php INVOICEPLANE_DATABASE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/application/config/database.php INVOICEPLANE_NGINX_CONFIG=/etc/nginx/sites-enabled/InvoicePlane.conf @@ -166,9 +167,11 @@ invoiceplane_finalize_php_fpm_parameters() { INVOICEPLANE_PHP_FPM_PORT=${INVOICEPLANE_PHP_FPM_PORT:-9000} } -invoiceplane_configure_url() { +invoiceplane_configure_settings() { echo "Configuring InvoicePlane::URL" sed -i "s|^define('IP_URL', '.*');|define('IP_URL', '"${INVOICEPLANE_URL}"');|" ${INVOICEPLANE_CONFIG} + echo "Configuring InvoicePlane::Proxy" + sed -i "s|config\['proxy_ips'\] = '';|config['proxy_ips'] = '"${PROXY_IPS}"';|" ${INVOICEPLANE_CODEIGNITER_CONFIG} } invoiceplane_configure_database() { @@ -355,7 +358,7 @@ initialize_system() { configure_invoiceplane() { echo "Configuring InvoicePlane..." - invoiceplane_configure_url + invoiceplane_configure_settings invoiceplane_configure_database invoiceplane_configure_timezone } From efaf2d2b7e549a8819b25324699b5051855cacd0 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Fri, 20 Oct 2017 16:12:18 +0530 Subject: [PATCH 05/16] download and install release zip --- .gitignore | 2 +- Dockerfile | 15 +++++---------- assets/build/install.sh | 21 ++++++--------------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 9881fec..c4c4ffc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -*.tar.* +*.zip diff --git a/Dockerfile b/Dockerfile index 55fe980..cdc93c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,17 +19,12 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 14AA40EC0831756 && DEBIAN_FRONTEND=noninteractive apt-get install -y \ php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-mysql \ php${PHP_VERSION}-gd php${PHP_VERSION}-json php${PHP_VERSION}-mbstring \ - php${PHP_VERSION}-mcrypt php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc \ - php${PHP_VERSION}-curl mysql-client nginx gettext-base git \ - nano curl \ + php${PHP_VERSION}-mcrypt php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc \ + mysql-client nginx gettext-base git \ && sed -i 's/^listen = .*/listen = 0.0.0.0:9000/' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf \ && phpenmod -v ALL mcrypt \ - && wget -nv "https://getcomposer.org/composer.phar" -O /usr/local/bin/composer \ - && chmod +x /usr/local/bin/composer \ - && rm -rf /var/lib/apt/lists/* \ - && curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - \ - && apt-get install -y nodejs - + && rm -rf /var/lib/apt/lists/* + COPY assets/build/ ${INVOICEPLANE_BUILD_DIR}/ RUN bash ${INVOICEPLANE_BUILD_DIR}/install.sh @@ -43,4 +38,4 @@ WORKDIR ${INVOICEPLANE_INSTALL_DIR} ENTRYPOINT ["/sbin/entrypoint.sh"] CMD ["app:invoiceplane"] -EXPOSE 9000 +EXPOSE 80/tcp 9000/tcp diff --git a/assets/build/install.sh b/assets/build/install.sh index 3d63094..dda171f 100644 --- a/assets/build/install.sh +++ b/assets/build/install.sh @@ -1,28 +1,19 @@ #!/bin/bash set -e -mkdir -p ${INVOICEPLANE_INSTALL_DIR} - -if [[ ! -f ${INVOICEPLANE_BUILD_DIR}/InvoicePlane-${INVOICEPLANE_VERSION}.tar.gz ]]; then +if [[ ! -f ${INVOICEPLANE_BUILD_DIR}/v${INVOICEPLANE_VERSION}.zip ]]; then echo "Downloading InvoicePlane ${INVOICEPLANE_VERSION}..." - wget -nv "https://github.com/InvoicePlane/InvoicePlane/archive/v${INVOICEPLANE_VERSION}.tar.gz" \ - -O ${INVOICEPLANE_BUILD_DIR}/InvoicePlane-${INVOICEPLANE_VERSION}.tar.gz + wget -nv "https://github.com/InvoicePlane/InvoicePlane/releases/download/v${INVOICEPLANE_VERSION}/v${INVOICEPLANE_VERSION}.zip" \ + -O ${INVOICEPLANE_BUILD_DIR}/v${INVOICEPLANE_VERSION}.zip fi echo "Extracting InvoicePlane ${INVOICEPLANE_VERSION}..." -tar -xf ${INVOICEPLANE_BUILD_DIR}/InvoicePlane-${INVOICEPLANE_VERSION}.tar.gz --strip=1 -C ${INVOICEPLANE_INSTALL_DIR} +unzip ${INVOICEPLANE_BUILD_DIR}/v${INVOICEPLANE_VERSION}.zip +mv ip ${INVOICEPLANE_INSTALL_DIR} + mv ${INVOICEPLANE_INSTALL_DIR}/uploads ${INVOICEPLANE_INSTALL_DIR}/uploads.template rm -rf ${INVOICEPLANE_BUILD_DIR}/InvoicePlane-${INVOICEPLANE_VERSION}.tar.gz -echo "Installing composer dependencies..." -cd ${INVOICEPLANE_INSTALL_DIR} -composer install --prefer-source --no-interaction --no-dev -o - -echo "Building assets..." -npm install -npm install -g grunt-cli -grunt build - ( echo "default_charset = 'UTF-8'" echo "output_buffering = off" From f510caa5840f9febfb41cc8dd030cde4b0eef391 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Fri, 20 Oct 2017 17:06:54 +0530 Subject: [PATCH 06/16] configuration file has changed to `ipconfig.php` --- .../runtime/config/invoiceplane/database.php | 70 ------------------- .../runtime/config/invoiceplane/ipconfig.php | 47 +++++++++++++ assets/runtime/functions | 11 ++- 3 files changed, 52 insertions(+), 76 deletions(-) delete mode 100644 assets/runtime/config/invoiceplane/database.php create mode 100644 assets/runtime/config/invoiceplane/ipconfig.php diff --git a/assets/runtime/config/invoiceplane/database.php b/assets/runtime/config/invoiceplane/database.php deleted file mode 100644 index 287e207..0000000 --- a/assets/runtime/config/invoiceplane/database.php +++ /dev/null @@ -1,70 +0,0 @@ - +# InvoicePlane Configuration File + +# Set your URL without trailing slash here, e.g. http://your-domain.com +# If you use a subdomain, use http://subdomain.your-domain.com +# If you use a subfolder, use http://your-domain.com/subfolder +IP_URL={{INVOICEPLANE_URL}} + +# Having problems? Enable debug by changing the value to 'true' to enable advanced logging +ENABLE_DEBUG=false + +# Set this setting to 'true' if you want to disable the setup for security purposes +DISABLE_SETUP=false + +# To remove index.php from the URL, set this setting to 'true'. +# Please notice the additional instructions in the htaccess file! +REMOVE_INDEXPHP=false + +# These database settings are set during the initial setup +DB_HOSTNAME={{DB_HOST}} +DB_USERNAME={{DB_USER}} +DB_PASSWORD={{DB_PASS}} +DB_DATABASE={{DB_NAME}} +DB_PORT={{DB_PORT}} + +# If you want to be logged out after closing your browser window, set this setting to 0 (ZERO). +# The number represents the amount of minutes after that IP will automatically log out users, +# the default is 10 days. +SESS_EXPIRATION=864000 + +# Enable the deletion of invoices +ENABLE_INVOICE_DELETION=false + +# Disable the read-only mode for invoices +DISABLE_READ_ONLY=false + +## +## DO NOT CHANGE ANY CONFIGURATION VALUES BELOW THIS LINE! +## ======================================================= +## + +# This key is automatically set after the first setup. Do not change it manually! +ENCRYPTION_KEY= +ENCRYPTION_CIPHER=AES-256 + +# Set to true after the initial setup +SETUP_COMPLETED=false diff --git a/assets/runtime/functions b/assets/runtime/functions index 01925ed..c5a089d 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -3,7 +3,7 @@ set -e source ${INVOICEPLANE_RUNTIME_DIR}/env-defaults INVOICEPLANE_TEMPLATES_DIR=${INVOICEPLANE_RUNTIME_DIR}/config -INVOICEPLANE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/index.php +INVOICEPLANE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/ipconfig.php INVOICEPLANE_DATABASE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/application/config/database.php INVOICEPLANE_NGINX_CONFIG=/etc/nginx/sites-enabled/InvoicePlane.conf @@ -93,7 +93,7 @@ update_template() { invoiceplane_get_database_param() { local key=${1?missing argument} - exec_as_invoiceplane sed -n -e "s/\([ ]*\)\(\$db\['default'\]\['${key}'\] = '\)\([^ ']*\)\(.*\)$/\3/p" ${INVOICEPLANE_DATABASE_CONFIG} + exec_as_invoiceplane sed -n -e "s/\([ ]*\)\('dbdriver' => '\)\([^ ']*\)\(.*\)$/\3/p" ${INVOICEPLANE_DATABASE_CONFIG} } invoiceplane_finalize_database_parameters() { @@ -168,15 +168,14 @@ invoiceplane_finalize_php_fpm_parameters() { invoiceplane_configure_url() { echo "Configuring InvoicePlane::URL" - sed -i "s|^define('IP_URL', '.*');|define('IP_URL', '"${INVOICEPLANE_URL}"');|" ${INVOICEPLANE_CONFIG} + update_template ${INVOICEPLANE_CONFIG} INVOICEPLANE_URL } invoiceplane_configure_database() { echo -n "Configuring InvoicePlane::database" invoiceplane_finalize_database_parameters invoiceplane_check_database_connection - - update_template ${INVOICEPLANE_DATABASE_CONFIG} \ + update_template ${INVOICEPLANE_CONFIG} \ DB_HOST \ DB_PORT \ DB_USER \ @@ -340,7 +339,7 @@ initialize_datadir() { install_configuration_templates() { echo "Installing configuration templates..." - install_template ${INVOICEPLANE_USER}: invoiceplane/database.php ${INVOICEPLANE_DATABASE_CONFIG} 0640 + install_template ${INVOICEPLANE_USER}: invoiceplane/ipconfig.php ${INVOICEPLANE_CONFIG} 0640 if [[ -d /etc/nginx/sites-enabled && ! -f ${INVOICEPLANE_NGINX_CONFIG} ]]; then install_template root: nginx/InvoicePlane.conf ${INVOICEPLANE_NGINX_CONFIG} 0644 From 4c27577842a34a5106be1a879bca0e40cc6bb684 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Fri, 20 Oct 2017 21:57:50 +0530 Subject: [PATCH 07/16] removed `invoiceplane_get_database_param` function --- assets/runtime/functions | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index c5a089d..763cb1d 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -91,11 +91,6 @@ update_template() { rm -f ${tmp_file} } -invoiceplane_get_database_param() { - local key=${1?missing argument} - exec_as_invoiceplane sed -n -e "s/\([ ]*\)\('dbdriver' => '\)\([^ ']*\)\(.*\)$/\3/p" ${INVOICEPLANE_DATABASE_CONFIG} -} - invoiceplane_finalize_database_parameters() { # is a mysql container linked? if [[ -n ${MYSQL_PORT_3306_TCP_ADDR} ]]; then @@ -219,7 +214,7 @@ backup_dump_information() { ( echo "info:" echo " invoiceplane_version: ${INVOICEPLANE_VERSION}" - echo " database_adapter: $(invoiceplane_get_database_param dbdriver)" + echo " database_adapter: mysqli" echo " created_at: $(date)" ) > ${INVOICEPLANE_BACKUPS_DIR}/backup_information.yml chown ${INVOICEPLANE_USER}: ${INVOICEPLANE_BACKUPS_DIR}/backup_information.yml From 77abeeb34828e09abe8152dee6de949f4e196b91 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Fri, 20 Oct 2017 23:07:55 +0530 Subject: [PATCH 08/16] save `ipconfig.php` in data volume --- .../runtime/config/invoiceplane/ipconfig.php | 12 +++--- assets/runtime/functions | 42 +++++++++++++++---- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/assets/runtime/config/invoiceplane/ipconfig.php b/assets/runtime/config/invoiceplane/ipconfig.php index a74507f..94ce3bd 100644 --- a/assets/runtime/config/invoiceplane/ipconfig.php +++ b/assets/runtime/config/invoiceplane/ipconfig.php @@ -4,7 +4,7 @@ # Set your URL without trailing slash here, e.g. http://your-domain.com # If you use a subdomain, use http://subdomain.your-domain.com # If you use a subfolder, use http://your-domain.com/subfolder -IP_URL={{INVOICEPLANE_URL}} +IP_URL= # Having problems? Enable debug by changing the value to 'true' to enable advanced logging ENABLE_DEBUG=false @@ -17,11 +17,11 @@ REMOVE_INDEXPHP=false # These database settings are set during the initial setup -DB_HOSTNAME={{DB_HOST}} -DB_USERNAME={{DB_USER}} -DB_PASSWORD={{DB_PASS}} -DB_DATABASE={{DB_NAME}} -DB_PORT={{DB_PORT}} +DB_HOSTNAME= +DB_USERNAME= +DB_PASSWORD= +DB_DATABASE= +DB_PORT= # If you want to be logged out after closing your browser window, set this setting to 0 (ZERO). # The number represents the amount of minutes after that IP will automatically log out users, diff --git a/assets/runtime/functions b/assets/runtime/functions index 763cb1d..f37d27c 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -3,7 +3,7 @@ set -e source ${INVOICEPLANE_RUNTIME_DIR}/env-defaults INVOICEPLANE_TEMPLATES_DIR=${INVOICEPLANE_RUNTIME_DIR}/config -INVOICEPLANE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/ipconfig.php +INVOICEPLANE_CONFIG=${INVOICEPLANE_DATA_DIR}/ipconfig.php INVOICEPLANE_DATABASE_CONFIG=${INVOICEPLANE_INSTALL_DIR}/application/config/database.php INVOICEPLANE_NGINX_CONFIG=/etc/nginx/sites-enabled/InvoicePlane.conf @@ -91,6 +91,28 @@ update_template() { rm -f ${tmp_file} } +invoiceplane_get_param() { + local key=${1?missing argument} + exec_as_invoiceplane sed -n -e "s/^\([ ]*\)\(${key}[ ]*=[ ]*\)\([^ ]*\)\(.*\)$/\3/p" ${INVOICEPLANE_CONFIG} +} + +invoiceplane_set_param() { + local key=${1?missing argument} + local value=${2?missing argument} + local hide=${3} + if [[ -n ${value} ]]; then + local current=$(invoiceplane_get_param ${key}) + if [[ "${current}" != "${value}" ]]; then + case ${hide} in + true) echo "‣ Setting ipconfig.php parameter: ${key}" ;; + *) echo "‣ Setting ipconfig.php parameter: ${key} = '${value}'" ;; + esac + value="$(echo "${value}" | sed 's|[&]|\\&|g')" + exec_as_invoiceplane sed -i "s|^${key}=.*|${key}=${value}|" ${INVOICEPLANE_CONFIG} + fi + fi +} + invoiceplane_finalize_database_parameters() { # is a mysql container linked? if [[ -n ${MYSQL_PORT_3306_TCP_ADDR} ]]; then @@ -163,19 +185,18 @@ invoiceplane_finalize_php_fpm_parameters() { invoiceplane_configure_url() { echo "Configuring InvoicePlane::URL" - update_template ${INVOICEPLANE_CONFIG} INVOICEPLANE_URL + invoiceplane_set_param "IP_URL" "${INVOICEPLANE_URL}" } invoiceplane_configure_database() { echo -n "Configuring InvoicePlane::database" invoiceplane_finalize_database_parameters invoiceplane_check_database_connection - update_template ${INVOICEPLANE_CONFIG} \ - DB_HOST \ - DB_PORT \ - DB_USER \ - DB_PASS \ - DB_NAME + invoiceplane_set_param "DB_HOSTNAME" "${DB_HOST}" + invoiceplane_set_param "DB_PORT" "${DB_PORT}" + invoiceplane_set_param "DB_USERNAME" "${DB_USER}" + invoiceplane_set_param "DB_PASSWORD" "${DB_PASS}" "true" + invoiceplane_set_param "DB_DATABASE" "${DB_NAME}" } invoiceplane_configure_timezone() { @@ -334,7 +355,10 @@ initialize_datadir() { install_configuration_templates() { echo "Installing configuration templates..." - install_template ${INVOICEPLANE_USER}: invoiceplane/ipconfig.php ${INVOICEPLANE_CONFIG} 0640 + if [[ ! -f ${INVOICEPLANE_CONFIG} ]]; then + install_template ${INVOICEPLANE_USER}: invoiceplane/ipconfig.php ${INVOICEPLANE_CONFIG} 0640 + fi + ln -sf ${INVOICEPLANE_CONFIG} ${INVOICEPLANE_INSTALL_DIR}/ipconfig.php if [[ -d /etc/nginx/sites-enabled && ! -f ${INVOICEPLANE_NGINX_CONFIG} ]]; then install_template root: nginx/InvoicePlane.conf ${INVOICEPLANE_NGINX_CONFIG} 0644 From 7580e4b41b60e850c1f2924c8b6518d1c9db45ef Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 10:25:28 +0530 Subject: [PATCH 09/16] fix permissions of `vendor/mpdf/mpdf/tmp/`, fixes PDF generation --- assets/build/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/build/install.sh b/assets/build/install.sh index dda171f..f961caa 100644 --- a/assets/build/install.sh +++ b/assets/build/install.sh @@ -35,3 +35,4 @@ chown -R ${INVOICEPLANE_USER}: ${INVOICEPLANE_INSTALL_DIR}/application/logs/ chown root:${INVOICEPLANE_USER} ${INVOICEPLANE_INSTALL_DIR}/.user.ini chmod 0644 ${INVOICEPLANE_INSTALL_DIR}/.user.ini chmod 0660 ${INVOICEPLANE_INSTALL_DIR}/ipconfig.php +chmod 1777 ${INVOICEPLANE_INSTALL_DIR}/vendor/mpdf/mpdf/tmp/ From af36babe04d5dbbb4ee620528d5f6be97669b7ea Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 10:29:03 +0530 Subject: [PATCH 10/16] enable invoiceplane debugging if `DEBUG=true` --- assets/runtime/functions | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assets/runtime/functions b/assets/runtime/functions index f37d27c..a56795f 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -183,6 +183,14 @@ invoiceplane_finalize_php_fpm_parameters() { INVOICEPLANE_PHP_FPM_PORT=${INVOICEPLANE_PHP_FPM_PORT:-9000} } +invoiceplane_configure_debugging() { + echo "Configuring InvoicePlane::Debugging" + case $DEBUG in + true) invoiceplane_set_param "ENABLE_DEBUG" "true" ;; + *) invoiceplane_set_param "ENABLE_DEBUG" "false" ;; + esac +} + invoiceplane_configure_url() { echo "Configuring InvoicePlane::URL" invoiceplane_set_param "IP_URL" "${INVOICEPLANE_URL}" @@ -373,6 +381,7 @@ initialize_system() { configure_invoiceplane() { echo "Configuring InvoicePlane..." + invoiceplane_configure_debugging invoiceplane_configure_url invoiceplane_configure_database invoiceplane_configure_timezone From ce851fb2660ab6b860f0bec5c0e0af9d495eb799 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 10:29:28 +0530 Subject: [PATCH 11/16] upgrade to `1.5.4` --- Changelog.md | 3 +++ Dockerfile | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index ad4f102..5df489b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,6 @@ +**latest** +- invoiceplane: upgrade to 1.5.4 + **1.5.3** - invoiceplane: upgrade to 1.5.3 diff --git a/Dockerfile b/Dockerfile index cdc93c9..a399216 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM sameersbn/ubuntu:14.04.20170123 MAINTAINER sameer@damagehead.com ENV PHP_VERSION=7.0 \ - INVOICEPLANE_VERSION=1.5.3 \ + INVOICEPLANE_VERSION=1.5.4 \ INVOICEPLANE_USER=www-data \ INVOICEPLANE_INSTALL_DIR=/var/www/invoiceplane \ INVOICEPLANE_DATA_DIR=/var/lib/invoiceplane \ From 57ac75085caa32d385026796ddba83754fe120a6 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 10:30:13 +0530 Subject: [PATCH 12/16] upgrade to `sameersbn/ubuntu:14.04.20170724` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a399216..f5c0c21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM sameersbn/ubuntu:14.04.20170123 +FROM sameersbn/ubuntu:14.04.20170724 MAINTAINER sameer@damagehead.com ENV PHP_VERSION=7.0 \ From a1ce47fc5e6cf66e8d6cf23f206735a5ea7906df Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 11:09:19 +0530 Subject: [PATCH 13/16] entrypoint.sh: cleaned up trailing whilespaces --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 64abbd2..c04b3d0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,8 +12,8 @@ case ${1} in case ${1} in app:invoiceplane) configure_invoiceplane - echo "Starting InvoicePlane php"${PHP_VERSION}"-fpm..." - exec $(which php-fpm${PHP_VERSION}) -F + echo "Starting InvoicePlane php"${PHP_VERSION}"-fpm..." + exec $(which php-fpm${PHP_VERSION}) -F ;; app:nginx) configure_nginx From 630dae2a8391c2f6ed1adf14e513917c0dd36c1f Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 11:45:42 +0530 Subject: [PATCH 14/16] upgrade to php 7.1 runtime --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f5c0c21..652e1d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM sameersbn/ubuntu:14.04.20170724 MAINTAINER sameer@damagehead.com -ENV PHP_VERSION=7.0 \ +ENV PHP_VERSION=7.1 \ INVOICEPLANE_VERSION=1.5.4 \ INVOICEPLANE_USER=www-data \ INVOICEPLANE_INSTALL_DIR=/var/www/invoiceplane \ From 7d2cce9b711546530b3925e1329273bd25c4ed58 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sat, 21 Oct 2017 11:49:31 +0530 Subject: [PATCH 15/16] release 1.5.4 --- Changelog.md | 2 +- README.md | 18 +++++++++--------- VERSION | 2 +- docker-compose.yml | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Changelog.md b/Changelog.md index 5df489b..3511b56 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,4 @@ -**latest** +**1.5.4** - invoiceplane: upgrade to 1.5.4 **1.5.3** diff --git a/README.md b/README.md index c1b27dd..043ac70 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/invoiceplane/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/invoiceplane) -# sameersbn/invoiceplane:1.5.3 +# sameersbn/invoiceplane:1.5.4 - [Introduction](#introduction) - [Contributing](#contributing) @@ -50,7 +50,7 @@ Automated builds of the image are available on [Dockerhub](https://hub.docker.co > **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/invoiceplane) ```bash -docker pull sameersbn/invoiceplane:1.5.3 +docker pull sameersbn/invoiceplane:1.5.4 ``` Alternatively you can build the image yourself. @@ -93,7 +93,7 @@ docker run --name invoiceplane -itd --restart=always \ --env 'INVOICEPLANE_FQDN=invoice.example.com' \ --env 'INVOICEPLANE_TIMEZONE=Asia/Kolkata' \ --volume /srv/docker/invoiceplane/invoiceplane:/var/lib/invoiceplane \ - sameersbn/invoiceplane:1.5.3 app:invoiceplane + sameersbn/invoiceplane:1.5.4 app:invoiceplane ``` Step 3. Launch a NGINX frontend container @@ -103,7 +103,7 @@ docker run --name invoiceplane-nginx -itd --restart=always \ --link invoiceplane:php-fpm \ --volumes-from invoiceplane \ --publish 10080:80 \ - sameersbn/invoiceplane:1.5.3 app:nginx + sameersbn/invoiceplane:1.5.4 app:nginx ``` Point your browser to [http://invoice.example.com:10080/setup](http://invoice.example.com:10080/setup) to complete the setup. @@ -137,7 +137,7 @@ Relaunch the container with the `app:backup:create` argument. ```bash docker run --name invoiceplane -it --rm [OPTIONS] \ - sameersbn/invoiceplane:1.5.3 app:backup:create + sameersbn/invoiceplane:1.5.4 app:backup:create ``` The backup will be created in the `backups/` folder of the [Persistent](#persistence) volume. You can change the location using the `INVOICEPLANE_BACKUPS_DIR` configuration parameter. @@ -166,7 +166,7 @@ Relaunch the container with the `app:backup:restore` argument. Ensure you launch ```bash docker run --name invoiceplane -it --rm [OPTIONS] \ - sameersbn/invoiceplane:1.5.3 app:backup:restore + sameersbn/invoiceplane:1.5.4 app:backup:restore ``` A list of existing backups will be displayed. Select a backup you wish to restore. @@ -175,7 +175,7 @@ To avoid this interaction you can specify the backup filename using the `BACKUP` ```bash docker run --name invoiceplane -it --rm [OPTIONS] \ - sameersbn/invoiceplane:1.5.3 app:backup:restore BACKUP=1417624827_invoiceplane_backup.tar + sameersbn/invoiceplane:1.5.4 app:backup:restore BACKUP=1417624827_invoiceplane_backup.tar ``` ## Upgrading @@ -185,7 +185,7 @@ To upgrade to newer releases: 1. Download the updated Docker image: ```bash - docker pull sameersbn/invoiceplane:1.5.3 + docker pull sameersbn/invoiceplane:1.5.4 ``` 2. Stop the currently running image: @@ -205,7 +205,7 @@ To upgrade to newer releases: ```bash docker run -name invoiceplane -itd \ [OPTIONS] \ - sameersbn/invoiceplane:1.5.3 + sameersbn/invoiceplane:1.5.4 ``` Point your browser to [http://invoice.example.com:10080/setup](http://invoice.example.com:10080/setup) to complete the upgrade. diff --git a/VERSION b/VERSION index 8af85be..94fe62c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.3 +1.5.4 diff --git a/docker-compose.yml b/docker-compose.yml index f820c2b..7020ba5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: invoiceplane: restart: always - image: sameersbn/invoiceplane:1.5.3 + image: sameersbn/invoiceplane:1.5.4 command: app:invoiceplane environment: - DEBUG=false @@ -34,7 +34,7 @@ services: nginx: restart: always - image: sameersbn/invoiceplane:1.5.3 + image: sameersbn/invoiceplane:1.5.4 command: app:nginx environment: - INVOICEPLANE_PHP_FPM_HOST=invoiceplane From 54908c39a6cec51e41b2d9f1be8c9092104236f1 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sun, 22 Oct 2017 10:50:18 +0530 Subject: [PATCH 16/16] renamed param `PROXY_IPS` to `INVOICEPLANE_PROXY_IPS` --- Changelog.md | 2 +- assets/runtime/functions | 2 +- docker-compose.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index f235a4b..e62133e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,6 @@ **1.5.4** - invoiceplane: upgrade to 1.5.4 -- add `PROXY_IPS` to configure reverse proxy ips +- add `INVOICEPLANE_PROXY_IPS` to configure reverse proxy ips **1.5.3** - invoiceplane: upgrade to 1.5.3 diff --git a/assets/runtime/functions b/assets/runtime/functions index cb20a7d..98e7cda 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -199,7 +199,7 @@ invoiceplane_configure_url() { invoiceplane_configure_proxy_ips() { echo "Configuring InvoicePlane::Proxy IPS" - sed -i "s|config\['proxy_ips'\] = '';|config['proxy_ips'] = '"${PROXY_IPS}"';|" ${INVOICEPLANE_CODEIGNITER_CONFIG} + sed -i "s|^\$config\['proxy_ips'\][ ]*=.*;|\$config\['proxy_ips'\] = '"$INVOICEPLANE_PROXY_IPS"';|" ${INVOICEPLANE_CODEIGNITER_CONFIG} } invoiceplane_configure_database() { diff --git a/docker-compose.yml b/docker-compose.yml index 7020ba5..42366df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ services: - DB_NAME=invoiceplane_db - INVOICEPLANE_URL=http://localhost:10080 + - INVOICEPLANE_PROXY_IPS= - INVOICEPLANE_BACKUPS_EXPIRY=0 depends_on: - mysql