update readme + fix install apache & apache-fpm

This commit is contained in:
a-sansara 2016-08-12 20:14:18 +02:00
parent 48d9fc2840
commit 7585f595c3
14 changed files with 98 additions and 61 deletions

View File

@ -4,7 +4,7 @@
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]
@ -32,8 +32,8 @@ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}
172.22.0.4 pma.docker 172.22.0.4 pma.docker
172.22.0.5 bo-payment.docker 172.22.0.5 bo-payment.docker
172.22.0.6 wordpress.docker 172.22.0.6 wordpress.docker
172.22.0.7 symfony.docker 172.22.0.7 fpm.docker
172.22.0.8 afpm.docker 172.22.0.8 symfony.docker
# < # <
``` ```
@ -77,6 +77,7 @@ docker stats container
[gogs.docker] (http://gogs.docker) [gogs.docker] (http://gogs.docker)
[bo-payment.docker] (http://bo-payment.docker) [bo-payment.docker] (http://bo-payment.docker)
[wordpress.docker] (http://wordpress.docker) [wordpress.docker] (http://wordpress.docker)
[fpm.docker] (http://symfony.docker)
[symfony.docker] (http://symfony.docker) [symfony.docker] (http://symfony.docker)
#### Mysql #### Mysql
@ -132,26 +133,26 @@ docker run --name wordpress --restart=always \
-d pluie/alpine-apache -d pluie/alpine-apache
``` ```
### Symfony
```
cd /home/dev/docker
docker run --name symfony --restart=always \
--net home0 -h symfony.docker --ip 172.22.0.7 --link=mysql:db \
-e HTTP_SERVER_NAME=symfony \
-e SYMFONY_VERSION=2.8 \
-v $(pwd)/repo/myapp:/app \
-d pluie/alpine-symfony
```
#### ApacheFpm #### ApacheFpm
``` ```
cd /home/dev/docker cd /home/dev/docker
docker run --name afpm --restart=always \ docker run --name afpm --restart=always \
--net home0 -h bo-payment.docker --ip 172.22.0.8 --link mysql:db \ --net home0 -h fpm.docker --ip 172.22.0.7 --link mysql:db \
-v $(pwd)/repo/afpm:/app \ -v $(pwd)/repo/afpm:/app \
-e HTTP_SERVER_NAME=afpm.docker \ -e HTTP_SERVER_NAME=afpm.docker \
-d pluie/alpine-apache-fpm -d pluie/alpine-apache-fpm
```
### Symfony
```
cd /home/dev/docker
docker run --name symfony --restart=always \
--net home0 -h symfony.docker --ip 172.22.0.8 --link=mysql:db \
-e HTTP_SERVER_NAME=symfony \
-e SYMFONY_VERSION=2.8 \
-v $(pwd)/repo/myapp:/app \
-d pluie/alpine-symfony
``` ```
[1]: https://github.com/pluie-org/docker-images [1]: https://github.com/pluie-org/docker-images

View File

@ -8,7 +8,7 @@ various based images for Docker
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]

View File

@ -11,7 +11,7 @@ ENV SHENV_NAME=ApacheFpm \
SHENV_COLOR=67 \ SHENV_COLOR=67 \
HTTP_SERVER_NAME=fpm.docker \ HTTP_SERVER_NAME=fpm.docker \
WWW_DIR=www \ WWW_DIR=www \
WWW_INDEX=index \ WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \ FIX_OWNERSHIP=1 \
TZ=Europe/Paris TZ=Europe/Paris

View File

@ -4,16 +4,13 @@
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]
Extend pluie/alpine with __apache 2.4.23__ and __php 5.6.24__ Extend pluie/alpine with __apache 2.4.23__ and __php 5.6.24__ with FPM
- error log are attached to stdout - you can use env var at container creation : __HTTP_SERVER_NAME__ (default : fpm.docker ortherwise edit app/vhost later)
- no need port redirection
- you can use env var at container creation : __HTTP_SERVER_NAME__ (default : docker-site.dev ortherwise edit app/vhost later)
- you can still use ever your local http & sql server while your container(s) are running
## Image Size ## Image Size
@ -40,7 +37,12 @@ Extend pluie/alpine with __apache 2.4.23__ and __php 5.6.24__
## Image Volumes ## Image Volumes
__/app__ directory is a docker volume bind to your app project (silex/symfony etc) pluie/alpine-apache-fpm has to volumes :
- __/app__ to bind to your app project (silex/symfony etc)
- __/etc/php5/fpm.d/__ to customize fpm
### note
__/app/$WWW_DIR__ is the documentRoot. __/app/$WWW_DIR__ is the documentRoot.
put only your entry point and static files to the documentRoot directory, no your app sources put only your entry point and static files to the documentRoot directory, no your app sources
@ -49,6 +51,8 @@ put only your entry point and static files to the documentRoot directory, no you
__/app/vhost__ is your app vhost configuration file (with a serverName directive). __/app/vhost__ is your app vhost configuration file (with a serverName directive).
by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX
``` ```
/app/ # your application directory /app/ # your application directory
| |
@ -62,22 +66,22 @@ by default it use the apache rewrite module to redirect all uri to entry point $
chdir to your project directory chdir to your project directory
``` ```
$ docker run --name apache -it --link=mysql:db1 -v $(pwd):/app pluie/alpine-apache $ docker run --name afpm -it --link=mysql:db1 -v $(pwd):/app pluie/alpine-apache-fpm
``` ```
or or
``` ```
$ docker run --name apache -it --link=mysql:db1 -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-apache $ docker run --name afpm -d --link=mysql:db1 -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-apache-fpm
``` ```
## Controling http server ## Controling http server
``` ```
$ docker exec -it apache "httpd -k restart" $ docker exec -it afpm "httpd -k restart"
``` ```
for more commands : for more commands :
``` ```
$ docker exec -it apache "httpd -h" $ docker exec -it afpm "httpd -h"
``` ```
[1]: https://github.com/pluie-org/docker-images [1]: https://github.com/pluie-org/docker-images

Binary file not shown.

View File

@ -17,9 +17,15 @@ function a2setModule(){
fi fi
} }
if [ ! -f /usr/lib/libxml2.so ]; then
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi
if [ ! -d /app/$WWW_DIR ]; then
mkdir -p /app/$WWW_DIR mkdir -p /app/$WWW_DIR
fi
if [ ! -d /run/apache2 ]; then
mkdir /run/apache2 mkdir /run/apache2
fi
chown -R 1000:apache /app/$WWW_DIR chown -R 1000:apache /app/$WWW_DIR
chmod -R 755 /scripts/pre-init.d chmod -R 755 /scripts/pre-init.d
mkdir -p /run/apache2 mkdir -p /run/apache2

View File

@ -11,7 +11,7 @@ ENV SHENV_NAME=Apache \
SHENV_COLOR=67 \ SHENV_COLOR=67 \
HTTP_SERVER_NAME=site.docker \ HTTP_SERVER_NAME=site.docker \
WWW_DIR=www \ WWW_DIR=www \
WWW_INDEX=index \ WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \ FIX_OWNERSHIP=1 \
TZ=Europe/Paris TZ=Europe/Paris

View File

@ -4,7 +4,7 @@
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]

Binary file not shown.

View File

@ -2,18 +2,49 @@
# @app pluie/alpine-apache # @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images # @author a-Sansara https://git.pluie.org/pluie/docker-images
function a2setModule(){
local enable=${1:-''}
local path=${3:-'/etc/apache2/httpd.conf'}
local scom=''
local rcom='\#'
if [ ! -z $1 ] && [ ! -z "$2" ]; then
if [ "$enable" = 1 ]; then
scom='\#'
rcom=''
fi
echo "$2"
sed -i "s#${scom}LoadModule $2_module modules/mod_$2.so#${rcom}LoadModule $2_module modules/mod_$2.so#" "$path"
fi
}
if [ ! -f /usr/lib/libxml2.so ]; then
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi
if [ ! -d /app/$WWW_DIR ]; then
mkdir -p /app/$WWW_DIR mkdir -p /app/$WWW_DIR
fi
if [ ! -d /run/apache2 ]; then
mkdir /run/apache2
fi
chown -R 1000:apache /app/$WWW_DIR chown -R 1000:apache /app/$WWW_DIR
chmod -R 755 /scripts/pre-init.d chmod -R 755 /scripts/pre-init.d
mkdir -p /run/apache2 mkdir -p /run/apache2
chown apache:apache /run/apache2 chown apache:apache /run/apache2
tmpsed='s#^DocumentRoot ".*#DocumentRoot "/app/'$WWW_DIR'"#g' tmpsed='s#^DocumentRoot ".*#DocumentRoot "/app/'$WWW_DIR'"#g'
sed -i "$tmpsed" /etc/apache2/httpd.conf sed -i "$tmpsed" /etc/apache2/httpd.conf
sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf
sed -i 's#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so#\#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so#' /etc/apache2/httpd.conf
sed -i 's#\#LoadModule rewrite_module modules/mod_rewrite.so#LoadModule rewrite_module modules/mod_rewrite.so#' /etc/apache2/httpd.conf initTitle "Apache" "Loading Modules"
sed -i 's#\#LoadModule mpm_event_module modules/mod_mpm_event.so#LoadModule mpm_event_module modules/mod_mpm_event.so#' /etc/apache2/httpd.conf a2setModule 1 "rewrite"
sed -i 's#\#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so#' /etc/apache2/httpd.conf a2setModule 1 "mpm_prefork"
a2setModule 1 "slotmem_shm"
a2setModule 1 "heartmonitor"
a2setModule 1 "watchdog"
initTitle "Apache" "Removing Modules"
a2setModule 0 "mpm_event"
a2setModule 0 "proxy_fdpass" /etc/apache2/conf.d/proxy.conf
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" /etc/php5/php.ini
sed -ir 's/expose_php = On/expose_php = Off/' /etc/php5/php.ini sed -ir 's/expose_php = On/expose_php = Off/' /etc/php5/php.ini
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
unset tmpsed unset tmpsed

View File

@ -7,9 +7,6 @@ if [ ! -z "/app/vhost" ]; then
<VirtualHost *:80> <VirtualHost *:80>
ServerName $HTTP_SERVER_NAME ServerName $HTTP_SERVER_NAME
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1 SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
<Directory /app/$WWW_DIR> <Directory /app/$WWW_DIR>
AllowOverride None AllowOverride None
Require all granted Require all granted

View File

@ -4,7 +4,7 @@
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]

