First commit Drupal nginx

This commit is contained in:
Carlos Rodriguez Hernandez
2018-11-14 16:23:22 +00:00
commit 9c31dcda3a
23 changed files with 842 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<!--
If you are reporting a new issue, make sure that we do not have any duplicates
already open. You can ensure this by searching the issue list for this
repository. If there is a duplicate, please close your issue and add a comment
to the existing issue instead.
If you suspect your issue is a bug, please edit your issue description to
include the BUG REPORT INFORMATION shown below. If you fail to provide this
information within 7 days, we cannot debug your issue and we'll close it. We
will, however, reopen it if you later provide the information.
-------------------------------
BUG REPORT INFORMATION
-------------------------------
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->
**Description**
<!-- Briefly describe the problem you are having in a few paragraphs. -->
**Steps to reproduce the issue:**
1. [First Step]
2. [Second Step]
3. [and so on...]
**Describe the results you received:**
<!-- What actually happens -->
**Describe the results you expected:**
<!-- What you expect to happen -->
**Additional information you deem important (e.g. issue happens only occasionally):**
<!-- Any additional information, configuration or data that might be necessary to reproduce the issue. -->
**Version**
- Output of `docker version`:
```
(paste your output here)
```
- Output of `docker info`:
```
(paste your output here)
```
- Output of `docker-compose version` (if applicable):
```
(paste your output here)
```
**Additional environment details (AWS, VirtualBox, Docker for MAC, physical, etc.):**

View File

