From 4f51b7d15727d88f1917cc8f8bd564ebb1cbde71 Mon Sep 17 00:00:00 2001 From: Jorge Marin Date: Fri, 2 Sep 2016 00:54:02 +0200 Subject: [PATCH] Add support for more environment variables, bump versions and improve several files (#25) * Add support for more environment variables and improve README.md * Add a new configurable env variable * Bump versions * Fix typos in README * Minor improvements to several files --- bitnami/wordpress/Dockerfile | 6 +-- bitnami/wordpress/README.md | 38 +++++++++++++++++++ bitnami/wordpress/docker-compose.yml | 18 ++++----- bitnami/wordpress/rootfs/apache-inputs.json | 4 ++ bitnami/wordpress/rootfs/app-entrypoint.sh | 11 +++++- .../wordpress/rootfs/wordpress-inputs.json | 9 +++++ 6 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 bitnami/wordpress/rootfs/apache-inputs.json diff --git a/bitnami/wordpress/Dockerfile b/bitnami/wordpress/Dockerfile index 49813106897f..acfe6da85867 100644 --- a/bitnami/wordpress/Dockerfile +++ b/bitnami/wordpress/Dockerfile @@ -3,17 +3,17 @@ FROM gcr.io/stacksmith-images/ubuntu:14.04-r8 MAINTAINER Bitnami ENV BITNAMI_APP_NAME=wordpress \ - BITNAMI_IMAGE_VERSION=4.6-r0 \ + BITNAMI_IMAGE_VERSION=4.6-r1 \ PATH=/opt/bitnami/php/bin:/opt/bitnami/mysql/bin/:$PATH # Additional modules required +RUN bitnami-pkg unpack apache-2.4.23-2 --checksum 80605a5b1a3103cefc125cb150cc08a017702d0c1e3ea5f806540ad91c77cf38 RUN bitnami-pkg install php-5.6.25-0 --checksum f0e8d07d155abdb5d6843931d3ffbf9b4208fff248c409444fdd5a8e3a3da01d -RUN bitnami-pkg unpack apache-2.4.23-1 --checksum c8d14a79313c5e47dbf617e9a55e88ff91d8361357386bab520aabccd35c59d8 RUN bitnami-pkg install libphp-5.6.21-2 --checksum 83d19b750b627fa70ed9613504089732897a48e1a7d304d8d73dec61a727b222 RUN bitnami-pkg install mysql-client-10.1.13-4 --checksum 14b45c91dd78b37f0f2366712cbe9bfdf2cb674769435611955191a65dbf4976 # Install wordpress -RUN bitnami-pkg unpack wordpress-4.6-0 --checksum a2c4039e0dd22b1bed6947c2e651f11b472c9852de70db38cf66d5cea71da6bf +RUN bitnami-pkg unpack wordpress-4.6-1 --checksum 8e809d1719bbef52b89dd909350702f463d2e0c8afc2bb46642f4b0552dc51a2 COPY rootfs / diff --git a/bitnami/wordpress/README.md b/bitnami/wordpress/README.md index 15e5104d947a..12661b77adbf 100644 --- a/bitnami/wordpress/README.md +++ b/bitnami/wordpress/README.md @@ -213,6 +213,9 @@ The WordPress instance can be customized by specifying environment variables on - `WORDPRESS_USERNAME`: WordPress application username. Default: **user** - `WORDPRESS_PASSWORD`: WordPress application password. Default: **bitnami** - `WORDPRESS_EMAIL`: WordPress application email. Default: **user@example.com** +- `WORDPRESS_FIRST_NAME`: WordPress user first name. Default: **FirstName** +- `WORDPRESS_LAST_NAME`: WordPress user last name. Default: **LastName** +- `WORDPRESS_BLOG_NAME`: WordPress blog name. Default: **User's blog** - `MARIADB_USER`: Root user for the MariaDB database. Default: **root** - `MARIADB_PASSWORD`: Root password for the MariaDB. - `MARIADB_HOST`: Hostname for MariaDB server. Default: **mariadb** @@ -261,6 +264,41 @@ $ docker run -d --name wordpress -p 80:80 -p 443:443 \ bitnami/wordpress:latest ``` +### SMTP Configuration + +To configure WordPress to send email using SMTP you can set the following environment variables: +- `SMTP_HOST`: Host for outgoing SMTP email. +- `SMTP_PORT`: Port for outgoing SMTP email. +- `SMTP_USER`: User of SMTP used for authentication (likely email). +- `SMTP_PASSWORD`: Password for SMTP. +- `SMTP_USERNAME`: User name for SMTP emails. +- `SMTP_PROTOCOL`: Secure connection protocol to use for SMTP [tls, ssl, none]. + +This would be an example of SMTP configuration using a GMail account: + + * docker-compose (application part): + +``` + application: + image: bitnami/wordpress:latest + ports: + - 80:80 + environment: + - SMTP_HOST=smtp.gmail.com + - SMTP_PORT=587 + - SMTP_USER=your_email@gmail.com + - SMTP_PASSWORD=your_password + - SMTP_PROTOCOL=tls + volumes_from: + - application_data +``` + +* For manual execution: + +``` + $ docker run -d -e SMTP_HOST=smtp.gmail.com -e SMTP_PORT=587 -e SMTP_USER=your_email@gmail.com -e SMTP_PASSWORD=your_password -p 80:80 --name wordpress -v /your/local/path/bitnami/wordpress:/bitnami/wordpress --net=wordpress_network bitnami/wordpress +``` + # Backing up your application To backup your application data follow these steps: diff --git a/bitnami/wordpress/docker-compose.yml b/bitnami/wordpress/docker-compose.yml index fc9b9e3d5e5f..e120c29b176c 100644 --- a/bitnami/wordpress/docker-compose.yml +++ b/bitnami/wordpress/docker-compose.yml @@ -1,21 +1,19 @@ version: '2' - services: mariadb: - image: bitnami/mariadb:latest + image: 'bitnami/mariadb:latest' volumes: - - mariadb_data:/bitnami/mariadb - wordpress: - image: bitnami/wordpress:latest - depends_on: - - mariadb + - 'mariadb_data:/bitnami/mariadb' + application: + image: 'bitnami/wordpress:latest' ports: - '80:80' - '443:443' volumes: - - wordpress_data:/bitnami/wordpress - - apache_data:/bitnami/apache - + - 'wordpress_data:/bitnami/wordpress' + - 'apache_data:/bitnami/apache' + depends_on: + - mariadb volumes: mariadb_data: driver: local diff --git a/bitnami/wordpress/rootfs/apache-inputs.json b/bitnami/wordpress/rootfs/apache-inputs.json new file mode 100644 index 000000000000..2351b006ed67 --- /dev/null +++ b/bitnami/wordpress/rootfs/apache-inputs.json @@ -0,0 +1,4 @@ +{ + "httpPort": "{{$global.env.APACHE_HTTP_PORT}}", + "httpsPort": "{{$global.env.APACHE_HTTPS_PORT}}" +} \ No newline at end of file diff --git a/bitnami/wordpress/rootfs/app-entrypoint.sh b/bitnami/wordpress/rootfs/app-entrypoint.sh index 6af945c8a28c..d997424d9631 100755 --- a/bitnami/wordpress/rootfs/app-entrypoint.sh +++ b/bitnami/wordpress/rootfs/app-entrypoint.sh @@ -5,6 +5,8 @@ function initialize { # Package can be "installed" or "unpacked" status=`harpoon inspect $1` if [[ "$status" == *'"lifecycle": "unpacked"'* ]]; then + # Clean up inputs + inputs="" if [[ -f /$1-inputs.json ]]; then inputs=--inputs-file=/$1-inputs.json fi @@ -13,14 +15,21 @@ function initialize { } # Set default values +export APACHE_HTTP_PORT=${APACHE_HTTP_PORT:-"80"} +export APACHE_HTTPS_PORT=${APACHE_HTTPS_PORT:-"443"} export WORDPRESS_USERNAME=${WORDPRESS_USERNAME:-"user"} export WORDPRESS_PASSWORD=${WORDPRESS_PASSWORD:-"bitnami"} export WORDPRESS_EMAIL=${WORDPRESS_EMAIL:-"user@example.com"} +export WORDPRESS_FIRST_NAME=${WORDPRESS_FIRST_NAME:-"FirstName"} +export WORDPRESS_LAST_NAME=${WORDPRESS_LAST_NAME:-"LastName"} +export WORDPRESS_BLOG_NAME=${WORDPRESS_BLOG_NAME:-"User's Blog!"} export MARIADB_USER=${MARIADB_USER:-"root"} export MARIADB_HOST=${MARIADB_HOST:-"mariadb"} export MARIADB_PORT=${MARIADB_PORT:-"3306"} -if [[ "$1" == "harpoon" && "$2" == "start" ]]; then + + +if [[ "$1" == "harpoon" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then for module in apache wordpress; do initialize $module done diff --git a/bitnami/wordpress/rootfs/wordpress-inputs.json b/bitnami/wordpress/rootfs/wordpress-inputs.json index 997d94ef6a1c..8f055294677c 100644 --- a/bitnami/wordpress/rootfs/wordpress-inputs.json +++ b/bitnami/wordpress/rootfs/wordpress-inputs.json @@ -2,6 +2,15 @@ "username": "{{$global.env.WORDPRESS_USERNAME}}", "password": "{{$global.env.WORDPRESS_PASSWORD}}", "email": "{{$global.env.WORDPRESS_EMAIL}}", + "firstName": "{{$global.env.WORDPRESS_FIRST_NAME}}", + "lastName": "{{$global.env.WORDPRESS_LAST_NAME}}", + "blogName": "{{$global.env.WORDPRESS_BLOG_NAME}}", + "smtpHost": "{{$global.env.SMTP_HOST}}", + "smtpPort": "{{$global.env.STMP_PORT}}", + "smtpUser": "{{$global.env.SMTP_USER}}", + "smtpPassword": "{{$global.env.SMTP_PASSWORD}}", + "smtpUsername": "{{$global.env.SMTP_USERNAME}}", + "smtpProtocol": "{{$global.env.SMTP_PROTOCOL}}", "databaseAdminUser": "{{$global.env.MARIADB_USER}}", "databaseAdminPassword": "{{$global.env.MARIADB_PASSWORD}}", "databaseServerHost": "{{$global.env.MARIADB_HOST}}",