Parcourir la source

Converted apache

tags/v3.0.0
Robin Thoni il y a 5 ans
Parent
révision
4d4a6be186

+ 6
- 42
apache/Dockerfile Voir le fichier

@@ -1,45 +1,9 @@
1
-FROM robinthoni/debian-multiarch:jessie
1
+FROM php:7-apache-stretch
2 2
 
3
-# FROM https://github.com/ZHAJOR/Docker-Apache-2.4-Php-5.6-for-Laravel
4
-MAINTAINER Robin Thoni <robin@rthoni.com>
3
+ADD https://raw.githubusercontent.com/robin-thoni/docker-utils/v1.0.0/setup.sh /tmp/docker-utils-setup.sh
4
+RUN sh /tmp/docker-utils-setup.sh
5 5
 
6
-ARG CONFIG_DIR=/etc/default/config-files/
6
+COPY ./config /etc/salt/base/
7
+COPY ./bin /usr/local/bin/
7 8
 
8
-RUN apt-get update && apt-get -y install\
9
-        apache2=2.4.*\
10
-        libapache2-mod-php5\
11
-        php5\
12
-        php5-mcrypt\
13
-        php5-pgsql\
14
-        php5-mysql\
15
-        php5-gd\
16
-        php5-curl\
17
-        php5-imap &&\
18
-        apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
19
-
20
-RUN /usr/sbin/a2enmod rewrite &&\
21
-    rm -rf /var/www/html &&\
22
-    mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html &&\
23
-    chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
24
-
25
-RUN rm -rf /var/log/* &&\
26
-    mkdir -p /var/log/apache2 &&\
27
-    ln -s /dev/stderr /var/log/apache2/error.log &&\
28
-    ln -s /dev/stdout /var/log/apache2/access.log &&\
29
-    ln -s /dev/stdout /var/log/apache2/other_vhosts_access.log
30
-
31
-COPY ./vars-vars /etc/vars-vars
32
-
33
-COPY ./vars-files /etc/vars-files
34
-
35
-COPY ./common.sh /common.sh
36
-
37
-COPY ./run.sh /run.sh
38
-
39
-RUN mkdir "${CONFIG_DIR}"
40
-
41
-COPY apache2.conf "${CONFIG_DIR}"/apache2.conf
42
-
43
-EXPOSE 80
44
-
45
-CMD ["/run.sh"]
9
+ENTRYPOINT ["run.sh"]

+ 0
- 61
apache/apache2.conf Voir le fichier

@@ -1,61 +0,0 @@
1
-# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
2
-
3
-ServerName netboot
4
-
5
-Mutex file:/var/lock/apache2 default
6
-PidFile /var/run/apache2/apache2.pid
7
-Timeout 300
8
-KeepAlive On
9
-MaxKeepAliveRequests 100
10
-KeepAliveTimeout 5
11
-User www-data
12
-Group www-data
13
-HostnameLookups Off
14
-ErrorLog /var/log/apache2/error.log
15
-LogLevel warn
16
-
17
-IncludeOptional mods-enabled/*.load
18
-IncludeOptional mods-enabled/*.conf
19
-
20
-# ports.conf
21
-Listen 80
22
-<IfModule ssl_module>
23
-    Listen 443
24
-</IfModule>
25
-<IfModule mod_gnutls.c>
26
-    Listen 443
27
-</IfModule>
28
-
29
-DocumentRoot "/var/www/"
30
-
31
-<Directory />
32
-    Options FollowSymLinks
33
-    AllowOverride None
34
-    Require all denied
35
-</Directory>
36
-
37
-<Directory /var/www/>
38
-    Options FollowSymLinks
39
-    AllowOverride All
40
-    Require all granted
41
-</Directory>
42
-
43
-
44
-
45
-LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
46
-LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
47
-LogFormat "%h %l %u %t \"%r\" %>s %O" common
48
-LogFormat "%{Referer}i -> %U" referer
49
-LogFormat "%{User-agent}i" agent
50
-
51
-CustomLog /var/log/apache2/access.log combined
52
-
53
-<FilesMatch \.php$>
54
-    SetHandler application/x-httpd-php
55
-</FilesMatch>
56
-
57
-# Multiple DirectoryIndex directives within the same context will add
58
-# to the list of resources to look for rather than replace
59
-# https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
60
-DirectoryIndex disabled
61
-DirectoryIndex index.php index.html

+ 5
- 0
apache/bin/run.sh Voir le fichier

@@ -0,0 +1,5 @@
1
+#! /bin/bash
2
+
3
+gcf || exit 1
4
+
5
+docker-php-entrypoint apache2-foreground

+ 0
- 41
apache/common.sh Voir le fichier

@@ -1,41 +0,0 @@
1
-export CONFIG_DIR="/etc/default/config-files/"
2
-
3
-resolv_host()
4
-{
5
-  hostname="${1}"
6
-  ip=$(getent hosts "${hostname}" | cut -d' ' -f1)
7
-  echo "${ip}"
8
-}
9
-
10
-replace_var()
11
-{
12
-  file="${1}"
13
-  var="${2}"
14
-  sed -e "s?${var}?${!var}?g" -i "${file}"
15
-}
16
-
17
-replace_vars()
18
-{
19
-  file="${1}"
20
-  for var in $(cat /etc/vars-vars)
21
-  do
22
-    replace_var "${file}" "${var}"
23
-  done
24
-}
25
-
26
-replace_files()
27
-{
28
-  cat /etc/vars-files | while read line
29
-  do
30
-    filesrc="${CONFIG_DIR}$(echo "${line}" | awk '{print $1}')"
31
-    filedst=$(echo "${line}" | awk '{print $2}')
32
-    if [ -f "${filesrc}" ]
33
-    then
34
-      echo "Expanding file ${filesrc} to ${filedst}"
35
-      cp "${filesrc}" "${filedst}"
36
-      replace_vars "${filedst}"
37
-    else
38
-      echo "File ${filesrc} does not exist. Skipping."
39
-    fi
40
-  done
41
-}

+ 7
- 0
apache/config/states/apache2/init.sls Voir le fichier

@@ -0,0 +1,7 @@
1
+apache2-config:
2
+  file.blockreplace:
3
+      - name: /etc/apache2/apache2.conf
4
+      - append_if_not_found: True
5
+      - content: |
6
+                   ServerName netboot
7
+                   AddType application/x-httpd-php .ipxe

+ 0
- 8
apache/run.sh Voir le fichier

@@ -1,8 +0,0 @@
1
-#! /usr/bin/env bash
2
-
3
-. /common.sh
4
-
5
-replace_files
6
-
7
-rm -f /run/apache2/apache2.pid
8
-exec /usr/sbin/apache2ctl -D FOREGROUND

+ 0
- 1
apache/vars-files Voir le fichier

@@ -1 +0,0 @@
1
-apache2.conf /etc/apache2/apache2.conf

+ 0
- 22
apache/vars-vars Voir le fichier

@@ -1,22 +0,0 @@
1
-DHCP_DNS_MASTER
2
-DHCP_DNS_SERVERS
3
-DHCP_TFTP_SERVER
4
-DHCP_ROUTERS
5
-DHCP_UNIFI_CONTROLLER_IP
6
-
7
-DHCP_DOMAIN
8
-DHCP_SITE_DOMAIN
9
-DHCP_DYN_IPS_DOMAIN
10
-DHCP_REV_DOMAIN
11
-
12
-DHCP_SUBNET
13
-DHCP_NETMASK
14
-DHCP_IP_FIRST
15
-DHCP_IP_LAST
16
-DHCP_BROADCAST
17
-
18
-DNS_FORWARDER_IP_1
19
-DNS_FORWARDER_IP_2
20
-DNS_TSIG_KEY_INTERNAL_SECRET
21
-DNS_TSIG_KEY_EXTERNAL_SECRET
22
-DNS_TSIG_KEY_RNDC_SECRET

+ 0
- 1
data_example/apache/files/.htaccess Voir le fichier

@@ -1 +0,0 @@
1
-AddType application/x-httpd-php .ipxe

+ 1
- 2
docker-compose.yml Voir le fichier

@@ -39,9 +39,8 @@ services:
39 39
         container_name: dhcp-apache
40 40
 #        restart: unless-stopped
41 41
         volumes:
42
-            - ./data/apache/files:/var/www
42
+            - ./data/apache/files:/var/www/html
43 43
         ports:
44 44
             - "127.0.0.1:34030:80"
45 45
         env_file:
46 46
             - env
47
-

Chargement…
Annuler
Enregistrer