@@ -0,0 +1,32 @@
<!--
Before you open the request please review the following guidelines and tips to help it be more easily integrated:
- Describe the scope of your change - i.e. what the change does.
- Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.
Thank you for contributing! We will try to test and integrate the change as soon as we can, but be aware we have many GitHub repositories to manage and can't immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated sometimes the priorities of Bitnami might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.
-->
**Description of the change**
<!-- Describe the scope of your change - i.e. what the change does. -->
**Benefits**
<!-- What benefits will be realized by the code change? -->
**Possible drawbacks**
<!-- Describe any known limitations with your change -->
**Applicable issues**
<!-- Enter any applicable Issues here (You can reference an issue using #) -->
**Additional information**
<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

1
bitnami/drupal-nginx/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
local/

View File

@@ -0,0 +1,52 @@
FROM registry.rhc4tp.openshift.com/bitnami/rhel-extras-7:latest
LABEL maintainer "Bitnami <containers@bitnami.com>"
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
BITNAMI_PKG_EXTRA_DIRS="/bitnami/nginx/conf" \
HOME="/"
# Install required system packages and dependencies
RUN install_packages wget apr apr-util bzip2-libs glibc libcom_err libcurl expat libffi freetype libgcc libgcrypt gmp gnutls libgpg-error cyrus-sasl-gssapi libicu libidn libjpeg-turbo krb5-libs keyutils-libs openldap xz-libs libtomcrypt ncurses-libs nettle p11-kit pcre2 libpng libpng12 readline cyrus-sasl-lib libssh2 openssl-libs libstdc++ libtasn1 libuuid libxml2 libxslt zlib
RUN bitnami-pkg unpack nginx-1.14.0-5 --checksum 9bd2b1045d82829c5bbe1b286a43e11b6a0e1e19c5c34b7ad20b8df5bab2ca71
RUN bitnami-pkg unpack php-7.1.23-0 --checksum 9add08ad08b82b9533d3d625017031aa99b7259f5738d25b688e59e47ff1487f
RUN bitnami-pkg unpack mysql-client-10.1.37-0 --checksum a30c54095ffb4d9180f53d925a67e4b7e11523e48b67f2d5912c20d80a703f52
RUN bitnami-pkg unpack libphp-7.1.23-2 --checksum 2757a6961f347bbc90cffee59d2c54e9f7f2d0a427b3454c68abdc6b42ba11e6
RUN bitnami-pkg unpack drupal-8.6.3-0 --checksum 7ad51731f1bfbb2b98f1f5f8ff994a30e318f537f523de59f80023b5c97ec446
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/access.log
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/error.log
# TODO: Fix for htaccess issue
RUN mkdir -p /bitnami/nginx/conf/vhosts && chmod -R g+rwX /bitnami/nginx/conf
COPY rootfs /
COPY wordpress-vhosts.conf /bitnami/nginx/conf/vhosts/
ENV ALLOW_EMPTY_PASSWORD="no" \
NGINX_DAEMON_GROUP="" \
NGINX_DAEMON_USER="" \
NGINX_HTTPS_PORT_NUMBER="8443" \
NGINX_HTTP_PORT_NUMBER="8080" \
BITNAMI_APP_NAME="drupal" \
BITNAMI_IMAGE_VERSION="8.6.3-r0" \
DRUPAL_DATABASE_NAME="bitnami_drupal" \
DRUPAL_DATABASE_PASSWORD="" \
DRUPAL_DATABASE_USER="bn_drupal" \
DRUPAL_EMAIL="user@example.com" \
DRUPAL_PASSWORD="bitnami" \
DRUPAL_USERNAME="user" \
MARIADB_HOST="mariadb" \
MARIADB_PORT_NUMBER="3306" \
MARIADB_ROOT_PASSWORD="" \
MARIADB_ROOT_USER="root" \
MYSQL_CLIENT_CREATE_DATABASE_NAME="" \
MYSQL_CLIENT_CREATE_DATABASE_PASSWORD="" \
MYSQL_CLIENT_CREATE_DATABASE_PRIVILEGES="ALL" \
MYSQL_CLIENT_CREATE_DATABASE_USER="" \
PATH="/opt/bitnami/nginx/sbin:/opt/bitnami/php/bin:/opt/bitnami/mysql/bin:/opt/bitnami/drupal/vendor/bin:$PATH"
EXPOSE 8080 8443
USER 1001
ENTRYPOINT ["/app-entrypoint.sh"]
CMD ["/run.sh"]

View File

@@ -0,0 +1,33 @@
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
volumes:
- 'mariadb_data:/bitnami'
environment:
- MARIADB_USER=bn_drupal
- MARIADB_DATABASE=bitnami_drupal
- ALLOW_EMPTY_PASSWORD=yes
drupal:
image: 'bitnami/drupal-nginx:8-php5-rhel-7'
labels:
kompose.service.type: nodeport
ports:
- '80:8080'
- '443:8443'
volumes:
- 'drupal_data:/bitnami/drupal'
- './drupal-vhosts.conf:/bitnami/nginx/conf/vhosts/drupal-vhosts.conf'
depends_on:
- mariadb
environment:
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- WORDPRESS_DATABASE_USER=bn_wordpress
- WORDPRESS_DATABASE_NAME=bitnami_wordpress
- ALLOW_EMPTY_PASSWORD=yes
volumes:
mariadb_data:
driver: local
drupal_data:
driver: local

View File

@@ -0,0 +1,23 @@
server {
listen 0.0.0.0:8080;
server_name myapp.example.com;
root /opt/bitnami/drupal;
index index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
if (!-e $request_filename)
{
rewrite ^/(.+)$ /index.php?q=$1 last;
}
location ~ \.php$ {
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

View File

@@ -0,0 +1,14 @@
#!/bin/bash -e
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
print_welcome_page
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/run.sh" ]]; then
. /init.sh
nami_initialize nginx php mysql-client drupal
info "Starting drupal... "
fi
exec tini -- "$@"

View File

@@ -0,0 +1,10 @@
{
"databaseName": "{{$global.env.DRUPAL_DATABASE_NAME}}",
"databasePassword": "{{$global.env.DRUPAL_DATABASE_PASSWORD}}",
"databaseServerHost": "{{$global.env.MARIADB_HOST}}",
"databaseServerPort": "{{$global.env.MARIADB_PORT_NUMBER}}",
"databaseUser": "{{$global.env.DRUPAL_DATABASE_USER}}",
"email": "{{$global.env.DRUPAL_EMAIL}}",
"password": "{{$global.env.DRUPAL_PASSWORD}}",
"username": "{{$global.env.DRUPAL_USERNAME}}"
}

View File

@@ -0,0 +1,29 @@
##
## @brief Helper function to show an error when a password is empty and exit
## param $1 Input name
##
empty_password_error() {
error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
exit 1
}
##
## @brief Helper function to show a warning when the ALLOW_EMPTY_PASSWORD flag is enabled
##
empty_password_enabled_warn() {
warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment."
}
# Validate passwords
if [[ "$ALLOW_EMPTY_PASSWORD" =~ ^(yes|Yes|YES)$ ]]; then
empty_password_enabled_warn
else
# Database creation by MySQL client
if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" && -z "$MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" ]]; then
empty_password_error MYSQL_CLIENT_CREATE_DATABASE_PASSWORD
fi
# Drupal database
if [[ -z "$DRUPAL_DATABASE_PASSWORD" ]]; then
empty_password_error DRUPAL_DATABASE_PASSWORD
fi
fi

View File

@@ -0,0 +1,11 @@
{
"allowEmptyPassword": "{{$global.env.ALLOW_EMPTY_PASSWORD}}",
"createDatabaseName": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_NAME}}",
"createDatabasePassword": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_PASSWORD}}",
"createDatabasePrivileges": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_PRIVILEGES}}",
"createDatabaseUser": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_USER}}",
"host": "{{$global.env.MARIADB_HOST}}",
"port": "{{$global.env.MARIADB_PORT_NUMBER}}",
"rootPassword": "{{$global.env.MARIADB_ROOT_PASSWORD}}",
"rootUser": "{{$global.env.MARIADB_ROOT_USER}}"
}