View File

@ -4,17 +4,18 @@
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]
Extend pluie/alpine-apache. Extend pluie/alpine-apache-fpm.
if __/app/$WWW_DIR__ does not exits then __pluie/alpine-symfony__ install if __/app/$WWW_DIR__ does not exits then __pluie/alpine-symfony__ install
the symfony framework with $SYMFONY_VERSION version on the /app directory the symfony framework with $SYMFONY_VERSION version on the /app directory
## Image Size ## Image Size
- image ~ 81 MB - image ~ 82 MB
## ENV variables ## ENV variables
@ -37,7 +38,8 @@ the symfony framework with $SYMFONY_VERSION version on the /app directory
## Image Volumes ## Image Volumes
__/app__ directory is a docker volume bind to your symfony project - __/app__ directory is a docker volume bind to your symfony project
- __/etc/php5/fpm.d/__ to customize fpm
## Image Usage ## Image Usage
@ -48,23 +50,13 @@ $ docker run --name symfony -it --link=mysql:db1 -v $(pwd):/app pluie/alpine-sym
``` ```
or or
``` ```
$ docker run --name symfony -it --link=mysql:db1 -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-symfony $ docker run --name symfony -d --link=mysql:db1 -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-symfony
``` ```
## Connect to container ## Connect to container
``` ```
$ docker exec -it symfony bash $ docker exec -it symfony bash
```
## Controling http server
```
$ docker exec -it apache "httpd -k restart"
```
for more commands :
```
$ docker exec -it apache "httpd -h"
``` ```
[1]: https://github.com/pluie-org/docker-images [1]: https://github.com/pluie-org/docker-images

View File

@ -4,7 +4,7 @@
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4 - [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm - [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 81 MB ) - [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.0
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB ) - [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [docker tips][5] - [docker tips][5]
@ -85,11 +85,17 @@ MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts ADD files.tar /scripts
RUN bash /scripts/install.sh ENV SHENV_NAME=Apache \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=site.docker \
WWW_DIR=www \
WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80 EXPOSE 80
VOLUME /app RUN bash /scripts/install.sh
``` ```
[1]: https://github.com/pluie-org/docker-images [1]: https://github.com/pluie-org/docker-images