setup xdebug for development docker setup
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -14,4 +14,5 @@ node_modules/*
|
||||
web/dist/*.map
|
||||
web/admin/dist/*.map
|
||||
web/modules/dist/*.map
|
||||
docker/db_data
|
||||
docker/development/db_data
|
||||
docker/prod/db_data
|
||||
|
||||
37
Dockerfile
37
Dockerfile
@@ -2,22 +2,42 @@ FROM alpine:3.11
|
||||
LABEL Maintainer="Thilina, Pituwala <thilina@icehrm.com>" \
|
||||
Description="IceHrm Docker Container with Nginx 1.16 & PHP-FPM 7.3 based on Alpine Linux."
|
||||
|
||||
ENV PHPIZE_DEPS \
|
||||
autoconf \
|
||||
dpkg-dev dpkg \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
libc-dev \
|
||||
make \
|
||||
pkgconf \
|
||||
musl-dev \
|
||||
re2c \
|
||||
php7-dev \
|
||||
php7-pear
|
||||
|
||||
RUN apk --no-cache add bind-tools
|
||||
|
||||
# Install packages
|
||||
RUN apk --no-cache add php7 php7-fpm php7-opcache php7-mysqli php7-json php7-openssl php7-curl \
|
||||
php7-zlib php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-ctype php7-session \
|
||||
php7-mbstring php7-gd nginx supervisor curl
|
||||
RUN apk --no-cache add php php-fpm php-opcache php-mysqli php-json php-openssl php-curl \
|
||||
php-zlib php-xml php-phar php-intl php-dom php-xmlreader php-ctype php-session \
|
||||
php-mbstring php-gd nginx supervisor curl
|
||||
|
||||
# Install xdebug
|
||||
RUN apk add --no-cache $PHPIZE_DEPS \
|
||||
&& pecl install xdebug-2.9.5
|
||||
|
||||
# Configure nginx
|
||||
COPY docker/config/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY docker/development/config/nginx.conf /etc/nginx/nginx.conf
|
||||
# Remove default server definition
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Configure PHP-FPM
|
||||
COPY docker/config/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
|
||||
COPY docker/config/php.ini /etc/php7/conf.d/custom.ini
|
||||
COPY docker/development/config/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
|
||||
COPY docker/development/config/php.ini /etc/php7/conf.d/custom.ini
|
||||
|
||||
# Configure supervisord
|
||||
COPY docker/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY docker/development/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Setup document root
|
||||
RUN mkdir -p /var/www/html
|
||||
@@ -37,7 +57,8 @@ COPY --chown=nobody ./app /var/www/html/app/
|
||||
COPY --chown=nobody ./core /var/www/html/core/
|
||||
COPY --chown=nobody ./web /var/www/html/web/
|
||||
COPY --chown=nobody ./index.php /var/www/html/index.php
|
||||
COPY --chown=nobody ./docker/config/config.php /var/www/html/app/config.php
|
||||
COPY --chown=nobody ./docker/development/config/config.php /var/www/html/app/config.php
|
||||
COPY --chown=nobody ./docker/development/config/info.php /var/www/html/app/info.php
|
||||
|
||||
# Expose the port nginx is reachable on
|
||||
EXPOSE 8080
|
||||
|
||||
@@ -8,16 +8,16 @@ RUN apk --no-cache add php7 php7-fpm php7-opcache php7-mysqli php7-json php7-ope
|
||||
php7-mbstring php7-gd nginx supervisor curl
|
||||
|
||||
# Configure nginx
|
||||
COPY config/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY docker/prod/config/nginx.conf /etc/nginx/nginx.conf
|
||||
# Remove default server definition
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Configure PHP-FPM
|
||||
COPY config/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
|
||||
COPY config/php.ini /etc/php7/conf.d/custom.ini
|
||||
COPY docker/prod/config/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
|
||||
COPY docker/prod/config/php.ini /etc/php7/conf.d/custom.ini
|
||||
|
||||
# Configure supervisord
|
||||
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY docker/prod/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Setup document root
|
||||
RUN mkdir -p /var/www/html
|
||||
@@ -33,11 +33,11 @@ USER nobody
|
||||
|
||||
# Add application
|
||||
WORKDIR /var/www/html
|
||||
COPY --chown=nobody ../app /var/www/html/app/
|
||||
COPY --chown=nobody ../core /var/www/html/core/
|
||||
COPY --chown=nobody ../web /var/www/html/web/
|
||||
COPY --chown=nobody ../index.php /var/www/html/index.php
|
||||
COPY --chown=nobody ../config/config.php /var/www/html/app/config.php
|
||||
COPY --chown=nobody ./app /var/www/html/app/
|
||||
COPY --chown=nobody ./core /var/www/html/core/
|
||||
COPY --chown=nobody ./web /var/www/html/web/
|
||||
COPY --chown=nobody ./index.php /var/www/html/index.php
|
||||
COPY --chown=nobody ./docker/prod/config/config.php /var/www/html/app/config.php
|
||||
|
||||
# Expose the port nginx is reachable on
|
||||
EXPOSE 8080
|
||||
@@ -10,14 +10,12 @@ services:
|
||||
MYSQL_PASSWORD: dev
|
||||
MYSQL_DATABASE: dev
|
||||
volumes:
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/setup.sql
|
||||
- ./db_data:/var/lib/mysql
|
||||
- ./docker/prod/init.sql:/docker-entrypoint-initdb.d/setup.sql
|
||||
- ./docker/prod/db_data:/var/lib/mysql
|
||||
|
||||
icehrm:
|
||||
build: .
|
||||
ports:
|
||||
- 8080:8080
|
||||
links:
|
||||
- mysql
|
||||
- 80:80
|
||||
volumes:
|
||||
db_data:
|
||||
@@ -1,4 +1,4 @@
|
||||
version: "3.5"
|
||||
version: "2.4"
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
@@ -10,8 +10,8 @@ services:
|
||||
MYSQL_PASSWORD: dev
|
||||
MYSQL_DATABASE: dev
|
||||
volumes:
|
||||
- ./docker/init.sql:/docker-entrypoint-initdb.d/setup.sql
|
||||
- ./docker/db_data:/var/lib/mysql
|
||||
- ./docker/development/init.sql:/docker-entrypoint-initdb.d/setup.sql
|
||||
- ./docker/development/db_data:/var/lib/mysql
|
||||
|
||||
icehrm:
|
||||
build: .
|
||||
|
||||
2
docker/development/config/info.php
Normal file
2
docker/development/config/info.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
phpinfo();
|
||||
16
docker/development/config/php.ini
Normal file
16
docker/development/config/php.ini
Normal file
@@ -0,0 +1,16 @@
|
||||
[Date]
|
||||
date.timezone="UTC"
|
||||
|
||||
[xdebug]
|
||||
zend_extension=/usr/lib/php7/modules/xdebug.so
|
||||
xdebug.cli_color=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_host=host.docker.internal
|
||||
xdebug.remote_connect_back=0
|
||||
xdebug.var_display_max_children=512
|
||||
xdebug.var_display_max_depth=20
|
||||
xdebug.var_display_max_data=-1
|
||||
xdebug.profiler_enable = 0
|
||||
xdebug.profiler_enable_trigger = 1
|
||||
xdebug.profiler_output_dir = "/tmp"
|
||||
xdebug.max_nesting_level = 512
|
||||
@@ -1,2 +0,0 @@
|
||||
https://hub.docker.com/r/thilinah/icehrm/
|
||||
docker run -i -t -p 192.168.99.100:80:80 thilinah/icehrm /bin/start.sh
|
||||
18
docker/prod/config/config.php
Normal file
18
docker/prod/config/config.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
ini_set('error_log', 'data/icehrm.log');
|
||||
|
||||
define('CLIENT_NAME', 'icehrm');
|
||||
define('APP_BASE_PATH', '/var/www/html/core/');
|
||||
define('CLIENT_BASE_PATH', '/var/www/html/app/');
|
||||
define('BASE_URL','http://localhost:8080/web/');
|
||||
define('CLIENT_BASE_URL','http://localhost:8080/app/');
|
||||
|
||||
define('APP_DB', 'dev');
|
||||
define('APP_USERNAME', 'dev');
|
||||
define('APP_PASSWORD', 'dev');
|
||||
define('APP_HOST', 'mysql');
|
||||
define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'.APP_DB);
|
||||
|
||||
//file upload
|
||||
define('FILE_TYPES', 'jpg,png,jpeg');
|
||||
define('MAX_FILE_SIZE_KB', 10 * 1024);
|
||||
56
docker/prod/config/fpm-pool.conf
Normal file
56
docker/prod/config/fpm-pool.conf
Normal file
@@ -0,0 +1,56 @@
|
||||
[global]
|
||||
; Log to stderr
|
||||
error_log = /dev/stderr
|
||||
|
||||
[www]
|
||||
; The address on which to accept FastCGI requests.
|
||||
; Valid syntaxes are:
|
||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
||||
; a specific port;
|
||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
||||
; a specific port;
|
||||
; 'port' - to listen on a TCP socket to all addresses
|
||||
; (IPv6 and IPv4-mapped) on a specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = 127.0.0.1:9000
|
||||
|
||||
; Enable status page
|
||||
pm.status_path = /fpm-status
|
||||
|
||||
; Ondemand process manager
|
||||
pm = ondemand
|
||||
|
||||
; The number of child processes to be created when pm is set to 'static' and the
|
||||
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
||||
; This value sets the limit on the number of simultaneous requests that will be
|
||||
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
|
||||
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
|
||||
; CGI. The below defaults are based on a server without much resources. Don't
|
||||
; forget to tweak pm.* to fit your needs.
|
||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||
; Note: This value is mandatory.
|
||||
pm.max_children = 100
|
||||
|
||||
; The number of seconds after which an idle process will be killed.
|
||||
; Note: Used only when pm is set to 'ondemand'
|
||||
; Default Value: 10s
|
||||
pm.process_idle_timeout = 10s;
|
||||
|
||||
; The number of requests each child process should execute before respawning.
|
||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||
; Default Value: 0
|
||||
pm.max_requests = 1000
|
||||
|
||||
; Make sure the FPM workers can reach the environment variables for configuration
|
||||
clear_env = no
|
||||
|
||||
; Catch output from PHP
|
||||
catch_workers_output = yes
|
||||
|
||||
; Remove the 'child 10 said into stderr' prefix in the log and only show the actual message
|
||||
decorate_workers_output = no
|
||||
|
||||
; Enable ping page to use in healthcheck
|
||||
ping.path = /fpm-ping
|
||||
86
docker/prod/config/nginx.conf
Normal file
86
docker/prod/config/nginx.conf
Normal file
@@ -0,0 +1,86 @@
|
||||
worker_processes 1;
|
||||
error_log stderr warn;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Define custom log format to include reponse times
|
||||
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||
'$request_time $upstream_response_time $pipe $upstream_cache_status';
|
||||
|
||||
access_log /dev/stdout main_timed;
|
||||
error_log /dev/stderr notice;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
# Write temporary files to /tmp so they can be created as a non-privileged user
|
||||
client_body_temp_path /tmp/client_temp;
|
||||
proxy_temp_path /tmp/proxy_temp_path;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
|
||||
# Default server definition
|
||||
server {
|
||||
listen [::]:8080 default_server;
|
||||
listen 8080 default_server;
|
||||
server_name _;
|
||||
|
||||
sendfile off;
|
||||
|
||||
root /var/www/html;
|
||||
index index.php;
|
||||
|
||||
location /app/api/ {
|
||||
try_files $uri /app/api/index.php?/$uri&$args;
|
||||
}
|
||||
|
||||
# Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
|
||||
expires 5d;
|
||||
}
|
||||
|
||||
# Deny access to . files, for security
|
||||
location ~ /\. {
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Allow fpm ping and status from localhost
|
||||
location ~ ^/(fpm-status|fpm-ping)$ {
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
}
|
||||
}
|
||||
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
|
||||
gzip_vary on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
# Include other server configs
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
23
docker/prod/config/supervisord.conf
Normal file
23
docker/prod/config/supervisord.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/run/supervisord.pid
|
||||
|
||||
[program:php-fpm]
|
||||
command=php-fpm7 -F
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
autorestart=false
|
||||
startretries=0
|
||||
|
||||
[program:nginx]
|
||||
command=nginx -g 'daemon off;'
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
autorestart=false
|
||||
startretries=0
|
||||
2961
docker/prod/init.sql
Normal file
2961
docker/prod/init.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
service nginx start
|
||||
service php5-fpm start
|
||||
service mysql start
|
||||
|
||||
if [ -d "/usr/share/nginx/www/" ]; then
|
||||
echo 'Already Installed'
|
||||
else
|
||||
echo 'Installing IceHrm'
|
||||
cd /usr/share/nginx
|
||||
curl -s https://api.github.com/repos/gamonoid/icehrm/releases/latest | jq -r ".assets[] | select(.name) | .browser_download_url" | grep '.zip' | xargs wget
|
||||
ls | grep 'zip' | xargs unzip
|
||||
mv `ls -d */ | grep icehrm | head -1` www/
|
||||
rm *.zip
|
||||
|
||||
echo 'Your MySQL root password : icehrmpwd'
|
||||
|
||||
echo "Following will be needed during installation"
|
||||
echo "--------------------------------------------"
|
||||
echo 'IceHrm Database : icehrmdb'
|
||||
echo 'IceHrm User : icehrmuser'
|
||||
echo 'IceHrm User Password : icehrmuserpwd'
|
||||
echo 'IceHrm Database host : localhost'
|
||||
|
||||
echo 'Please visit your docker installation url to begin installation.'
|
||||
|
||||
fi
|
||||
|
||||
|
||||
/bin/bash
|
||||
Reference in New Issue
Block a user