Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit 144e1ba

Browse files
author
Alex Agile
committed
Docker infrastructure added
1 parent 82055df commit 144e1ba

10 files changed

+498
-0
lines changed

docker-compose.override.yml.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3'
2+
3+
services:
4+
apache:
5+
environment:
6+
- APP_DOMAIN=vhost-app-name
7+
- APP_DOC_ROOT=/var/www/public
8+
- APACHE_SERVERNAME=apache-servername
9+
mysql:
10+
environment:
11+
- MYSQL_ROOT_PASSWORD=root-passwd
12+
- MYSQL_DATABASE=db-name
13+
- MYSQL_USER=db-user
14+
- MYSQL_PASSWORD=db-user-passwd

docker-compose.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
version: '3'
2+
3+
volumes:
4+
jira_custom_dashboard-mysql_data:
5+
driver: local
6+
7+
networks:
8+
jira_custom_dashboard-network:
9+
driver: bridge
10+
ipam:
11+
driver: default
12+
config:
13+
- subnet: 172.72.0.0/24
14+
15+
services:
16+
apache:
17+
build: docker/apache
18+
working_dir: /var/www/
19+
environment:
20+
- APACHE_RUN_USER=www-data
21+
- APACHE_RUN_GROUP=www-data
22+
- APACHE_PID_FILE=/var/run/apache2/apache2.pid
23+
- APACHE_RUN_DIR=/var/run/apache2
24+
- APACHE_LOCK_DIR=/var/lock/apache2
25+
- APACHE_LOG_DIR=/var/log/apache2
26+
ports:
27+
- 80:80
28+
- 443:443
29+
networks:
30+
jira_custom_dashboard-network:
31+
aliases:
32+
- apache
33+
volumes:
34+
- .:/var/www
35+
tty: true
36+
37+
mysql:
38+
container_name: mysql
39+
image: mysql:5.7
40+
ports:
41+
- 3306:3306
42+
networks:
43+
jira_custom_dashboard-network:
44+
aliases:
45+
- mysql
46+
ipv4_address: 172.72.0.101
47+
volumes:
48+
- jira_custom_dashboard-mysql_data:/var/lib/mysql
49+
50+
php:
51+
build: docker/php
52+
working_dir: /var/www/
53+
expose:
54+
- 9000
55+
networks:
56+
jira_custom_dashboard-network:
57+
aliases:
58+
- php
59+
volumes:
60+
- .:/var/www
61+
62+
# container usage:
63+
# docker-compose run testing /var/www/vendor/bin/phpunit
64+
cli:
65+
build: docker/php-cli
66+
working_dir: /var/www/
67+
ports:
68+
- 9090:9090
69+
networks:
70+
jira_custom_dashboard-network:
71+
aliases:
72+
- cli
73+
volumes:
74+
- .:/var/www
75+
76+
# container usage:
77+
# docker-compose run composer [command]
78+
composer:
79+
build: docker/composer
80+
working_dir: /var/www/
81+
networks:
82+
jira_custom_dashboard-network:
83+
aliases:
84+
- composer
85+
volumes:
86+
- .:/var/www
87+
command: -q

docker/apache/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM ubuntu:16.04
2+
MAINTAINER Alex Agile <[email protected]>
3+
4+
# Install apache
5+
RUN apt update && \
6+
apt dist-upgrade -y && \
7+
apt install -y \
8+
apache2 \
9+
apache2-utils
10+
11+
# add extensions
12+
RUN a2enmod \
13+
rewrite \
14+
ssl \
15+
proxy \
16+
proxy_fcgi
17+
18+
# Config apache
19+
COPY ./apache2.conf /etc/apache2/apache2.conf
20+
COPY ./vhosts.conf /etc/apache2/sites-available/vhosts.conf
21+
RUN a2ensite vhosts.conf
22+
RUN mkdir -p /var/lock/apache2 /var/run/apache2
23+
24+
# generate autosigned certs
25+
RUN openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -subj /CN=\${APP_DOMAIN} -keyout /etc/ssl/certs/app_cert.key -out /etc/ssl/certs/app_cert.crt
26+
27+
# start process
28+
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]