View File

@@ -0,0 +1,6 @@
{
"httpPort": "{{$global.env.NGINX_HTTP_PORT_NUMBER}}",
"httpsPort": "{{$global.env.NGINX_HTTPS_PORT_NUMBER}}",
"systemGroup": "{{$global.env.NGINX_DAEMON_GROUP}}",
"systemUser": "{{$global.env.NGINX_DAEMON_USER}}"
}

View File

@@ -0,0 +1,26 @@
#!/bin/bash
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
NGINX_INSTALLDIR="/opt/bitnami/nginx"
NGINX_CONF_DIR="${NGINX_INSTALLDIR}/conf"
PHP_INSTALLDIR="/opt/bitnami/php"
PHP_CONF_DIR="${PHP_INSTALLDIR}/conf"
PHP_TEMP_DIR="${PHP_INSTALLDIR}/tmp"
_forwardTerm () {
echo "Caugth signal SIGTERM, passing it to child processes..."
cpids=$(pgrep -P $$ | xargs)
kill -15 $cpids 2> /dev/null
wait
exit $?
}
trap _forwardTerm TERM
info "Starting php-fpm..."
php-fpm --pid "${PHP_TEMP_DIR}/php5-fpm.pid" --fpm-config "${PHP_CONF_DIR}/php-fpm.conf" --prefix "${PHP_INSTALLDIR}" -c "${PHP_CONF_DIR}/php.ini" &
info "Starting nginx..."
nginx -c "${NGINX_CONF_DIR}/nginx.conf" -g "daemon off;" &
wait

View File

