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

creating a new branch with traefik

parent 554c2da6
No related tags found
No related merge requests found
<VirtualHost *:80>
DocumentRoot /var/www/drupal7
ServerAdmin webmaster@localhost
ServerName docker7
Redirect permanent / https://docker7/
<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 docker7
<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! #
# #
################################################################################
RUN export 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
## For ubuntu xenial we need to add some repos for the latest PHP version
RUN export DEBIAN_FRONTEND=noninteractive
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
## Pre-configure mysql username and password
RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
# Update the package manager, then install packages.
RUN apt-get update && \
apt-get install --assume-yes \
apache2 \
nano \
openssh-server \
wget \
sudo \
php5.6 \
libapache2-mod-php5.6 \
php5.6-mysql \
php5.6-apc \
php5.6-fpm \
php5.6-cli \
php5.6-common \
php5.6-dev \
php5.6-gd \
php5.6-gettext \
php5.6-mbstring \
php5.6-xdebug \
php5.6-xml \
php5.6-opcache \
php5.6-sqlite3 \
php5.6-mysql \
php5.6-mcrypt \
php5.6-curl \
php5.6-soap \
php5.6-phar \
php5.6-cgi \
php5.6-ldap \
php5.6-zip \
php5.6-simplexml \
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
## create wcms-common.conf which contains header information including CSP.
RUN echo $'Header Always set X-UA-Compatible: \"IE=edge\" \n\
# Added as DENY for RT#395748, changed after problems for RT#397113 \n\
Header Always set X-Frame-Options: \"SAMEORIGIN\" \n\
# RT#395747 \n\
Header Always set X-Content-Type-Options: \"nosniff\" \n\
# RT#395745: Content-Security-Policy \n\
Header Always set Content-Security-Policy: \"default-src 'self' 'unsafe-inline' 'unsafe-eval' \n\
data: https://uwaterloo.ca https://*.uwaterloo.ca https://${vgrtserver}7 https://${vgrtserver}7alt https://${vgrtserver}8 https://${vgrtserver}8alt https://${vgrtserver}7rel https://${vgrtserver}7lrel https://${vgrtserver}7os https://maxcdn.bootstrapcdn.com \n\
https://maxcdn.bootstrapcdn.com https://*.google.com https://*.google-analytics.com https://*.googleapis.com https://*.gstatic.com https://*.googletagmanager.com https://*.googleusercontent.com https://stats.g.doubleclick.net https://6263835.fls.doubleclick.net https://cdnjs.cloudflare.com https://*.twitter.com https://*.twimg.com https://twitter-widgets.s3.amazonaws.com https://*.facebook.com https://*.facebook.net https://*.youtube.com https://*.youtube-nocookie.com https://*.livestream.com https://*.webspellchecker.net https://cdn.mathjax.org https://storify.com https://*.addtoany.com https://*.vimeo.com https://*.vimeocdn.com https://*.tintup.com https://*.71n7.com https://d36hc0p18k1aoc.cloudfront.net https://cdn.leafletjs.com https://cdn-geoweb.s3.amazonaws.com https://cdn.maptiks.com https://api.tiles.mapbox.com https://d591zijq8zntj.cloudfront.net https://*.libanswers.com https://secure.skype.com https://cdn-akamai.mookie1.com https://*.tiqcdn.com https://o2.eyereturn.com https://snap.licdn.com https://*.hscampaigns.com; img-src * data:\n\"
' > /etc/apache2/conf-available/wcms-common.conf
## enable the wcms-common config we created
RUN a2enconf wcms-common
## make www-data use /bin/bash for shell
RUN chsh -s /bin/bash www-data
## enable mcrypt
RUN phpenmod mcrypt
## Install Drupal Coder
##echo "Install Drupal Coder"
RUN composer global require drupal/coder
## Install Codesniffer
##echo "Install CodeSniffer"
RUN composer global require "squizlabs/php_codesniffer=*"
## Config CodeSniffer to use Drupal coding standards
RUN phpcs --config-set installed_paths /home/vagrant/.config/composer/vendor/drupal/coder/coder_sniffer
## Install PHP Mess Detector
##echo "Install Drupal Mess Detector"
RUN composer global require phpmd/phpmd
## Install phpcodesniffer-composer-installer to automagically add drupal coding standards to codesniffer
RUN composer global require dealerdirect/phpcodesniffer-composer-installer
# 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
# 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:-docker7}"
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:-docker7.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.
<VirtualHost *:80>
DocumentRoot /var/www/drupal8
ServerAdmin webmaster@localhost
ServerName docker8
Redirect permanent / https://docker8/
<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/drupal8
ServerName docker8
<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! #
# #
################################################################################
RUN export 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
## For ubuntu xenial we need to add some repos for the latest PHP version
RUN export DEBIAN_FRONTEND=noninteractive
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
## Pre-configure mysql username and password
RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
# 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:-docker8}"
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:-docker8.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.
<VirtualHost *:80>
DocumentRoot /var/www/drupal
DocumentRoot /var/www/drupal8
ServerAdmin webmaster@localhost
ServerName docker8
Redirect permanent / https://docker8/
......@@ -16,7 +16,7 @@
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/drupal
DocumentRoot /var/www/drupal8
ServerName docker8
<Directory />
Options FollowSymLinks
......
......@@ -10,6 +10,7 @@ services:
stdin_open: true
tty: true
db:
container_name: wcms-mysql
......@@ -34,17 +35,39 @@ services:
PHP_UPLOAD_MAX_FILESIZE: 1G
PHP_MAX_INPUT_VARS: 1G
ports:
- "8001:80"
- "8001:80"
labels:
- 'traefik.backend=pma'
- 'traefik.port=8001'
#- 'traefik.frontend.rule=Host:pma.docker8'
portainer:
container_name: wcms-portainer
image: portainer/portainer
command: -H unix:///var/run/docker.sock
ports:
- "9000:9000"
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
labels:
- 'traefik.backend=portainer'
- 'traefik.port=9000'
#- 'traefik.frontend.rule=Host:portainer.docker8'
traefik:
image: traefik
container_name: "wcms_traefik"
command: -c /dev/null --web --docker --logLevel=INFO
ports:
- '8080:8080'
- '8081:8081' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- 'traefik.backend: traefik'
- 'traefik.enable: true'
- 'traefik.port=8080'
volumes:
portainer_data:
\ No newline at end of file
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