Skip to content

Commit 61b7840

Browse files
author
hernandito
committed
Initial Adding of Files
1 parent 44a1b2c commit 61b7840

9 files changed

+415
-0
lines changed

Dockerfile

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
FROM phusion/baseimage:0.9.15
2+
MAINTAINER nando
3+
4+
# Set correct environment variables
5+
ENV DEBIAN_FRONTEND noninteractive
6+
ENV HOME /root
7+
ENV LC_ALL C.UTF-8
8+
ENV LANG en_US.UTF-8
9+
ENV LANGUAGE en_US.UTF-8
10+
ENV TERM xterm
11+
12+
13+
# Use baseimage-docker's init system
14+
CMD ["/sbin/my_init"]
15+
16+
17+
# Configure user nobody to match unRAID's settings
18+
RUN \
19+
usermod -u 99 nobody && \
20+
usermod -g 100 nobody && \
21+
usermod -d /home nobody && \
22+
chown -R nobody:users /home
23+
24+
25+
RUN apt-get update
26+
RUN apt-get install -qy mc
27+
RUN apt-get install -qy tmux
28+
29+
30+
# Install proxy Dependencies
31+
RUN \
32+
apt-get update -q && \
33+
apt-get install -qy apache2 php5 php5-common curl libcurl3 php5-curl libapache2-mod-php5 php-xml-parser php5-gd php5-sqlite php5-mcrypt php5-tidy php5-cli php5-mysql inotify-tools libapache2-mod-proxy-html && \
34+
apt-get clean -y && \
35+
rm -rf /var/lib/apt/lists/*
36+
37+
RUN \
38+
service apache2 restart && \
39+
rm -R -f /var/www && \
40+
ln -s /web /var/www
41+
42+
# Update apache configuration with this one
43+
RUN \
44+
mv /etc/apache2/sites-available/000-default.conf /etc/apache2/000-default.conf && \
45+
rm /etc/apache2/sites-available/* && \
46+
rm /etc/apache2/apache2.conf && \
47+
ln -s /config/proxy-config.conf /etc/apache2/sites-available/000-default.conf && \
48+
ln -s /var/log/apache2 /logs
49+
50+
ADD proxy-config.conf /etc/apache2/000-default.conf
51+
ADD apache2.conf /etc/apache2/apache2.conf
52+
ADD ports.conf /etc/apache2/ports.conf
53+
54+
# Manually set the apache environment variables in order to get apache to work immediately.
55+
RUN \
56+
echo www-data > /etc/container_environment/APACHE_RUN_USER && \
57+
echo www-data > /etc/container_environment/APACHE_RUN_GROUP && \
58+
echo /var/log/apache2 > /etc/container_environment/APACHE_LOG_DIR && \
59+
echo /var/lock/apache2 > /etc/container_environment/APACHE_LOCK_DIR && \
60+
echo /var/run/apache2.pid > /etc/container_environment/APACHE_PID_FILE && \
61+
echo /var/run/apache2 > /etc/container_environment/APACHE_RUN_DIR
62+
63+
# Expose Ports
64+
EXPOSE 80 443
65+
66+
# The www directory and proxy config location
67+
VOLUME ["/config", "/web", "/logs"]
68+
69+
70+
# Add our crontab file
71+
ADD crons.conf /root/crons.conf
72+
# Use the crontab file
73+
74+
75+
76+
77+
# Add firstrun.sh to execute during container startup
78+
ADD firstrun.sh /etc/my_init.d/firstrun.sh
79+
RUN chmod +x /etc/my_init.d/firstrun.sh
80+
81+
# Add inotify.sh to execute during container startup
82+
RUN mkdir /etc/service/inotify
83+
ADD inotify.sh /etc/service/inotify/run
84+
RUN chmod +x /etc/service/inotify/run
85+
86+
RUN mkdir /var/www/snarf
87+
88+
# Add apache to runit
89+
RUN mkdir /etc/service/apache
90+
ADD apache-run.sh /etc/service/apache/run
91+
RUN chmod +x /etc/service/apache/run
92+
ADD apache-finish.sh /etc/service/apache/finish
93+
RUN chmod +x /etc/service/apache/finish

apache-finish.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
service apache2 stop

apache-run.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
exec /usr/sbin/apache2 -D FOREGROUND

apache2.conf

+237
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
#
2+
# Based upon the NCSA server configuration files originally by Rob McCool.
3+
#
4+
# This is the main Apache server configuration file. It contains the
5+
# configuration directives that give the server its instructions.
6+
# See http://httpd.apache.org/docs/2.2/ for detailed information about
7+
# the directives.
8+
#
9+
# Do NOT simply read the instructions in here without understanding
10+
# what they do. They're here only as hints or reminders. If you are unsure
11+
# consult the online docs. You have been warned.
12+
#
13+
# The configuration directives are grouped into three basic sections:
14+
# 1. Directives that control the operation of the Apache server process as a
15+
# whole (the 'global environment').
16+
# 2. Directives that define the parameters of the 'main' or 'default' server,
17+
# which responds to requests that aren't handled by a virtual host.
18+
# These directives also provide default values for the settings
19+
# of all virtual hosts.
20+
# 3. Settings for virtual hosts, which allow Web requests to be sent to
21+
# different IP addresses or hostnames and have them handled by the
22+
# same Apache server process.
23+
#
24+
# Configuration and logfile names: If the filenames you specify for many
25+
# of the server's control files begin with "/" (or "drive:/" for Win32), the
26+
# server will use that explicit path. If the filenames do *not* begin
27+
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
28+
# with ServerRoot set to "" will be interpreted by the
29+
# server as "//var/log/apache2/foo.log".
30+
#
31+
32+
### Section 1: Global Environment
33+
#
34+
# The directives in this section affect the overall operation of Apache,
35+
# such as the number of concurrent requests it can handle or where it
36+
# can find its configuration files.
37+
#
38+
39+
#
40+
# ServerRoot: The top of the directory tree under which the server's
41+
# configuration, error, and log files are kept.
42+
#
43+
# NOTE! If you intend to place this on an NFS (or otherwise network)
44+
# mounted filesystem then please read the LockFile documentation (available
45+
# at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
46+
# you will save yourself a lot of trouble.
47+
#
48+
# Do NOT add a slash at the end of the directory path.
49+
#
50+
ServerRoot "/var/www"
51+
ServerName localhost
52+
53+
#
54+
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
55+
#
56+
#<IfModule !mpm_winnt.c>
57+
#<IfModule !mpm_netware.c>
58+
#LockFile /var/lock/apache2/accept.lock
59+
#</IfModule>
60+
#</IfModule>
61+
62+
#
63+
# PidFile: The file in which the server should record its process
64+
# identification number when it starts.
65+
# This needs to be set in /etc/apache2/envvars
66+
#
67+
PidFile ${APACHE_PID_FILE}
68+
69+
#
70+
# Timeout: The number of seconds before receives and sends time out.
71+
#
72+
Timeout 300
73+
74+
#
75+
# KeepAlive: Whether or not to allow persistent connections (more than
76+
# one request per connection). Set to "Off" to deactivate.
77+
#
78+
KeepAlive On
79+
80+
#
81+
# MaxKeepAliveRequests: The maximum number of requests to allow
82+
# during a persistent connection. Set to 0 to allow an unlimited amount.
83+
# We recommend you leave this number high, for maximum performance.
84+
#
85+
MaxKeepAliveRequests 100
86+
87+
#
88+
# KeepAliveTimeout: Number of seconds to wait for the next request from the
89+
# same client on the same connection.
90+
#
91+
KeepAliveTimeout 15
92+
93+
##
94+
## Server-Pool Size Regulation (MPM specific)
95+
##
96+
97+
# prefork MPM
98+
# StartServers: number of server processes to start
99+
# MinSpareServers: minimum number of server processes which are kept spare
100+
# MaxSpareServers: maximum number of server processes which are kept spare
101+
# MaxClients: maximum number of server processes allowed to start
102+
# MaxRequestsPerChild: maximum number of requests a server process serves
103+
<IfModule mpm_prefork_module>
104+
StartServers 5
105+
MinSpareServers 5
106+
MaxSpareServers 10
107+
MaxClients 150
108+
MaxRequestsPerChild 0
109+
</IfModule>
110+
111+
# worker MPM
112+
# StartServers: initial number of server processes to start
113+
# MaxClients: maximum number of simultaneous client connections
114+
# MinSpareThreads: minimum number of worker threads which are kept spare
115+
# MaxSpareThreads: maximum number of worker threads which are kept spare
116+
# ThreadsPerChild: constant number of worker threads in each server process
117+
# MaxRequestsPerChild: maximum number of requests a server process serves
118+
<IfModule mpm_worker_module>
119+
StartServers 2
120+
MinSpareThreads 25
121+
MaxSpareThreads 75
122+
ThreadLimit 64
123+
ThreadsPerChild 25
124+
MaxClients 150
125+
MaxRequestsPerChild 0
126+
</IfModule>
127+
128+
# event MPM
129+
# StartServers: initial number of server processes to start
130+
# MaxClients: maximum number of simultaneous client connections
131+
# MinSpareThreads: minimum number of worker threads which are kept spare
132+
# MaxSpareThreads: maximum number of worker threads which are kept spare
133+
# ThreadsPerChild: constant number of worker threads in each server process
134+
# MaxRequestsPerChild: maximum number of requests a server process serves
135+
<IfModule mpm_event_module>
136+
StartServers 2
137+
MaxClients 150
138+
MinSpareThreads 25
139+
MaxSpareThreads 75
140+
ThreadLimit 64
141+
ThreadsPerChild 25
142+
MaxRequestsPerChild 0
143+
</IfModule>
144+
145+
# These need to be set in /etc/apache2/envvars
146+
User ${APACHE_RUN_USER}
147+
Group ${APACHE_RUN_GROUP}
148+
149+
#
150+
# AccessFileName: The name of the file to look for in each directory
151+
# for additional configuration directives. See also the AllowOverride
152+
# directive.
153+
#
154+
155+
AccessFileName .htaccess
156+
157+
#
158+
# The following lines prevent .htaccess and .htpasswd files from being
159+
# viewed by Web clients.
160+
#
161+
<Files ~ "^\.ht">
162+
Order allow,deny
163+
Deny from all
164+
Satisfy all
165+
</Files>
166+
167+
#
168+
# DefaultType is the default MIME type the server will use for a document
169+
# if it cannot otherwise determine one, such as from filename extensions.
170+
# If your server contains mostly text or HTML documents, "text/plain" is
171+
# a good value. If most of your content is binary, such as applications
172+
# or images, you may want to use "application/octet-stream" instead to
173+
# keep browsers from trying to display binary files as though they are
174+
# text.
175+
#
176+
#DefaultType text/plain
177+
178+
179+
#
180+
# HostnameLookups: Log the names of clients or just their IP addresses
181+
# e.g., www.apache.org (on) or 204.62.129.132 (off).
182+
# The default is off because it'd be overall better for the net if people
183+
# had to knowingly turn this feature on, since enabling it means that
184+
# each client request will result in AT LEAST one lookup request to the
185+
# nameserver.
186+
#
187+
HostnameLookups Off
188+
189+
# ErrorLog: The location of the error log file.
190+
# If you do not specify an ErrorLog directive within a <VirtualHost>
191+
# container, error messages relating to that virtual host will be
192+
# logged here. If you *do* define an error logfile for a <VirtualHost>
193+
# container, that host's errors will be logged there and not here.
194+
#
195+
ErrorLog /var/log/apache2/error.log
196+
197+
#
198+
# LogLevel: Control the number of messages logged to the error_log.
199+
# Possible values include: debug, info, notice, warn, error, crit,
200+
# alert, emerg.
201+
#
202+
LogLevel warn
203+
204+
# Include module configuration:
205+
Include /etc/apache2/mods-enabled/*.load
206+
Include /etc/apache2/mods-enabled/*.conf
207+
208+
# Include all the user configurations:
209+
#Include /etc/apache2/httpd.conf
210+
211+
# Include ports listing
212+
Include /etc/apache2/ports.conf
213+
214+
#
215+
# The following directives define some format nicknames for use with
216+
# a CustomLog directive (see below).
217+
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
218+
#
219+
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
220+
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
221+
LogFormat "%h %l %u %t \"%r\" %>s %O" common
222+
LogFormat "%{Referer}i -> %U" referer
223+
LogFormat "%{User-agent}i" agent
224+
225+
#
226+
# Define an access log for VirtualHosts that don't define their own logfile
227+
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
228+
229+
230+
# Include of directories ignores editors' and dpkg's backup files,
231+
# see README.Debian for details.
232+
233+
# Include generic snippets of statements
234+
#Include /etc/apache2/conf.d/
235+
236+
# Include the virtual host configurations:
237+
Include /etc/apache2/sites-enabled/

crons.conf

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#1 * * * * add any cron strings here

firstrun.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Check if config exists. If not, copy in the sample config
4+
if [ -f /config/proxy-config.conf ]; then
5+
echo "Using existing config file."
6+
else
7+
echo "Creating config from template."
8+
mv /etc/apache2/000-default.conf /config/proxy-config.conf
9+
fi
10+
11+
# Add Persistent Cron Configuration Capability
12+
if [ -f /config/crons.conf ]; then
13+
echo "Using existing Cron config file."
14+
crontab /config/crons.conf
15+
cron
16+
else
17+
echo "Copying blank Cron config file."
18+
cp /root/crons.conf /config/crons.conf
19+
crontab /config/crons.conf
20+
cron
21+
fi

inotify.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
while inotifywait -e modify /config; do
4+
sv down /etc/service/apache/
5+
sv up /etc/service/apache/
6+
echo "File in Config Folder Changed, Restarted"
7+
done

ports.conf

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# If you just change the port or add more ports here, you will likely also
2+
# have to change the VirtualHost statement in
3+
# /etc/apache2/sites-enabled/000-default.conf
4+
5+
Listen 80
6+
Listen 443
7+
8+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

0 commit comments

Comments
 (0)