@@ -0,0 +1,52 @@
FROM registry.rhc4tp.openshift.com/bitnami/rhel-extras-7:latest
LABEL maintainer "Bitnami <containers@bitnami.com>"
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
BITNAMI_PKG_EXTRA_DIRS="/bitnami/nginx/conf" \
HOME="/"
# Install required system packages and dependencies
RUN install_packages wget apr apr-util bzip2-libs glibc libcom_err libcurl expat libffi freetype libgcc libgcrypt gmp gnutls libgpg-error cyrus-sasl-gssapi libicu libidn libjpeg-turbo krb5-libs keyutils-libs openldap xz-libs libtomcrypt ncurses-libs nettle p11-kit pcre2 libpng libpng12 readline cyrus-sasl-lib libssh2 openssl-libs libstdc++ libtasn1 libuuid libxml2 libxslt zlib
RUN bitnami-pkg unpack nginx-1.14.0-5 --checksum 9bd2b1045d82829c5bbe1b286a43e11b6a0e1e19c5c34b7ad20b8df5bab2ca71
RUN bitnami-pkg unpack php-5.6.38-2 --checksum 03ae59ec97f59c6b7f9c3043fff8b4485b6ad75502de492b46da7ab2a447025d
RUN bitnami-pkg unpack mysql-client-10.1.37-0 --checksum a30c54095ffb4d9180f53d925a67e4b7e11523e48b67f2d5912c20d80a703f52
RUN bitnami-pkg unpack libphp-5.6.38-1 --checksum 10d6d75e59ed466d8b1c6f2ac27c4913e6dd576d03d14823d7c408c2d927e7d6
RUN bitnami-pkg unpack drupal-8.6.3-0 --checksum 7ad51731f1bfbb2b98f1f5f8ff994a30e318f537f523de59f80023b5c97ec446
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/access.log
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/error.log
# TODO: Fix for htaccess issue
RUN mkdir -p /bitnami/nginx/conf/vhosts && chmod -R g+rwX /bitnami/nginx/conf
COPY rootfs /
COPY wordpress-vhosts.conf /bitnami/nginx/conf/vhosts/
ENV ALLOW_EMPTY_PASSWORD="no" \
NGINX_DAEMON_GROUP="" \
NGINX_DAEMON_USER="" \
NGINX_HTTPS_PORT_NUMBER="8443" \
NGINX_HTTP_PORT_NUMBER="8080" \
BITNAMI_APP_NAME="drupal" \
BITNAMI_IMAGE_VERSION="8.6.3-r0" \
DRUPAL_DATABASE_NAME="bitnami_drupal" \
DRUPAL_DATABASE_PASSWORD="" \
DRUPAL_DATABASE_USER="bn_drupal" \
DRUPAL_EMAIL="user@example.com" \
DRUPAL_PASSWORD="bitnami" \
DRUPAL_USERNAME="user" \
MARIADB_HOST="mariadb" \
MARIADB_PORT_NUMBER="3306" \
MARIADB_ROOT_PASSWORD="" \
MARIADB_ROOT_USER="root" \
MYSQL_CLIENT_CREATE_DATABASE_NAME="" \
MYSQL_CLIENT_CREATE_DATABASE_PASSWORD="" \
MYSQL_CLIENT_CREATE_DATABASE_PRIVILEGES="ALL" \
MYSQL_CLIENT_CREATE_DATABASE_USER="" \
PATH="/opt/bitnami/nginx/sbin:/opt/bitnami/php/bin:/opt/bitnami/mysql/bin:/opt/bitnami/drupal/vendor/bin:$PATH"
EXPOSE 8080 8443
USER 1001
ENTRYPOINT ["/app-entrypoint.sh"]
CMD ["/run.sh"]

View File

@@ -0,0 +1,33 @@
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
volumes:
- 'mariadb_data:/bitnami'
environment:
- MARIADB_USER=bn_drupal
- MARIADB_DATABASE=bitnami_drupal
- ALLOW_EMPTY_PASSWORD=yes
drupal:
image: 'bitnami/drupal-nginx:8-rhel-7'
labels:
kompose.service.type: nodeport
ports:
- '80:8080'
- '443:8443'
volumes:
- 'drupal_data:/bitnami/drupal'
- './drupal-vhosts.conf:/bitnami/nginx/conf/vhosts/drupal-vhosts.conf'
depends_on:
- mariadb
environment:
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- WORDPRESS_DATABASE_USER=bn_wordpress
- WORDPRESS_DATABASE_NAME=bitnami_wordpress
- ALLOW_EMPTY_PASSWORD=yes
volumes:
mariadb_data:
driver: local
drupal_data:
driver: local

