Skip to content
Snippets Groups Projects
Commit 622aca4c authored by Chris Shantz's avatar Chris Shantz
Browse files

Added a drupal7 and drupal8 folder so we can have two web containers

parent 351d81b8
No related branches found
No related tags found
No related merge requests found
<VirtualHost *:80>
DocumentRoot /var/www/drupal7
ServerAdmin webmaster@localhost
ServerName d7
Redirect permanent / https://docker/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/drupal7
ServerName docker
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
Alias /doc/ /usr/share/doc/
<Directory /usr/share/doc/>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
\ No newline at end of file
############################################################
# Dockerfile to build WCMS container images
# Based on Ubuntu
############################################################
# Set the base image to Ubuntu
FROM ubuntu:xenial
# Allows installing of packages without prompting the user to answer any questions
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install --assume-yes \
software-properties-common \
language-pack-en \
curl \
apt-transport-https
## Add the repo to get the latest PHP versions
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
RUN export LANG=en_US.UTF-8
RUN add-apt-repository -y ppa:ondrej/php
## Add the git repo so we can get the latest git (we need 2.9.2+)
RUN add-apt-repository ppa:git-core/ppa
RUN apt-get update
# Added so we can installs 8.x branch of nodejs.
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
# Install packages.
RUN apt-get install -y \
vim \
git \
apache2 \
php5.6 \
php5.6-apc \
php5.6-fpm \
php5.6-xml \
php5.6-mbstring \
php5.6-cli \
php5.6-mysql \
php5.6-gd \
php5.6-curl \
php5.6-ldap \
php5.6-mcrypt \
php5.6-zip \
php-pear \
libapache2-mod-php5.6 \
optipng \
jpegoptim \
imagemagick \
libapache2-mod-fcgid \
libapache2-mod-fastcgi \
curl \
mysql-client \
openssh-server \
phpmyadmin \
wget \
ruby-sass \
ruby-compass \
python-software-properties \
nodejs \
dos2unix \
supervisor
RUN apt-get clean
## enable rewrite and ssl for apache2
RUN a2enmod rewrite
RUN a2enmod ssl
## for Content Security Policy (CSP).
RUN a2enmod headers
## fcgid needed to run multiple versions of PHP under the same apache.
## RUN a2enmod fcgid
## enable mcrypt
RUN phpenmod mcrypt
## add upload progress
RUN apt-get install php-uploadprogress
# Install Composer.
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
# Install Drush 7.
RUN composer global require drush/drush:7.*
RUN composer global update
# Unfortunately, adding the composer vendor dir to the PATH doesn't seem to work. So:
RUN ln -s /root/.composer/vendor/bin/drush /usr/local/bin/drush
################## BEGIN DRUPAL INSTALLATION ######################
# Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
## From https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
RUN cd /tmp
RUN openssl req -x509 -nodes -days 1825 -newkey rsa:2048 -keyout /tmp/apache.key -out /tmp/apache.crt \
-subj "/C=CA/ST=ON/L=Waterloo/O=uWaterloo/OU=IST/CN=wcms-devsite/emailAddress=localhost@example.com"
RUN cp /tmp/apache.crt /etc/ssl/certs/server.crt
RUN cp /tmp/apache.key /etc/ssl/private/server.key
# Replace the default site configuration with our own.
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
# Install Drupal.
RUN drush dl -v -d drupal-7.59 --destination="/var/www" --drupal-project-rename="drupal7" && \
chown -R www-data:www-data /var/www/
RUN useradd vagrant -p vagrant
## Install the drush registry_rebuild module
RUN drush @none dl registry_rebuild
## Create the config folder in drupal root and an empty password_settings file
RUN mkdir /var/www/drupal7/config
RUN touch /var/www/drupal7/config/password_settings.php
## Create an empty fonts folder so I know where it's supposed to go! ;)
RUN mkdir /var/www/drupal7/fonts
RUN cd /var/www/drupal7 && \
ln -s . fdsu1 && \
ln -s . fdsu2 && \
ln -s . fdsu3 && \
ln -s . fdsu4
## Create site folders for drupal multi-site
RUN mkdir /var/www/drupal7/sites/docker.fdsu1
RUN mkdir /var/www/drupal7/sites/docker.fdsu2
RUN mkdir /var/www/drupal7/sites/docker.fdsu3
RUN mkdir /var/www/drupal7/sites/docker.fdsu4
## Add module and file folders as well as copy the settings.php over for each site
RUN mkdir /var/www/drupal7/sites/docker.fdsu1/files
RUN mkdir /var/www/drupal7/sites/docker.fdsu1/modules
## Create settings.php file
COPY settings.conf /var/www/drupal7/sites/docker.fdsu1/settings.php
RUN mkdir /var/www/drupal7/sites/docker.fdsu2/files
RUN mkdir /var/www/drupal7/sites/docker.fdsu2/modules
## Create settings.php file
COPY settings.conf /var/www/drupal7/sites/docker.fdsu2/settings.php
RUN mkdir /var/www/drupal7/sites/docker.fdsu3/files
RUN mkdir /var/www/drupal7/sites/docker.fdsu3/modules
## Create settings.php file
COPY settings.conf /var/www/drupal7/sites/d7.fdsu3/settings.php
RUN mkdir /var/www/drupal7/sites/docker.fdsu4/files
RUN mkdir /var/www/drupal7/sites/docker.fdsu4/modules
## Create settings.php file
COPY settings.conf /var/www/drupal7/sites/docker.fdsu1/settings.php
COPY settings.conf /var/www/drupal7/sites/docker.fdsu2/settings.php
RUN cd /var/www/drupal7/sites/docker.fdsu2 && \
sed -i 's/fdsu1/fdsu2/g' settings.php
COPY settings.conf /var/www/drupal7/sites/docker.fdsu3/settings.php
RUN cd /var/www/drupal7/sites/docker.fdsu3 && \
sed -i 's/fdsu1/fdsu3/g' settings.php
COPY settings.conf /var/www/drupal7/sites/docker.fdsu4/settings.php
RUN cd /var/www/drupal7/sites/docker.fdsu4 && \
sed -i 's/fdsu1/fdsu4/g' settings.php
## Get the base profile from git
RUN git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git /var/www/drupal7/profiles/uw_base_profile
RUN chown -R vagrant:www-data /var/www/drupal7/profiles/uw_base_profile
RUN chmod -R g+w /var/www/drupal7/profiles/uw_base_profile
## Rebuild the profile to get the latest modules
RUN ls /var/www/drupal7/profiles/uw_base_profile
RUN /var/www/drupal7/profiles/uw_base_profile/rebuild.sh
## Add the Servername to the apache2 conf file.
## RUN echo "ServerName docker" >> /etc/apache2/apache2.conf
# Copy our custom entrypoint and make it executable.
COPY docker-entrypoint-d7.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint-d7.sh
## Add Drupal specific changes for PHP to the php.ini files.
RUN sed -i "s/display_errors = .*/display_errors = On/" /etc/php/5.6/apache2/php.ini && \
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/5.6/fpm/php.ini && \
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/5.6/cli/php.ini && \
sed -i "s/max_execution_time =.*/max_execution_time = 240/" /etc/php/5.6/apache2/php.ini && \
sed -i "s/max_execution_time =.*/max_execution_time = 240/" /etc/php/5.6/cli/php.ini && \
sed -i "s/max_input_time = .*/max_input_time = 240/" /etc/php/5.6/apache2/php.ini && \
sed -i "s/max_input_time = .*/max_input_time = 240/" /etc/php/5.6/cli/php.ini && \
sed -i "s/memory_limit = .*/memory_limit = 768M/" /etc/php/5.6/apache2/php.ini && \
sed -i "s/memory_limit = .*/memory_limit = 768M/" /etc/php/5.6/cli/php.ini && \
sed -i "s/; max_input_vars = .*/max_input_vars = 10000/" /etc/php/5.6/apache2/php.ini && \
sed -i "s/;date.timezone = */date.timezone = America\/Toronto/" /etc/php/5.6/apache2/php.ini && \
sed -i "s/;date.timezone = */date.timezone = America\/Toronto/" /etc/php/5.6/cli/php.ini
# Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
# Expose the default Apache port.
EXPOSE 80
EXPOSE 443
# Replace the standard entrypoint /bin/sh with our script.
ENTRYPOINT ["docker-entrypoint-d7.sh"]
# If no command is passed to the container, start Apache by default.
CMD ["apachectl", "-D", "FOREGROUND"]
##################### INSTALLATION END #####################
\ No newline at end of file
#!/usr/bin/env bash
# Any background job should have it's messages printed.
set -m
# Don't continue if any command in the script fails.
set -e
# Delete any previously existing run file.
if [ -f /run/apache2/apache2.pid ]; then
rm /run/apache2/apache2.pid
fi
# Allow the Apache docroot to be overridden.
APACHE_DOCROOT_DIR="${APACHE_DOCROOT_DIR:-/var/www/drupal7}"
if [ -n "$APACHE_DOCROOT_DIR" ]; then
sed -i 's@^\s*DocumentRoot.*@'" DocumentRoot ${APACHE_DOCROOT_DIR}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow the site name to be overriden.
APACHE_SITE_NAME="${APACHE_SITE_NAME:-docker}"
if [ -n "$APACHE_SITE_NAME" ]; then
sed -i 's@^\s*ServerName.*@'" ServerName ${APACHE_SITE_NAME}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow for site aliases to be provided.
APACHE_SITE_ALIAS="${APACHE_SITE_ALIAS:-docker.localhost}"
if [ -n "$APACHE_SITE_ALIAS" ]; then
sed -i 's@^\s*ServerAlias.*@'" ServerAlias ${APACHE_SITE_ALIAS}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Now that we're set up, run whatever command was passed to the entrypoint.
exec "$@"
This diff is collapsed.
<?php
// Server domain name.
$UWhost = 'docker:4443';
// Path to site root.
$UWpref = 'fdsu1';
// Name of site database.
$UWdb = 'fdsu1';
//Username to connect to site database.
$UWuser = 'drupal';
// Password to connect to site database.
$UWpass = 'verybadpassword';
// Hostname to connect to site database.
$UWpri = 'db';
require_once(DRUPAL_ROOT . '/profiles/uw_base_profile/drupal-settings.php');
// File system.
$conf['file_default_scheme'] = 'public';
$conf['file_private_path'] = '/var/www/drupal7/sites/docker.fdsu1/files/private/';
$conf['file_public_path'] = '/var/www/drupal7/sites/docker.fdsu1/files';
$conf['file_temporary_path'] = '/var/www/drupal7/sites/docker.fdsu1/files/temp/';
unset ($conf['file_chmod_directory']);
unset ($conf['file_chmod_file']);
\ No newline at end of file
<VirtualHost *:80>
DocumentRoot /var/www/drupal
ServerAdmin webmaster@localhost
ServerName docker
Redirect permanent / https://docker/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/drupal
ServerName docker
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
Alias /doc/ /usr/share/doc/
<Directory /usr/share/doc/>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
\ No newline at end of file
FROM ubuntu:xenial
################################################################################
# #
# THIS CONTAINER IS FOR EDUCATIONAL USE ONLY! #
# #
# Never use this container for running production workloads! #
# #
################################################################################
# Allows installing of packages without prompting the user to answer any questions
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install --assume-yes \
software-properties-common \
language-pack-en \
curl \
apt-transport-https
## Added so we can install yarn for Drupal8 theme work.
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
## Added so we can installs 8.x branch of nodejs.
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
RUN export LANG=en_US.UTF-8
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
# Update the package manager, then install packages.
RUN apt-get update && \
apt-get install --assume-yes \
apache2 \
nano \
openssh-server \
wget \
sudo \
php7.2 \
libapache2-mod-php7.2 \
php7.2-mysql \
php7.2-cli \
php7.2-common \
php7.2-gd \
php7.2-mbstring \
php7.2-xml \
php7.2-opcache \
php7.2-sqlite3 \
php7.2-mysql \
php7.2-curl \
php7.2-soap \
php7.2-phar \
php7.2-cgi \
php-uploadprogress \
php-pear \
optipng \
jpegoptim \
imagemagick \
libapache2-mod-fcgid \
libapache2-mod-fastcgi \
git \
nodejs \
yarn \
ruby-sass \
ruby-compass \
mysql-client
## From https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
RUN cd /tmp
RUN openssl req -x509 -nodes -days 1825 -newkey rsa:2048 -keyout /tmp/apache.key -out /tmp/apache.crt \
-subj "/C=CA/ST=ON/L=Waterloo/O=uWaterloo/OU=IST/CN=wcms-devsite/emailAddress=localhost@example.com"
RUN cp /tmp/apache.crt /etc/ssl/certs/server.crt
RUN cp /tmp/apache.key /etc/ssl/private/server.key
# Replace the default site configuration with our own.
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
# Enable mod_rewrite 'cause we needs it.
RUN a2enmod rewrite
# Enable SSL
RUN a2enmod ssl
# for Content Security Policy (CSP).
RUN a2enmod headers
# Install the latest npm and gulp so we have them for responsive sites.
RUN sudo npm install npm@latest -g \
sudo npm install gulp -g \
sudo npm install bower -g
# Create a symlink for node to nodejs.
## RUN ln -s /usr/bin/nodejs /usr/bin/node
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Add the "vagrant" user (because we are all familiar with having it)
RUN useradd -d /home/vagrant -ms /bin/bash -g root -G sudo -p vagrant vagrant
# Forward logs to docker log collector.
RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
ln -sf /dev/stderr /var/log/apache2/error.log && \
ln -sf /dev/stdout /var/log/apache2/000_default-access_log && \
ln -sf /dev/stderr /var/log/apache2/000_default-error_log
# Copy our custom entrypoint and make it executable.
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Clone PatternLab into the html directory.
RUN git clone https://git.uwaterloo.ca/wcms/uw_wcms_pattern_lab.git /var/www/html/uw_wcms_pattern_lab
RUN echo "Cloned patternlab..."
# Add drush 8
RUN wget https://github.com/drush-ops/drush/releases/download/8.1.17/drush.phar && \
chmod +x drush.phar && \
mv drush.phar /usr/local/bin/drush
# Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
# Clone Drupal
RUN drush dl -v -d drupal-8.5.6 --destination="/var/www" --drupal-project-rename="drupal8"
RUN echo "Cloned Drupal 8...."
# Clone our WCMS profile
RUN cd /var/www/drupal8/profiles && \
git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git && \
cd /var/www/drupal8/profiles/uw_base_profile && \
git checkout 8.x-3.x
# Create the settings.php file
RUN cd /var/www/drupal8/sites/default && \
cp default.settings.php settings.php
# Add Drupal permissions to the drupal folder
RUN chown -R vagrant:www-data /var/www/drupal8
RUN chmod -R g+w /var/www/drupal8
# Expose the default Apache port.
EXPOSE 80
EXPOSE 443
# Replace the standard entrypoint /bin/sh with our script.
ENTRYPOINT ["docker-entrypoint.sh"]
# If no command is passed to the container, start Apache by default.
CMD ["apachectl", "-D", "FOREGROUND"]
#!/usr/bin/env bash
# Any background job should have it's messages printed.
set -m
# Don't continue if any command in the script fails.
set -e
# Delete any previously existing run file.
if [ -f /run/apache2/apache2.pid ]; then
rm /run/apache2/apache2.pid
fi
## Setup Drupal8 and Patternlab.
#cd /var/www/drupal8/profiles/uw_base_profile
#apt-get install composer
#composer config --global github-oauth.github.com 5e7a5890e9935f4a03a3785e11816851430e930c
#./rebuild.sh -y > tmp/profile-build.log
# Allow the Apache docroot to be overridden.
APACHE_DOCROOT_DIR="${APACHE_DOCROOT_DIR:-/var/www/drupal8}"
if [ -n "$APACHE_DOCROOT_DIR" ]; then
sed -i 's@^\s*DocumentRoot.*@'" DocumentRoot ${APACHE_DOCROOT_DIR}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow the site name to be overriden.
APACHE_SITE_NAME="${APACHE_SITE_NAME:-docker}"
if [ -n "$APACHE_SITE_NAME" ]; then
sed -i 's@^\s*ServerName.*@'" ServerName ${APACHE_SITE_NAME}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Allow for site aliases to be provided.
APACHE_SITE_ALIAS="${APACHE_SITE_ALIAS:-docker.localhost}"
if [ -n "$APACHE_SITE_ALIAS" ]; then
sed -i 's@^\s*ServerAlias.*@'" ServerAlias ${APACHE_SITE_ALIAS}"'@' /etc/apache2/sites-available/000-default.conf
fi
# Now that we're set up, run whatever command was passed to the entrypoint.
exec "$@"
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment