diff --git a/Dockerfile b/Dockerfile index 04f30af..6358931 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,22 @@ -FROM linuxserver/baseimage -MAINTAINER LinuxServer.io -# apache environment settings -ENV APACHE_RUN_USER=abc APACHE_RUN_GROUP=users APACHE_LOG_DIR="/var/log/apache2" APACHE_LOCK_DIR="/var/lock/apache2" APACHE_PID_FILE="/var/run/apache2.pid" +FROM lsiobase/alpine +MAINTAINER LinuxServer.io , sparklyballs -#Applying stuff -RUN apt-get update && \ -apt-get install -y apache2 smokeping ssmtp && \ -rm /etc/ssmtp/ssmtp.conf && \ -ln -s /etc/smokeping/apache2.conf /etc/apache2/conf-available/apache2.conf && \ -a2enconf apache2 && \ -a2enmod cgid && \ -apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# install packages +RUN \ + apk add --no-cache \ + apache2 \ + apache2-utils \ + smokeping \ + ssmtp \ + sudo +# give abc sudo access to traceroute +RUN \ + echo "abc ALL=(ALL) NOPASSWD: /usr/bin/traceroute" >> /etc/sudoers.d/traceroute -#Adding Custom files -ADD config.d/ /etc/smokeping/config.d/ -ADD init/ /etc/my_init.d/ -ADD services/ /etc/service/ -ADD Targets /tmp/Targets -ADD ssmtp.conf /tmp/ssmtp.conf -ADD config /etc/smokeping/config -RUN chmod -v +x /etc/service/*/run -RUN chmod -v +x /etc/my_init.d/*.sh -RUN mkdir /var/run/smokeping +# add local files +COPY root/ / -# Use baseimage-docker's init system -CMD ["/sbin/my_init"] - -# Volumes and Ports -VOLUME /config -VOLUME /data +# ports and volumes EXPOSE 80 +VOLUME /config /data diff --git a/README.md b/README.md index f57703d..c581395 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -![http://linuxserver.io](http://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) +![https://linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) -The [LinuxServer.io](http://linuxserver.io) team brings you another quality container release featuring auto-update on startup, easy user mapping and community support. Be sure to checkout our [forums](http://forum.linuxserver.io) or for real-time support our [IRC](http://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io`. +The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring easy user mapping and community support. Find us for support at: +* [forum.linuxserver.io](https://forum.linuxserver.io) +* [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io` +* [Podcast](https://www.linuxserver.io/index.php/category/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! # linuxserver/smokeping @@ -13,12 +16,12 @@ docker create \ --name smokeping \ -p 8080:80 \ -e PUID= -e PGID= \ + -e TZ= \ -v :/data \ -v :/config \ linuxserver/smokeping ``` -Once running the URL will be `http://:8080/cgi-bin/smokeping.cgi`. **Parameters** @@ -27,32 +30,34 @@ Once running the URL will be `http://:8080/cgi-bin/smokeping.cgi`. * `-v /config` - Configure the `Targets` file here * `-e PGID` for for GroupID - see below for explanation * `-e PUID` for for UserID - see below for explanation +* `-e TZ` for timezone setting, eg Europe/London -This container is based on phusion-baseimage with ssh removed, for shell access whilst the container is running do `docker exec -it smokeping /bin/bash`. +This container is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it smokeping /bin/bash`. ### User / Group Identifiers -**TL;DR** - The `PGID` and `PUID` values set the user / group you'd like your container to 'run as' to the host OS. This can be a user you've created or even root (not recommended). +Sometimes when using data volumes (`-v` flags) permissions issues can arise between the host OS and the container. We avoid this issue by allowing you to specify the user `PUID` and group `PGID`. Ensure the data volume directory on the host is owned by the same user you specify and it will "just work" TM. -Part of what makes our containers work so well is by allowing you to specify your own `PUID` and `PGID`. This avoids nasty permissions errors with relation to data volumes (`-v` flags). When an application is installed on the host OS it is normally added to the common group called users, Docker apps due to the nature of the technology can't be added to this group. So we added this feature to let you easily choose when running your containers. +In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as below: + +``` + $ id dockeruser + uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) +``` ## Setting up the application -Full guide coming soon... +Once running the URL will be `http://:8080/smokeping/smokeping.cgi`. -Basics are, edit the Targets file to ping the hosts you're interested in to match the format found here. Wait 10 minutes. +Basics are, edit the Targets file to ping the hosts you're interested in to match the format found there. +Wait 10 minutes. -## Updates +## Info -* Upgrade to the latest version simply `docker restart smokeping`. * To monitor the logs of the container in realtime `docker logs -f smokeping`. -**Credits** - -* IronicBadger -* lonix - **Version** ++ **25.07.16:** Rebase to alpine linux. + **23.07.16:** Fix apt script confusion. + **29.06.15:** This is the first release, it is mostly stable, but may contain minor defects. (thus a beta tag) diff --git a/config b/config deleted file mode 100644 index 8be1db1..0000000 --- a/config +++ /dev/null @@ -1,7 +0,0 @@ -@include /etc/smokeping/config.d/General -@include /etc/smokeping/config.d/Alerts -@include /etc/smokeping/config.d/Database -@include /etc/smokeping/config.d/Presentation -@include /etc/smokeping/config.d/Probes -@include /etc/smokeping/config.d/Slaves -@include /config/Targets \ No newline at end of file diff --git a/init/01_new_user.sh b/init/01_new_user.sh deleted file mode 100644 index c80565a..0000000 --- a/init/01_new_user.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ ! "$(id -u abc)" -eq "$PUID" ]; then usermod -u "$PUID" abc ; fi -if [ ! "$(id -g abc)" -eq "$PGID" ]; then groupmod -o -g "$PGID" abc ; fi - -echo " ------------------------------------ -GID/UID ------------------------------------ -User uid: $(id -u abc) -User gid: $(id -g abc) ------------------------------------ -" \ No newline at end of file diff --git a/init/02_set_data_perms.sh b/init/02_set_data_perms.sh deleted file mode 100644 index f76be50..0000000 --- a/init/02_set_data_perms.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -chown -R abc:users /data /config diff --git a/init/10_check_config.sh b/init/10_check_config.sh deleted file mode 100644 index 00ff0a5..0000000 --- a/init/10_check_config.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -if [ ! -f /config/Targets ]; then - cp /tmp/Targets /config/Targets - chown abc:abc /config/Targets -fi \ No newline at end of file diff --git a/init/20_ssmtp_config.sh b/init/20_ssmtp_config.sh deleted file mode 100644 index b65c55a..0000000 --- a/init/20_ssmtp_config.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -if [ ! -f /config/smtp.conf ]; then -cp /tmp/ssmtp.conf /config/smtp.conf -fi -chown abc:abc /config/smtp.conf -cp /config/smtp.conf /etc/ssmtp/ssmtp.conf diff --git a/root/defaults/smoke-conf/Alerts b/root/defaults/smoke-conf/Alerts new file mode 100644 index 0000000..cbcfc41 --- /dev/null +++ b/root/defaults/smoke-conf/Alerts @@ -0,0 +1,10 @@ +*** Alerts *** +to = alertee@address.somewhere +from = smokealert@company.xy + ++someloss +type = loss +# in percent +pattern = >0%,*12*,>0%,*12*,>0% +comment = loss 3 times in a row + diff --git a/root/defaults/smoke-conf/Database b/root/defaults/smoke-conf/Database new file mode 100644 index 0000000..0ca91f6 --- /dev/null +++ b/root/defaults/smoke-conf/Database @@ -0,0 +1,15 @@ +*** Database *** + +step = 300 +pings = 20 + +# consfn mrhb steps total + +AVERAGE 0.5 1 1008 +AVERAGE 0.5 12 4320 + MIN 0.5 12 4320 + MAX 0.5 12 4320 +AVERAGE 0.5 144 720 + MAX 0.5 144 720 + MIN 0.5 144 720 + diff --git a/config.d/General b/root/defaults/smoke-conf/General similarity index 91% rename from config.d/General rename to root/defaults/smoke-conf/General index cd88003..cb3812a 100644 --- a/config.d/General +++ b/root/defaults/smoke-conf/General @@ -13,4 +13,4 @@ syslogfacility = local0 # disable this to revert to the old behaviour # concurrentprobes = no -@include /etc/smokeping/config.d/pathnames \ No newline at end of file +@include /config/pathnames diff --git a/root/defaults/smoke-conf/Presentation b/root/defaults/smoke-conf/Presentation new file mode 100644 index 0000000..4ed9b4c --- /dev/null +++ b/root/defaults/smoke-conf/Presentation @@ -0,0 +1,57 @@ +*** Presentation *** + +template = /etc/smokeping/basepage.html +charset = utf-8 + ++ charts + +menu = Charts +title = The most interesting destinations + +++ stddev +sorter = StdDev(entries=>4) +title = Top Standard Deviation +menu = Std Deviation +format = Standard Deviation %f + +++ max +sorter = Max(entries=>5) +title = Top Max Roundtrip Time +menu = by Max +format = Max Roundtrip Time %f seconds + +++ loss +sorter = Loss(entries=>5) +title = Top Packet Loss +menu = Loss +format = Packets Lost %f + +++ median +sorter = Median(entries=>5) +title = Top Median Roundtrip Time +menu = by Median +format = Median RTT %f seconds + ++ overview + +width = 600 +height = 50 +range = 10h + ++ detail + +width = 600 +height = 200 +unison_tolerance = 2 + +"Last 3 Hours" 3h +"Last 30 Hours" 30h +"Last 10 Days" 10d +"Last 360 Days" 360d + +#+ hierarchies +#++ owner +#title = Host Owner +#++ location +#title = Location + diff --git a/root/defaults/smoke-conf/Probes b/root/defaults/smoke-conf/Probes new file mode 100644 index 0000000..b95e9ac --- /dev/null +++ b/root/defaults/smoke-conf/Probes @@ -0,0 +1,6 @@ +*** Probes *** + ++ FPing + +binary = /usr/sbin/fping + diff --git a/root/defaults/smoke-conf/Slaves b/root/defaults/smoke-conf/Slaves new file mode 100644 index 0000000..be07d73 --- /dev/null +++ b/root/defaults/smoke-conf/Slaves @@ -0,0 +1,10 @@ +*** Slaves *** +secrets=/etc/smokeping/smokeping_secrets +#+boomer +#display_name=boomer +#color=0000ff + +#+slave2 +#display_name=another +#color=00ff00 + diff --git a/Targets b/root/defaults/smoke-conf/Targets similarity index 98% rename from Targets rename to root/defaults/smoke-conf/Targets index 7e5003e..f935759 100644 --- a/Targets +++ b/root/defaults/smoke-conf/Targets @@ -42,7 +42,7 @@ host = linuxserver.io menu = Europe title = European Connectivity -++ Germany +++ Germany menu = Germany title = The Fatherland @@ -150,4 +150,4 @@ host = 208.67.222.222 ++ OpenDNS2 menu = OpenDNS2 title = OpenDNS2 -host = 208.67.220.220 \ No newline at end of file +host = 208.67.220.220 diff --git a/config.d/pathnames b/root/defaults/smoke-conf/pathnames similarity index 65% rename from config.d/pathnames rename to root/defaults/smoke-conf/pathnames index b5fc536..7ad695f 100644 --- a/config.d/pathnames +++ b/root/defaults/smoke-conf/pathnames @@ -1,6 +1,6 @@ sendmail = /bin/false -imgcache = /var/cache/smokeping/images -imgurl = ../smokeping/images +imgcache = /var/cache/smokeping +imgurl = cache datadir = /data piddir = /var/run/smokeping smokemail = /etc/smokeping/smokemail diff --git a/ssmtp.conf b/root/defaults/smoke-conf/smtp.conf similarity index 100% rename from ssmtp.conf rename to root/defaults/smoke-conf/smtp.conf diff --git a/root/etc/apache2/conf.d/smokeping.conf b/root/etc/apache2/conf.d/smokeping.conf new file mode 100644 index 0000000..e7f5a17 --- /dev/null +++ b/root/etc/apache2/conf.d/smokeping.conf @@ -0,0 +1,9 @@ +ScriptAlias /smokeping/smokeping.cgi /var/www/localhost/smokeping/smokeping.cgi +Alias /smokeping /var/www/localhost/smokeping + + + Options +ExecCGI + AddHandler cgi-script .cgi + Options +FollowSymLinks + Require all granted + diff --git a/root/etc/apache2/httpd.conf b/root/etc/apache2/httpd.conf new file mode 100644 index 0000000..d5efaeb --- /dev/null +++ b/root/etc/apache2/httpd.conf @@ -0,0 +1,468 @@ +# +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so "logs/access_log" +# with ServerRoot set to "/usr/local/apache2" will be interpreted by the +# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" +# will be interpreted as '/logs/access_log'. + +# +# ServerTokens +# This directive configures what you return as the Server HTTP response +# Header. The default is 'Full' which sends information about the OS-Type +# and compiled in modules. +# Set to one of: Full | OS | Minor | Minimal | Major | Prod +# where Full conveys the most information, and Prod the least. +# +ServerTokens OS + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to specify a local disk on the +# Mutex directive, if file-based mutexes are used. If you wish to share the +# same ServerRoot for multiple httpd daemons, you will need to change at +# least PidFile. +# +ServerRoot /var/www + +# +# Mutex: Allows you to set the mutex mechanism and mutex file directory +# for individual mutexes, or change the global defaults +# +# Uncomment and change the directory if mutexes are file-based and the default +# mutex file directory is not on a local disk or is not appropriate for some +# other reason. +# +# Mutex default:/run/apache2 + +# +# Listen: Allows you to bind Apache to specific IP addresses and/or +# ports, instead of the default. See also the +# directive. +# +# Change this to Listen on specific IP addresses as shown below to +# prevent Apache from glomming onto all bound IP addresses. +# +#Listen 12.34.56.78:80 +Listen 80 + +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +LoadModule authn_file_module modules/mod_authn_file.so +#LoadModule authn_dbm_module modules/mod_authn_dbm.so +#LoadModule authn_anon_module modules/mod_authn_anon.so +#LoadModule authn_dbd_module modules/mod_authn_dbd.so +#LoadModule authn_socache_module modules/mod_authn_socache.so +LoadModule authn_core_module modules/mod_authn_core.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule authz_groupfile_module modules/mod_authz_groupfile.so +LoadModule authz_user_module modules/mod_authz_user.so +#LoadModule authz_dbm_module modules/mod_authz_dbm.so +#LoadModule authz_owner_module modules/mod_authz_owner.so +#LoadModule authz_dbd_module modules/mod_authz_dbd.so +LoadModule authz_core_module modules/mod_authz_core.so +LoadModule access_compat_module modules/mod_access_compat.so +LoadModule auth_basic_module modules/mod_auth_basic.so +#LoadModule auth_form_module modules/mod_auth_form.so +#LoadModule auth_digest_module modules/mod_auth_digest.so +#LoadModule allowmethods_module modules/mod_allowmethods.so +#LoadModule file_cache_module modules/mod_file_cache.so +#LoadModule cache_module modules/mod_cache.so +#LoadModule cache_disk_module modules/mod_cache_disk.so +#LoadModule cache_socache_module modules/mod_cache_socache.so +#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so +#LoadModule socache_dbm_module modules/mod_socache_dbm.so +#LoadModule socache_memcache_module modules/mod_socache_memcache.so +#LoadModule watchdog_module modules/mod_watchdog.so +#LoadModule macro_module modules/mod_macro.so +#LoadModule dbd_module modules/mod_dbd.so +#LoadModule dumpio_module modules/mod_dumpio.so +#LoadModule echo_module modules/mod_echo.so +#LoadModule buffer_module modules/mod_buffer.so +#LoadModule data_module modules/mod_data.so +#LoadModule ratelimit_module modules/mod_ratelimit.so +LoadModule reqtimeout_module modules/mod_reqtimeout.so +#LoadModule ext_filter_module modules/mod_ext_filter.so +#LoadModule request_module modules/mod_request.so +#LoadModule include_module modules/mod_include.so +LoadModule filter_module modules/mod_filter.so +#LoadModule reflector_module modules/mod_reflector.so +#LoadModule substitute_module modules/mod_substitute.so +#LoadModule sed_module modules/mod_sed.so +#LoadModule charset_lite_module modules/mod_charset_lite.so +#LoadModule deflate_module modules/mod_deflate.so +LoadModule mime_module modules/mod_mime.so +LoadModule log_config_module modules/mod_log_config.so +#LoadModule log_debug_module modules/mod_log_debug.so +#LoadModule log_forensic_module modules/mod_log_forensic.so +#LoadModule logio_module modules/mod_logio.so +LoadModule env_module modules/mod_env.so +#LoadModule mime_magic_module modules/mod_mime_magic.so +#LoadModule expires_module modules/mod_expires.so +LoadModule headers_module modules/mod_headers.so +#LoadModule usertrack_module modules/mod_usertrack.so +#LoadModule unique_id_module modules/mod_unique_id.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +#LoadModule remoteip_module modules/mod_remoteip.so +#LoadModule session_module modules/mod_session.so +#LoadModule session_cookie_module modules/mod_session_cookie.so +#LoadModule session_dbd_module modules/mod_session_dbd.so +#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so +#LoadModule dialup_module modules/mod_dialup.so +#LoadModule mpm_event_module modules/mod_mpm_event.so +LoadModule mpm_prefork_module modules/mod_mpm_prefork.so +#LoadModule mpm_worker_module modules/mod_mpm_worker.so +LoadModule unixd_module modules/mod_unixd.so +#LoadModule heartbeat_module modules/mod_heartbeat.so +#LoadModule heartmonitor_module modules/mod_heartmonitor.so +LoadModule status_module modules/mod_status.so +LoadModule autoindex_module modules/mod_autoindex.so +#LoadModule asis_module modules/mod_asis.so +#LoadModule info_module modules/mod_info.so +#LoadModule suexec_module modules/mod_suexec.so + + LoadModule cgid_module modules/mod_cgid.so + + + LoadModule cgi_module modules/mod_cgi.so + +#LoadModule vhost_alias_module modules/mod_vhost_alias.so +#LoadModule negotiation_module modules/mod_negotiation.so +LoadModule dir_module modules/mod_dir.so +#LoadModule actions_module modules/mod_actions.so +#LoadModule speling_module modules/mod_speling.so +#LoadModule userdir_module modules/mod_userdir.so +LoadModule alias_module modules/mod_alias.so +LoadModule rewrite_module modules/mod_rewrite.so +LoadModule negotiation_module modules/mod_negotiation.so + + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User abc +Group abc + + + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin you@example.com + +# +# Optionally add a line containing the server version and virtual host +# name to server-generated pages (internal error documents, FTP directory +# listings, mod_status and mod_info output etc., but not CGI generated +# documents or custom error documents). +# Set to "EMail" to also include a mailto: link to the ServerAdmin. +# Set to one of: On | Off | EMail +# +ServerSignature On + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +#ServerName www.example.com:80 + +# +# Deny access to the entirety of your server's filesystem. You must +# explicitly permit access to web content directories in other +# blocks below. +# + + AllowOverride none + Require all denied + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +DocumentRoot "/var/www/localhost/htdocs" + + # + # Possible values for the Options directive are "None", "All", + # or any combination of: + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews + # + # Note that "MultiViews" must be named *explicitly* --- "Options All" + # doesn't give it to you. + # + # The Options directive is both complicated and important. Please see + # http://httpd.apache.org/docs/2.4/mod/core.html#options + # for more information. + # + Options Indexes FollowSymLinks + + # + # AllowOverride controls what directives may be placed in .htaccess files. + # It can be "All", "None", or any combination of the keywords: + # AllowOverride FileInfo AuthConfig Limit + # + AllowOverride None + + # + # Controls who can get stuff from this server. + # + Require all granted + + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + DirectoryIndex index.html + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog logs/error.log + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + #CustomLog logs/access.log common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + CustomLog logs/access.log combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/" + + + + + # + # ScriptSock: On threaded servers, designate the path to the UNIX + # socket used to communicate with the CGI daemon of mod_cgid. + # + #Scriptsock cgisock + + +# +# "/var/www/localhost/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# + + AllowOverride None + Options None + Require all granted + + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig /etc/apache2/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + +# +# The mod_mime_magic module allows the server to use various hints from the +# contents of the file itself to determine its type. The MIMEMagicFile +# directive tells the module where the hint definitions are located. +# + + MIMEMagicFile /etc/apache2/magic + + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall may be used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# Defaults: EnableMMAP On, EnableSendfile Off +# +#EnableMMAP off +#EnableSendfile on + +# Load config files from the config directory "/etc/apache2/conf.d". +# +IncludeOptional /etc/apache2/conf.d/*.conf diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config new file mode 100644 index 0000000..e94e42a --- /dev/null +++ b/root/etc/cont-init.d/30-config @@ -0,0 +1,34 @@ +#!/usr/bin/with-contenv bash + +# create folders +mkdir -p \ + /run/apache2 \ + /var/cache/smokeping + +# copy config files + +PREV_DIR=$(pwd) + +cd /defaults/smoke-conf || exit + for i in $(find . -type f) + do + [[ ! -e "/config/${i}" ]] && cp -v "${i}" "/config/${i}" + done + +cd "${PREV_DIR}" || exit + +# make symlinks +[[ ! -e /var/www/localhost/smokeping ]] && ln -s \ + /usr/share/webapps/smokeping /var/www/localhost/smokeping + +[[ ! -e /var/www/localhost/smokeping/cache ]] && ln -s \ + /var/cache/smokeping /var/www/localhost/smokeping/cache + +# permissions +chown -R abc:abc \ + /config \ + /data \ + /run/apache2 \ + /usr/share/webapps/smokeping \ + /var/cache/smokeping \ + /var/www/localhost/smokeping diff --git a/root/etc/services.d/apache/run b/root/etc/services.d/apache/run new file mode 100644 index 0000000..d58278c --- /dev/null +++ b/root/etc/services.d/apache/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +exec /usr/sbin/apachectl -D FOREGROUND diff --git a/root/etc/services.d/smokeping/run b/root/etc/services.d/smokeping/run new file mode 100644 index 0000000..9c97497 --- /dev/null +++ b/root/etc/services.d/smokeping/run @@ -0,0 +1,4 @@ +#!/usr/bin/with-contenv bash + +exec s6-setuidgid abc /usr/bin/smokeping --config="/etc/smokeping/config" --nodaemon + diff --git a/root/etc/smokeping/config b/root/etc/smokeping/config new file mode 100644 index 0000000..95ab08b --- /dev/null +++ b/root/etc/smokeping/config @@ -0,0 +1,7 @@ +@include /config/General +@include /config/Alerts +@include /config/Database +@include /config/Presentation +@include /config/Probes +@include /config/Slaves +@include /config/Targets diff --git a/services/apache2/run b/services/apache2/run deleted file mode 100644 index 6bb249f..0000000 --- a/services/apache2/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -exec /usr/sbin/apache2ctl -D FOREGROUND diff --git a/services/smokeping/run b/services/smokeping/run deleted file mode 100644 index fc6d2ff..0000000 --- a/services/smokeping/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -exec /sbin/setuser abc /usr/sbin/smokeping --config="/etc/smokeping/config" --nodaemon