View File

@@ -0,0 +1,23 @@
server {
listen 0.0.0.0:8080;
server_name myapp.example.com;
root /opt/bitnami/drupal;
index index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
if (!-e $request_filename)
{
rewrite ^/(.+)$ /index.php?q=$1 last;
}
location ~ \.php$ {
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

View File

@@ -0,0 +1,14 @@
#!/bin/bash -e
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
print_welcome_page
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/run.sh" ]]; then
. /init.sh
nami_initialize nginx php mysql-client drupal
info "Starting drupal... "
fi
exec tini -- "$@"

View File

@@ -0,0 +1,10 @@
{
"databaseName": "{{$global.env.DRUPAL_DATABASE_NAME}}",
"databasePassword": "{{$global.env.DRUPAL_DATABASE_PASSWORD}}",
"databaseServerHost": "{{$global.env.MARIADB_HOST}}",
"databaseServerPort": "{{$global.env.MARIADB_PORT_NUMBER}}",
"databaseUser": "{{$global.env.DRUPAL_DATABASE_USER}}",
"email": "{{$global.env.DRUPAL_EMAIL}}",
"password": "{{$global.env.DRUPAL_PASSWORD}}",
"username": "{{$global.env.DRUPAL_USERNAME}}"
}

View File

@@ -0,0 +1,29 @@
##
## @brief Helper function to show an error when a password is empty and exit
## param $1 Input name
##
empty_password_error() {
error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
exit 1
}
##
## @brief Helper function to show a warning when the ALLOW_EMPTY_PASSWORD flag is enabled
##
empty_password_enabled_warn() {
warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment."
}
# Validate passwords
if [[ "$ALLOW_EMPTY_PASSWORD" =~ ^(yes|Yes|YES)$ ]]; then
empty_password_enabled_warn
else
# Database creation by MySQL client
if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" && -z "$MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" ]]; then
empty_password_error MYSQL_CLIENT_CREATE_DATABASE_PASSWORD
fi
# Drupal database
if [[ -z "$DRUPAL_DATABASE_PASSWORD" ]]; then
empty_password_error DRUPAL_DATABASE_PASSWORD
fi
fi

View File

@@ -0,0 +1,11 @@
{
"allowEmptyPassword": "{{$global.env.ALLOW_EMPTY_PASSWORD}}",
"createDatabaseName": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_NAME}}",
"createDatabasePassword": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_PASSWORD}}",
"createDatabasePrivileges": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_PRIVILEGES}}",
"createDatabaseUser": "{{$global.env.MYSQL_CLIENT_CREATE_DATABASE_USER}}",
"host": "{{$global.env.MARIADB_HOST}}",
"port": "{{$global.env.MARIADB_PORT_NUMBER}}",
"rootPassword": "{{$global.env.MARIADB_ROOT_PASSWORD}}",
"rootUser": "{{$global.env.MARIADB_ROOT_USER}}"
}

View File

@@ -0,0 +1,6 @@
{
"httpPort": "{{$global.env.NGINX_HTTP_PORT_NUMBER}}",
"httpsPort": "{{$global.env.NGINX_HTTPS_PORT_NUMBER}}",
"systemGroup": "{{$global.env.NGINX_DAEMON_GROUP}}",
"systemUser": "{{$global.env.NGINX_DAEMON_USER}}"
}

View File