docker/apache/apache2.conf

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# This is the main Apache server configuration file. It contains the
2+
# configuration directives that give the server its instructions.
3+
# See http://httpd.apache.org/docs/2.4/ for detailed information about
4+
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
5+
# hints.
6+
#
7+
#
8+
# Summary of how the Apache 2 configuration works in Debian:
9+
# The Apache 2 web server configuration in Debian is quite different to
10+
# upstream's suggested way to configure the web server. This is because Debian's
11+
# default Apache2 installation attempts to make adding and removing modules,
12+
# virtual hosts, and extra configuration directives as flexible as possible, in
13+
# order to make automating the changes and administering the server as easy as
14+
# possible.
15+
16+
# It is split into several files forming the configuration hierarchy outlined
17+
# below, all located in the /etc/apache2/ directory:
18+
#
19+
# /etc/apache2/
20+
# |-- apache2.conf
21+
# | `-- ports.conf
22+
# |-- mods-enabled
23+
# | |-- *.load
24+
# | `-- *.conf
25+
# |-- conf-enabled
26+
# | `-- *.conf
27+
# `-- sites-enabled
28+
# `-- *.conf
29+
#
30+
#
31+
# * apache2.conf is the main configuration file (this file). It puts the pieces
32+
# together by including all remaining configuration files when starting up the
33+
# web server.
34+
#
35+
# * ports.conf is always included from the main configuration file. It is
36+
# supposed to determine listening ports for incoming connections which can be
37+
# customized anytime.
38+
#
39+
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
40+
# directories contain particular configuration snippets which manage modules,
41+
# global configuration fragments, or virtual host configurations,
42+
# respectively.
43+
#
44+
# They are activated by symlinking available configuration files from their
45+
# respective *-available/ counterparts. These should be managed by using our
46+
# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
47+
# their respective man pages for detailed information.
48+
#
49+
# * The binary is called apache2. Due to the use of environment variables, in
50+
# the default configuration, apache2 needs to be started/stopped with
51+
# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
52+
# work with the default configuration.
53+
54+
55+
# Global configuration
56+
#
57+
58+
ServerName ${APACHE_SERVERNAME}
59+
60+
#
61+
# ServerRoot: The top of the directory tree under which the server's
62+
# configuration, error, and log files are kept.
63+
#
64+
# NOTE! If you intend to place this on an NFS (or otherwise network)
65+
# mounted filesystem then please read the Mutex documentation (available
66+
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
67+
# you will save yourself a lot of trouble.
68+
#
69+
# Do NOT add a slash at the end of the directory path.
70+
#
71+
#ServerRoot "/etc/apache2"
72+
73+
#
74+
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
75+
#
76+
Mutex file:${APACHE_LOCK_DIR} default
77+
78+
#
79+
# PidFile: The file in which the server should record its process
80+
# identification number when it starts.
81+
# This needs to be set in /etc/apache2/envvars
82+
#
83+
PidFile ${APACHE_PID_FILE}
84+
85+
#
86+
# Timeout: The number of seconds before receives and sends time out.
87+
#
88+
Timeout 300
89+
90+
#
91+
# KeepAlive: Whether or not to allow persistent connections (more than
92+
# one request per connection). Set to "Off" to deactivate.
93+
#
94+
KeepAlive On
95+
96+
#
97+
# MaxKeepAliveRequests: The maximum number of requests to allow
98+
# during a persistent connection. Set to 0 to allow an unlimited amount.
99+
# We recommend you leave this number high, for maximum performance.
100+
#
101+
MaxKeepAliveRequests 100
102+
103+
#
104+
# KeepAliveTimeout: Number of seconds to wait for the next request from the
105+
# same client on the same connection.
106+
#
107+
KeepAliveTimeout 5
108+
109+
110+
# These need to be set in /etc/apache2/envvars
111+
User ${APACHE_RUN_USER}
112+
Group ${APACHE_RUN_GROUP}
113+
114+
#
115+
# HostnameLookups: Log the names of clients or just their IP addresses
116+
# e.g., www.apache.org (on) or 204.62.129.132 (off).
117+
# The default is off because it'd be overall better for the net if people
118+
# had to knowingly turn this feature on, since enabling it means that
119+
# each client request will result in AT LEAST one lookup request to the
120+
# nameserver.
121+
#
122+
HostnameLookups Off
123+
124+
# ErrorLog: The location of the error log file.
125+
# If you do not specify an ErrorLog directive within a <VirtualHost>
126+
# container, error messages relating to that virtual host will be
127+
# logged here. If you *do* define an error logfile for a <VirtualHost>
128+
# container, that host's errors will be logged there and not here.
129+
#
130+
ErrorLog ${APACHE_LOG_DIR}/error.log
131+
132+
#
133+
# LogLevel: Control the severity of messages logged to the error_log.
134+
# Available values: trace8, ..., trace1, debug, info, notice, warn,
135+
# error, crit, alert, emerg.
136+
# It is also possible to configure the log level for particular modules, e.g.
137+
# "LogLevel info ssl:warn"
138+
#
139+
LogLevel warn
140+
141+
# Include module configuration:
142+
IncludeOptional mods-enabled/*.load
143+
IncludeOptional mods-enabled/*.conf
144+
145+
# Include list of ports to listen on
146+
Include ports.conf
147+
148+
149+
# Sets the default security model of the Apache2 HTTPD server. It does
150+
# not allow access to the root filesystem outside of /usr/share and /var/www.
151+
# The former is used by web applications packaged in Debian,
152+
# the latter may be used for local directories served by the web server. If
153+
# your system is serving content from a sub-directory in /srv you must allow
154+
# access here, or in any related virtual host.
155+
<Directory />
156+
Options FollowSymLinks
157+
AllowOverride None
158+
Require all denied
159+
</Directory>
160+
161+
<Directory /usr/share>
162+
AllowOverride None
163+
Require all granted
164+
</Directory>
165+
166+
<Directory /var/www/>
167+
Options Indexes FollowSymLinks
168+
AllowOverride None
169+
Require all granted
170+
</Directory>
171+
172+
#<Directory /srv/>
173+
# Options Indexes FollowSymLinks
174+
# AllowOverride None
175+
# Require all granted
176+
#</Directory>
177+
178+
179+
180+
181+
# AccessFileName: The name of the file to look for in each directory
182+
# for additional configuration directives. See also the AllowOverride
183+
# directive.
184+
#
185+
AccessFileName .htaccess
186+
187+
#
188+
# The following lines prevent .htaccess and .htpasswd files from being
189+
# viewed by Web clients.
190+
#
191+
<FilesMatch "^\.ht">
192+
Require all denied
193+
</FilesMatch>
194+
195+
196+
#
197+
# The following directives define some format nicknames for use with
198+
# a CustomLog directive.
199+
#
200+
# These deviate from the Common Log Format definitions in that they use %O
201+
# (the actual bytes sent including headers) instead of %b (the size of the
202+
# requested file), because the latter makes it impossible to detect partial
203+
# requests.
204+
#
205+
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
206+
# Use mod_remoteip instead.
207+
#
208+
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
209+
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
210+
LogFormat "%h %l %u %t \"%r\" %>s %O" common
211+
LogFormat "%{Referer}i -> %U" referer
212+
LogFormat "%{User-agent}i" agent
213+
214+
# Include of directories ignores editors' and dpkg's backup files,
215+
# see README.Debian for details.
216+
217+
# Include generic snippets of statements
218+
IncludeOptional conf-enabled/*.conf
219+
220+
# Include the virtual host configurations:
221+
IncludeOptional sites-enabled/*.conf
222+
223+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

docker/apache/vhosts.conf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
DirectoryIndex index.php index.html
2+
3+
<VirtualHost *:80>
4+
ServerName ${APP_DOMAIN}
5+
ServerAlias localhost
6+
7+
DocumentRoot ${APP_DOC_ROOT}
8+
9+
<Directory "${APP_DOC_ROOT}">
10+
AllowOverride All
11+
Options -Indexes +FollowSymLinks
12+
Require all granted
13+
</Directory>
14+
ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://php:9000${APP_DOC_ROOT}"
15+
</VirtualHost>
16+
17+
<VirtualHost *:443>
18+
ServerName ${APP_DOMAIN}
19+
ServerAlias localhost
20+
21+
DocumentRoot ${APP_DOC_ROOT}
22+
23+
SSLEngine on
24+
SSLCipherSuite AES256+EECDH:AES256+EDH
25+
SSLProtocol All -SSLv2 -SSLv3
26+
SSLHonorCipherOrder On
27+
SSLCompression off
28+
SSLCertificateFile /etc/ssl/certs/app_cert.crt
29+
SSLCertificateKeyFile /etc/ssl/certs/app_cert.key
30+
31+
<Directory "${APP_DOC_ROOT}">
32+
AllowOverride All
33+
Options -Indexes +FollowSymLinks
34+
Require all granted
35+
</Directory>
36+
ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://php:9000${APP_DOC_ROOT}"
37+
</VirtualHost>

0 commit comments

Comments
 (0)