Icehrm docker worker and readme
This commit is contained in:
@@ -21,7 +21,7 @@ RUN apk --no-cache add bind-tools
|
||||
# Install packages
|
||||
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
|
||||
php-mbstring php-gd php7-ldap nginx supervisor curl
|
||||
|
||||
# Install xdebug
|
||||
RUN apk add --no-cache $PHPIZE_DEPS \
|
||||
|
||||
@@ -5,7 +5,7 @@ LABEL Maintainer="Thilina, Pituwala <thilina@icehrm.com>" \
|
||||
# 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
|
||||
php7-mbstring php7-gd php7-ldap nginx supervisor curl
|
||||
|
||||
# Configure nginx
|
||||
COPY docker/prod/config/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
@@ -5,7 +5,7 @@ LABEL Maintainer="Thilina, Pituwala <thilina@icehrm.com>" \
|
||||
# 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
|
||||
php7-mbstring php7-gd php7-ldap nginx supervisor curl
|
||||
|
||||
# Configure nginx
|
||||
COPY docker/testing/config/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
32
Dockerfile-worker
Normal file
32
Dockerfile-worker
Normal file
@@ -0,0 +1,32 @@
|
||||
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."
|
||||
|
||||
ARG EXE_ENV
|
||||
|
||||
RUN apk upgrade --available
|
||||
|
||||
RUN apk add --no-cache tini openrc busybox-initscripts
|
||||
|
||||
|
||||
# Install packages
|
||||
RUN apk --no-cache add php7 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 curl
|
||||
|
||||
# Setup document root
|
||||
RUN mkdir -p /var/www/html
|
||||
|
||||
# Add application
|
||||
WORKDIR /var/www/html
|
||||
COPY ./app /var/www/html/app/
|
||||
COPY ./core /var/www/html/core/
|
||||
COPY ./web /var/www/html/web/
|
||||
COPY ./index.php /var/www/html/index.php
|
||||
COPY ./docker/$EXE_ENV/config/config.php /var/www/html/app/config.php
|
||||
|
||||
|
||||
COPY ./docker/worker/config/ice-cron /etc/crontabs/root
|
||||
RUN rm /var/www/html/app/data/icehrm.log
|
||||
|
||||
CMD /usr/sbin/crond -f -l 8
|
||||
@@ -22,10 +22,15 @@ class LogManager
|
||||
if (empty(self::$me)) {
|
||||
self::$me = new LogManager();
|
||||
self::$me->log = new Logger(APP_NAME);
|
||||
if (is_writable(ini_get('error_log'))) {
|
||||
|
||||
if (defined('LOG_STDERR') && LOG_STDERR === '1') {
|
||||
self::$me->log->pushHandler(new StreamHandler('php://stderr', LOG_LEVEL));
|
||||
} else if (is_writable(ini_get('error_log'))) {
|
||||
self::$me->log->pushHandler(new StreamHandler(ini_get('error_log'), LOG_LEVEL));
|
||||
} elseif (is_writable(CLIENT_BASE_PATH.'data/app.log')) {
|
||||
self::$me->log->pushHandler(new StreamHandler(CLIENT_BASE_PATH.'data/app.log', LOG_LEVEL));
|
||||
} else {
|
||||
self::$me->log->pushHandler(new StreamHandler('php://stderr', LOG_LEVEL));
|
||||
}
|
||||
}
|
||||
return self::$me;
|
||||
|
||||
@@ -21,6 +21,13 @@ services:
|
||||
- 8070:8070
|
||||
volumes:
|
||||
- ./docker/prod/app_data:/var/www/html/app/data
|
||||
|
||||
icehrm-worker:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-worker
|
||||
args:
|
||||
- EXE_ENV=prod
|
||||
volumes:
|
||||
db_data:
|
||||
app_data:
|
||||
|
||||
@@ -19,5 +19,12 @@ services:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
|
||||
icehrm-worker-dev:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-worker
|
||||
args:
|
||||
- EXE_ENV=development
|
||||
volumes:
|
||||
db_data:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
ini_set('error_log', 'data/icehrm.log');
|
||||
ini_set('error_log', '/var/www/html/app/data/icehrm.log');
|
||||
|
||||
define('CLIENT_NAME', 'icehrm');
|
||||
define('APP_BASE_PATH', '/var/www/html/core/');
|
||||
@@ -16,3 +16,5 @@ define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'
|
||||
//file upload
|
||||
define('FILE_TYPES', 'jpg,png,jpeg');
|
||||
define('MAX_FILE_SIZE_KB', 10 * 1024);
|
||||
|
||||
define('LOG_STDERR', '1');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
ini_set('error_log', 'data/icehrm.log');
|
||||
ini_set('error_log', '/var/www/html/app/data/icehrm.log');
|
||||
|
||||
define('CLIENT_NAME', 'icehrm');
|
||||
define('APP_BASE_PATH', '/var/www/html/core/');
|
||||
@@ -16,3 +16,5 @@ define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'
|
||||
//file upload
|
||||
define('FILE_TYPES', 'jpg,png,jpeg');
|
||||
define('MAX_FILE_SIZE_KB', 10 * 1024);
|
||||
|
||||
define('LOG_STDERR', '1');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
ini_set('error_log', 'data/icehrm.log');
|
||||
ini_set('error_log', '/var/www/html/app/data/icehrm.log');
|
||||
|
||||
define('CLIENT_NAME', 'icehrm');
|
||||
define('APP_BASE_PATH', '/var/www/html/core/');
|
||||
@@ -16,3 +16,5 @@ define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'
|
||||
//file upload
|
||||
define('FILE_TYPES', 'jpg,png,jpeg');
|
||||
define('MAX_FILE_SIZE_KB', 10 * 1024);
|
||||
|
||||
define('LOG_STDERR', '1');
|
||||
|
||||
1
docker/worker/config/ice-cron
Normal file
1
docker/worker/config/ice-cron
Normal file
@@ -0,0 +1 @@
|
||||
* * * * * php /var/www/html/app/cron.php
|
||||
2
docker/worker/config/php.ini
Normal file
2
docker/worker/config/php.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[Date]
|
||||
date.timezone="UTC"
|
||||
92
readme.md
92
readme.md
@@ -10,6 +10,31 @@ properly.
|
||||
- [IceHrm Demo](https://icehrm.com/icehrm-demo)
|
||||
- Feature rich version of IceHrm (IceHrmPro) is available at [https://icehrm.com/purchase-icehrmpro](https://icehrm.com/purchase-icehrmpro)
|
||||
|
||||
Getting started
|
||||
---------------
|
||||
|
||||
The easiest way to run IceHrm is using docker
|
||||
- Install docker on Mac, Windows or Linux [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
|
||||
|
||||
For Linux you need to install docker compose separately here [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
|
||||
|
||||
|
||||
```
|
||||
$ git clone https://github.com/gamonoid/icehrm.git
|
||||
$ cd icehrm
|
||||
$ docker-compose -f docker-compose-prod.yaml up -d
|
||||
```
|
||||
|
||||
- Visit [http://localhost:8070/](http://localhost:8070/) to load icehrm, that's it
|
||||
|
||||
You can find database and app data under `icehrm/docker/production`
|
||||
|
||||
When you want to kill the docker containers
|
||||
|
||||
```
|
||||
docker-compose -f docker-compose-prod.yaml down
|
||||
```
|
||||
|
||||
|
||||
IceHrm Mobile App (Beta)
|
||||
------------------------
|
||||
@@ -37,8 +62,8 @@ Useful Links
|
||||
* Community Support: [http://stackoverflow.com/search?q=icehrm](http://stackoverflow.com/search?q=icehrm)
|
||||
* IceHrm Opensource Blog: [http://icehrm.org](http://icehrm.org)
|
||||
|
||||
Installation
|
||||
------------
|
||||
Installation without Docker
|
||||
---------------------------
|
||||
* Download the latest release https://github.com/gamonoid/icehrm/releases/latest
|
||||
|
||||
* Copy the downloaded file to the path you want to install iCE Hrm in your server and extract.
|
||||
@@ -66,57 +91,56 @@ Refer: [http://blog.icehrm.com/docs/upgrade/](http://blog.icehrm.com/docs/upgrad
|
||||
Setup IceHrm Development Environment
|
||||
------------------------------------
|
||||
|
||||
IceHrm development environment is packaged as a Vagrant box. I includes php7, nginx, phpunit and other
|
||||
software required for running icehrm
|
||||
IceHrm uses docker to setup development environment
|
||||
|
||||
Preparing development VM with Vagrant
|
||||
-------------------------------------
|
||||
|
||||
- Clone icehrm from https://github.com/gamonoid/icehrm.git or download the source
|
||||
|
||||
- Install Vagrant [https://www.vagrantup.com/downloads.html](https://www.vagrantup.com/downloads.html)
|
||||
|
||||
- Run vagrant up in icehrm root directory (this will download icehrm vagrant image which is ~1 GB)
|
||||
|
||||
```
|
||||
~ $ vagrant up
|
||||
$ git clone https://github.com/gamonoid/icehrm.git
|
||||
$ cd icehrm
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
- Run vagrant ssh to login to the Virtual machine
|
||||
- Load icehrm Development preview
|
||||
|
||||
```
|
||||
~ $ vagrant ssh
|
||||
http://localhost:8080
|
||||
```
|
||||
|
||||
- Add following entries to the end of the host file to map icehrm domains to VagrantBox (on MacOS and Linux this is /etc/hosts | on windows this is Windows\System32\Drivers\etc\hosts)
|
||||
- Make some changes and the changes will be reflected on the above url
|
||||
|
||||
- Run e2e (cypress) tests
|
||||
|
||||
```
|
||||
192.168.40.40 app.icehrm-open.test
|
||||
192.168.40.40 clients.icehrm-open.test
|
||||
docker-compose -f docker-compose-testing.yaml up --exit-code-from cypress
|
||||
```
|
||||
|
||||
- When you are ready to push your changes to production, make sure to build the production images
|
||||
```
|
||||
$ docker-compose -f docker-compose-prod.yaml up -d --build
|
||||
```
|
||||
|
||||
- Navigate to [http://clients.icehrm-open.test/dev](http://clients.icehrm-open.test/dev) to load icehrm from VM. (user:admin/pass:admin)
|
||||
|
||||
### Notes to Developers
|
||||
### Building frontend assets
|
||||
|
||||
- When ever you have done a change to JavaScript or CSS files in icehrm/web rebuild the frontend
|
||||
- When ever you have done a change to JavaScript or CSS files in icehrm/web you need to rebuild the frontend
|
||||
|
||||
- First make sure you have all the dependencies (just doing this once is enough)
|
||||
```
|
||||
~ $ cd /vagrant
|
||||
~ $ gulp
|
||||
$ cd icehrm/web
|
||||
$ npm install
|
||||
$ cd ..
|
||||
$ npm install
|
||||
```
|
||||
|
||||
- Then run gulp
|
||||
```
|
||||
$ gulp
|
||||
```
|
||||
|
||||
### Docker Setup
|
||||
|
||||
docker run -it -v $PWD:/e2e -w /e2e cypress/included:3.2.0
|
||||
|
||||
vagrant ssh -c 'cd /vagrant/core/robo; php robo.phar reset:db test; php robo.phar create:tables test; php robo.phar migrate:all test; php robo.phar execute:fixtures test'
|
||||
|
||||
docker-compose up --build
|
||||
|
||||
docker-compose -f docker-compose-testing.yaml up
|
||||
|
||||
|
||||
docker-compose -f docker-compose-testing.yaml up --exit-code-from cypress
|
||||
|
||||
|
||||
- If you have only changed an admin module and you know which module it is
|
||||
```
|
||||
$ gulp admin-js --memployees
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user