@@ -0,0 +1,26 @@
#!/bin/bash
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
NGINX_INSTALLDIR="/opt/bitnami/nginx"
NGINX_CONF_DIR="${NGINX_INSTALLDIR}/conf"
PHP_INSTALLDIR="/opt/bitnami/php"
PHP_CONF_DIR="${PHP_INSTALLDIR}/conf"
PHP_TEMP_DIR="${PHP_INSTALLDIR}/tmp"
_forwardTerm () {
echo "Caugth signal SIGTERM, passing it to child processes..."
cpids=$(pgrep -P $$ | xargs)
kill -15 $cpids 2> /dev/null
wait
exit $?
}
trap _forwardTerm TERM
info "Starting php-fpm..."
php-fpm --pid "${PHP_TEMP_DIR}/php5-fpm.pid" --fpm-config "${PHP_CONF_DIR}/php-fpm.conf" --prefix "${PHP_INSTALLDIR}" -c "${PHP_CONF_DIR}/php.ini" &
info "Starting nginx..."
nginx -c "${NGINX_CONF_DIR}/nginx.conf" -g "daemon off;" &
wait

View File

@@ -0,0 +1,13 @@
Copyright (c) 2017-2018 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,328 @@
# What is Drupal with NGINX?
> Drupal with NGINX combines one of the most versatile open source content management systems on the market with the power of the NGINX web server. Drupal is built for high performance and is scalable to many servers, has easy integration via REST, JSON, SOAP and other formats, and features a whopping 15,000 plugins to extend and customize the application for just about any type of website.
https://www.drupal.org/
https://nginx.org/
# TL;DR;
## Docker Compose
```bash
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-drupal-nginx/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
```
# Why use Bitnami Images?
* Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
* With Bitnami images the latest bug fixes and features are available as soon as possible.
* Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
* Bitnami images are built on CircleCI and automatically pushed to the Docker Hub.
* All our images are based on [minideb](https://github.com/bitnami/minideb) a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading linux distribution.
* Bitnami container images are released daily with the latest distribution packages available.
[![Anchore Image Overview](https://anchore.io/service/badges/image/6d7d3578bda29b1e68a6c43de663cfd804d6e3b03610eaaec69915f8045abf68)](https://anchore.io/image/dockerhub/bitnami%2Fdrupal%3Alatest#security)
> The image overview badge contains a security report with all open CVEs. Click on 'Show only CVEs with fixes' to get the list of actionable security issues.
# How to deploy Drupal in Kubernetes?
Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the [Bitnami Drupal Chart GitHub repository](https://github.com/bitnami/charts/tree/master/upstreamed/drupal).
Bitnami containers can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters.
# Supported tags and respective `Dockerfile` links
> NOTE: Debian 8 images have been deprecated in favor of Debian 9 images. Bitnami will not longer publish new Docker images based on Debian 8.
> NOTE: RHEL images are not available in any public registry. You can build them on your side on top of RHEL as described on this [doc](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html-single/getting_started_with_containers/index#creating_docker_images).
# Prerequisites
To run this application you need Docker Engine 1.10.0. Docker Compose is recommended with a version 1.6.0 or later.
# How to use this image
## Run Drupal with a Database Container
Running Drupal with a database server is the recommended way. You can either use docker-compose or run the containers manually.
### Run the application using Docker Compose
This is the recommended way to run Drupal. You can use the following `docker-compose.yml` template:
```yaml
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_drupal
- MARIADB_DATABASE=bitnami_drupal
volumes:
- 'mariadb_data:/bitnami'
drupal:
image: 'bitnami/drupal:8'
labels:
kompose.service.type: nodeport
environment:
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- DRUPAL_DATABASE_USER=bn_drupal
- DRUPAL_DATABASE_NAME=bitnami_drupal
- ALLOW_EMPTY_PASSWORD=yes
ports:
- '80:80'
- '443:443'
volumes:
- 'drupal_data:/bitnami'
depends_on:
- mariadb
volumes:
mariadb_data:
driver: local
drupal_data:
driver: local
```
### Run the application manually
If you want to run the application manually instead of using docker-compose, these are the basic steps you need to run:
1. Create a new network for the application and the database:
```bash
$ docker network create drupal-tier
```
2. Create a volume for MariaDB persistence and create a MariaDB container
```bash
$ docker volume create --name mariadb_data
$ docker run -d --name mariadb \
-e ALLOW_EMPTY_PASSWORD=yes \
-e MARIADB_USER=bn_drupal \
-e MARIADB_DATABASE=bitnami_drupal \
--net drupal-tier \
--volume mariadb_data:/bitnami \
bitnami/mariadb:latest
```
3. Create volumes for Drupal persistence and launch the container
```bash
$ docker volume create --name drupal_data
$ docker run -d --name drupal -p 80:80 -p 443:443 \
-e ALLOW_EMPTY_PASSWORD=yes \
-e DRUPAL_DATABASE_USER=bn_drupal \
-e DRUPAL_DATABASE_NAME=bitnami_drupal \
--net drupal-tier \
--volume drupal_data:/bitnami
--volume ./drupal-vhosts.conf:/bitnami/nginx/conf/vhosts/drupal-vhosts.conf \
bitnami/drupal-nginx:latest
```
Access your application at http://your-ip/
## Persisting your application
If you remove the container all your data and configurations will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence you should mount a volume at the `/bitnami` path. Additionally you should mount a volume for [persistence of the MariaDB data](https://github.com/bitnami/bitnami-docker-mariadb#persisting-your-database).
The above examples define docker volumes namely `mariadb_data` and `drupal_data`. The Drupal application state will persist as long as these volumes are not removed.
To avoid inadvertent removal of these volumes you can [mount host directories as data volumes](https://docs.docker.com/engine/tutorials/dockervolumes/). Alternatively you can make use of volume plugins to host the volume data.
### Mount host directories as data volumes with Docker Compose
This requires a minor change to the `docker-compose.yml` template previously shown:
```yaml
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_drupal
- MARIADB_DATABASE=bitnami_drupal
volumes:
- '/path/to/mariadb-persistence:/bitnami'
drupal:
image: 'bitnami/drupal-nginx:latest'
depends_on:
- mariadb
ports:
- '80:80'
- '443:443'
environment:
- DRUPAL_DATABASE_USER=bn_drupal
- DRUPAL_DATABASE_NAME=bitnami_drupal
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- '/path/to/drupal-persistence:/bitnami'
```
### Mount host directories as data volumes using the Docker command line
1. Create a network (if it does not exist):
```bash
$ docker network create drupal-tier
```
2. Create a MariaDB container with host volume:
```bash
$ docker run -d --name mariadb \
-e ALLOW_EMPTY_PASSWORD=yes \
-e MARIADB_USER=bn_drupal \
-e MARIADB_DATABASE=bitnami_drupal \
--net drupal-tier \
--volume /path/to/mariadb-persistence:/bitnami \
bitnami/mariadb:latest
```
*Note:* You need to give the container a name in order to Drupal to resolve the host
3. Create the Drupal container with host volumes:
```bash
$ docker run -d --name drupal -p 80:80 -p 443:443 \
-e ALLOW_EMPTY_PASSWORD=yes \
-e DRUPAL_DATABASE_USER=bn_drupal \
-e DRUPAL_DATABASE_NAME=bitnami_drupal \
--net drupal-tier \
--volume /path/to/drupal-persistence:/bitnami \
bitnami/drupal-nginx:latest
```
# Upgrade this application
Bitnami provides up-to-date versions of MariaDB and Drupal, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container. We will cover here the upgrade of the Drupal container. For the MariaDB upgrade see https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#upgrade-this-image
1. Get the updated images:
```bash
$ docker pull bitnami/drupal-nginx:latest
```
2. Stop your container
* For docker-compose: `$ docker-compose stop drupal`
* For manual execution: `$ docker stop drupal`
3. Take a snapshot of the application state
```bash
$ rsync -a /path/to/drupal-persistence /path/to/drupal-persistence.bkp.$(date +%Y%m%d-%H.%M.%S)
```
Additionally, [snapshot the MariaDB data](https://github.com/bitnami/bitnami-docker-mariadb#step-2-stop-and-backup-the-currently-running-container)
You can use these snapshots to restore the application state should the upgrade fail.
4. Remove the stopped container
* For docker-compose: `$ docker-compose rm drupal`
* For manual execution: `$ docker rm drupal`
5. Run the new image
* For docker-compose: `$ docker-compose up drupal`
* For manual execution ([mount](#mount-persistent-folders-manually) the directories if needed): `docker run --name drupal bitnami/drupal-nginx:latest`
# Configuration
## Environment variables
When you start the drupal image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run command line. If you want to add a new environment variable:
* For docker-compose add the variable name and value under the application section:
```yaml
drupal:
image: bitnami/drupal-nginx:latest
ports:
- 80:80
- 443:443
environment:
- DRUPAL_PASSWORD=my_password
```
* For manual execution add a `-e` option with each variable and value:
```bash
$ docker run -d --name drupal -p 80:80 -p 443:443 \
-e DRUPAL_PASSWORD=my_password \
--net drupal-tier \
--volume /path/to/drupal-persistence:/bitnami \
bitnami/drupal-nginx:latest
```
Available variables:
##### User and Site configuration
- `DRUPAL_PROFILE`: Drupal installation profile. Default: **standard**
- `DRUPAL_USERNAME`: Drupal application username. Default: **user**
- `DRUPAL_PASSWORD`: Drupal application password. Default: **bitnami**
- `DRUPAL_EMAIL`: Drupal application email. Default: **user@example.com**
##### Use an existing database
- `MARIADB_HOST`: Hostname for MariaDB server. Default: **mariadb**
- `MARIADB_PORT_NUMBER`: Port used by MariaDB server. Default: **3306**
- `DRUPAL_DATABASE_NAME`: Database name that Drupal will use to connect with the database. Default: **bitnami_drupal**
- `DRUPAL_DATABASE_USER`: Database user that Drupal will use to connect with the database. Default: **bn_drupal**
- `DRUPAL_DATABASE_PASSWORD`: Database password that Drupal will use to connect with the database. No defaults.
- `ALLOW_EMPTY_PASSWORD`: It can be used to allow blank passwords. Default: **no**
##### Create a database for Drupal using mysql-client
- `MARIADB_HOST`: Hostname for MariaDB server. Default: **mariadb**
- `MARIADB_PORT_NUMBER`: Port used by MariaDB server. Default: **3306**
- `MARIADB_ROOT_USER`: Database admin user. Default: **root**
- `MARIADB_ROOT_PASSWORD`: Database password for the `MARIADB_ROOT_USER` user. No defaults.
- `MYSQL_CLIENT_CREATE_DATABASE_NAME`: New database to be created by the mysql client module. No defaults.
- `MYSQL_CLIENT_CREATE_DATABASE_USER`: New database user to be created by the mysql client module. No defaults.
- `MYSQL_CLIENT_CREATE_DATABASE_PASSWORD`: Database password for the `MYSQL_CLIENT_CREATE_DATABASE_USER` user. No defaults.
- `ALLOW_EMPTY_PASSWORD`: It can be used to allow blank passwords. Default: **no**
# Notable Changes
# Contributing
We'd love for you to contribute to this container. You can request new features by creating an [issue](https://github.com/bitnami/bitnami-docker-drupal-nginx/issues), or submit a [pull request](https://github.com/bitnami/bitnami-docker-drupal-nginx/pulls) with your contribution.
# Issues
If you encountered a problem running this container, you can file an [issue](https://github.com/bitnami/bitnami-docker-drupal-nginx/issues). For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (`$ docker version`)
- Output of `$ docker info`
- Version of this container (`$ echo $BITNAMI_IMAGE_VERSION` inside the container)
- The command you used to run the container, and any relevant output you saw (masking any sensitive
information)
# License
Copyright 2015-2018 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<http://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.