-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c826a53
commit d859edf
Showing
12 changed files
with
278 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM httpd:2.4 | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
nano \ | ||
openssl \ | ||
gettext | ||
|
||
COPY config/httpd.conf /usr/local/apache2/conf/httpd.conf | ||
COPY config/server.conf /usr/local/apache2/conf.d/server.conf | ||
COPY config/local-server.conf /usr/local/apache2/conf.d/local-server.conf | ||
COPY config/remote-server.conf /usr/local/apache2/conf.d/remote-server.conf | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
CMD /entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# The main httpd definition file | ||
ServerRoot "/usr/local/apache2" | ||
|
||
Listen 80 | ||
Listen 443 | ||
Listen 8443 | ||
|
||
# Add the required modules here | ||
LoadModule alias_module modules/mod_alias.so | ||
LoadModule authz_core_module modules/mod_authz_core.so | ||
LoadModule deflate_module modules/mod_deflate.so | ||
LoadModule dir_module modules/mod_dir.so | ||
LoadModule filter_module modules/mod_filter.so | ||
LoadModule log_config_module modules/mod_log_config.so | ||
LoadModule logio_module modules/mod_logio.so | ||
LoadModule mime_magic_module modules/mod_mime_magic.so | ||
LoadModule mime_module modules/mod_mime.so | ||
LoadModule mpm_event_module modules/mod_mpm_event.so | ||
LoadModule proxy_module modules/mod_proxy.so | ||
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so | ||
LoadModule rewrite_module modules/mod_rewrite.so | ||
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so | ||
LoadModule ssl_module modules/mod_ssl.so | ||
LoadModule unixd_module modules/mod_unixd.so | ||
LoadModule vhost_alias_module modules/mod_vhost_alias.so | ||
|
||
User daemon | ||
Group daemon | ||
|
||
<Directory "/"> | ||
AllowOverride none | ||
Require all denied | ||
</Directory> | ||
|
||
LogLevel info ssl:error | ||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | ||
LogFormat "%h %l %u %t \"%r\" %>s %b" common | ||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio | ||
CustomLog /dev/stdout combined | ||
ErrorLog /dev/stderr | ||
|
||
TypesConfig conf/mime.types | ||
AddType application/x-compress .Z | ||
AddType application/x-gzip .gz .tgz | ||
MIMEMagicFile conf/magic | ||
|
||
# Don't send server information header | ||
ServerSignature Off | ||
ServerTokens Prod | ||
|
||
EnableSendfile on | ||
|
||
# Supresses warning, isn't actually used as it is overrided by the vhosts | ||
ServerName totara | ||
|
||
SSLCertificateFile conf/server.crt | ||
SSLCertificateKeyFile conf/server.key | ||
|
||
UseCanonicalName Off | ||
|
||
<VirtualHost *:80> | ||
Include conf.d/server.conf | ||
Include conf.d/local-server.conf | ||
</VirtualHost> | ||
|
||
<VirtualHost *:443> | ||
SSLEngine on | ||
Include conf.d/server.conf | ||
Include conf.d/local-server.conf | ||
</VirtualHost> | ||
|
||
<VirtualHost *:8443> | ||
SSLEngine on | ||
Include conf.d/server.conf | ||
Include conf.d/remote-server.conf | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Here you can define how you want nginx to handle requests made from your local network. | ||
# You can do whatever you want here. | ||
|
||
# Unlimited upload size | ||
LimitRequestBody 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Here you can define how you want apache to handle requests made remotely via ngrok. | ||
# Take caution as potentially anyone on the internet could be able to access your machine if they have your ngrok URL. | ||
|
||
# Limit uploads to 10MB | ||
LimitRequestBody 10485760 | ||
|
||
# Don't allow the following files/directories to be accessed | ||
RewriteRule (cli|tests|db|lang|classes|amd\/src|rb_sources|yui\/src) - [R=404] | ||
RewriteRule \.(txt|md|json|xml|mustache) - [R=404] | ||
RewriteRule \/\. - [R=404] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Here are the server options that apply to all totara servers, regardless of whether | ||
# they are being accessed locally, or being accessed remotely (via ngrok) | ||
|
||
ServerAlias "totara*" | ||
ServerAlias "*.totara*" | ||
ServerAlias "totara*.behat" | ||
ServerAlias "*.totara*.behat" | ||
ServerAlias "totara*.debug" | ||
ServerAlias "*.totara*.debug" | ||
|
||
RewriteEngine on | ||
|
||
DocumentRoot "$REMOTE_SRC" | ||
|
||
# Direct php requests to the php-X.X container | ||
RewriteCond %{HTTP_HOST} totara(\d)(\d)(|\.behat)(:[0-9]+)?$ | ||
RewriteRule \.php - [H=proxy:fcgi://php-%1.%2:9000] | ||
|
||
# Direct xdebug requests to the php-X.X-debug container | ||
RewriteCond %{HTTP_HOST} totara(\d)(\d)\.debug(:[0-9]+)?$ | ||
RewriteRule \.php - [H=proxy:fcgi://php-%1.%2-debug:9000] | ||
|
||
# Handle if the site name is specified in the host, e.g. sitename.totara73 | ||
RewriteCond %{HTTP_HOST} ^(\w+)\.totara | ||
RewriteRule ^(.*)$ - [E=SITENAME:%1] | ||
|
||
# If the server directory exists, then rewrite it to use it | ||
RewriteCond %{DOCUMENT_ROOT}/%{ENV:SITENAME}/server/version.php -f | ||
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/%{ENV:SITENAME}/server$1 [QSA] | ||
|
||
# Otherwise don't use the server directory | ||
RewriteCond %{DOCUMENT_ROOT}/%{ENV:SITENAME}/server/version.php !-f | ||
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/%{ENV:SITENAME}$1 [QSA] | ||
|
||
# Allow accessing files in the src directory | ||
<Directory $REMOTE_SRC> | ||
AllowOverride All | ||
Require all granted | ||
</Directory> | ||
|
||
DirectoryIndex index.php index.html | ||
|
||
AddDefaultCharset UTF-8 | ||
|
||
# Enable gzip compression for these file types | ||
AddOutputFilterByType DEFLATE text/plain | ||
AddOutputFilterByType DEFLATE text/css | ||
AddOutputFilterByType DEFLATE application/json | ||
AddOutputFilterByType DEFLATE application/x-javascript | ||
AddOutputFilterByType DEFLATE text/xml | ||
AddOutputFilterByType DEFLATE application/xml | ||
AddOutputFilterByType DEFLATE application/xml+rss | ||
AddOutputFilterByType DEFLATE text/javascript | ||
AddOutputFilterByType DEFLATE image/svg+xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
echo "Using data folder: $REMOTE_DATA" | ||
|
||
cd $REMOTE_DATA || return; | ||
|
||
echo "Creating data folders..." | ||
|
||
versions=("22" "24" "25" "26" "27" "29" "9" "10" "11" "12" "13" "14" "15") | ||
|
||
for i in "${versions[@]}" | ||
do | ||
: | ||
echo "Creating folders for version $i" | ||
mkdir -p "ver$i.mssql" "ver$i.mysql" "ver$i.pgsql" | ||
chown -R www-data:www-data ver$i.mssql ver$i.mysql ver$i.pgsql | ||
chmod g+s "ver$i.mssql" "ver$i.mysql" "ver$i.pgsql" | ||
|
||
mkdir -p "ver$i.mssql.phpunit" "ver$i.mysql.phpunit" "ver$i.pgsql.phpunit" "ver$i.pgsql.behat" | ||
chown -R www-data:www-data ver$i.pgsql.behat | ||
chmod g+s "ver$i.pgsql.behat" | ||
done | ||
|
||
echo "done" | ||
|
||
# if there's no ssl certificate yet create it | ||
if [ ! -f "/usr/local/apache2/conf/server.crt" ]; then | ||
openssl req \ | ||
-new \ | ||
-newkey rsa:4096 \ | ||
-days 3650 \ | ||
-nodes \ | ||
-x509 \ | ||
-subj "/C=US/ST=CA/L=SF/O=Docker-demo/CN=totara" \ | ||
-keyout /usr/local/apache2/conf/server.key \ | ||
-out /usr/local/apache2/conf/server.crt | ||
fi | ||
|
||
# Replace the remote src variable in the nginx configuration with | ||
# the one defined in the environment variables | ||
cp /usr/local/apache2/conf.d/server.conf /tmp/temp.conf | ||
envsubst '$REMOTE_SRC' < /tmp/temp.conf > /usr/local/apache2/conf.d/server.conf | ||
rm /tmp/temp.conf | ||
|
||
httpd -D "FOREGROUND" -k start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
version: "3.7" | ||
services: | ||
|
||
apache: | ||
image: totara/docker-dev-apache | ||
container_name: totara_apache | ||
environment: | ||
- TZ=${TIME_ZONE} | ||
- REMOTE_DATA | ||
- REMOTE_SRC | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
- "8443:8443" # ngrok only | ||
volumes: | ||
- ${LOCAL_SRC}:${REMOTE_SRC} | ||
- totara-data:${REMOTE_DATA} | ||
depends_on: | ||
- mailcatcher | ||
networks: | ||
totara: | ||
aliases: | ||
- totara54 | ||
- totara54.debug | ||
- totara54.behat | ||
- totara54.behat.totaralms.com | ||
- totara55 | ||
- totara55.debug | ||
- totara55.behat | ||
- totara55.behat.totaralms.com | ||
- totara56 | ||
- totara56.debug | ||
- totara56.behat | ||
- totara56.behat.totaralms.com | ||
- totara70 | ||
- totara70.debug | ||
- totara70.behat | ||
- totara70.behat.totaralms.com | ||
- totara71 | ||
- totara71.debug | ||
- totara71.behat | ||
- totara71.behat.totaralms.com | ||
- totara72 | ||
- totara72.debug | ||
- totara72.behat | ||
- totara72.behat.totaralms.com | ||
- totara73 | ||
- totara73.debug | ||
- totara73.behat | ||
- totara73.behat.totaralms.com | ||
- totara74 | ||
- totara74.debug | ||
- totara74.behat | ||
- totara74.behat.totaralms.com | ||
- totara80 | ||
- totara80.behat | ||
- totara80.behat.totaralms.com | ||
- totara81 | ||
- totara81.behat | ||
- totara81.behat.totaralms.com | ||
|
||
volumes: | ||
totara-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
version: "3.7" | ||
services: | ||
|
||
apache: | ||
build: ./apache | ||
|
||
nginx: | ||
build: ./nginx | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters