-
Notifications
You must be signed in to change notification settings - Fork 12
How to setup
- Docker engine installed on the local machine (Get docker)
- Recommended docker version 19.03.0 or upper
- Recommended docker-compose version 1.25.0 (Get docker compose)
- Installed Git on the local machine (Install Git Locally)
Install the prerequisites given above before continuing.
Clone this repository. We recommend placing the cloned repo in your ~/Documents
directory (the rest of this guide is written assuming you did so).
git clone https://github.com/orangehrm/orangehrm-os-dev-environment
Go into the cloned directory.
cd orangehrm-os-dev-environment
Make a directory for the document root.
mkdir html
Copy the file .env.dist
to .env
and change the LOCAL_SRC
parameter to your project's path.
cp .env.dist .env
Run pwd
to get the current directory. (use this output to define LOCAL_SRC
.)
Open .env
file and edit the LOCAL_SRC
parameter. (e.g. gedit .env
)
Don't forgot to append /html the to end of the path got from pwd, i.e.
LOCAL_SRC =/home/administrator/Documents/orangehrm-os-dev-environment/html
# Or
LOCAL_SRC =~/Documents/orangehrm-os-dev-environment/html
Open /etc/hosts
file using vim or nano or gedit editor
sudo gedit /etc/hosts
Add this line to the file 127.0.0.1 php56 php70 php71 php72 php73 php74 php80 php81 php82 php83
Build the latest Docker images locally (only necessary images)
docker compose build nginx php-7.4 php-8.0 php-8.1 php-8.2 php-8.3
This will build Nginx, PHP 7.4 - 8.3 docker images.
If you want to build legacy containers, pass docker-compose-legacy-services.yml
using -f
docker compose -f docker-compose-legacy-services.yml build php-5.6 php-7.0 php-7.1. php-7.2 php-7.3
Start only the containers you require.
docker-compose up -d phpmyadmin php-7.4 php-8.2 mariadb104 mariadb105
Run docker ps
to check the running containers.
Other available DB containers
- mysql55
- mysql56
- mysql57
- mysql80
- mysql81
- mysql82
- mariadb55
- mariadb100
- mariadb101
- mariadb102
- mariadb103
- mariadb106
- mariadb107
- mariadb108
- mariadb109
- mariadb1010
- mariadb1011
- mariadb110
- mariadb111
- mariadb112
Note: docker compose
commands should run within the docker developer environment directory (e.g. ~/Documents/orangehrm-os-dev-environment)
Create a file named index.php
in ~/Documents/orangehrm-os-dev-environment/html
, and include the following content.
<?php
echo 'PHP Version: ' . PHP_VERSION;
$host = isset($_GET['host']) ? $_GET['host'] : 'mariadb105';
$username = isset($_GET['user']) ? $_GET['user'] : 'root';
$password = isset($_GET['pass']) ? $_GET['pass'] : 'root';
$port = isset($_GET['port']) ? $_GET['port'] : '3306';
$dsn = sprintf("mysql:host=%s;port=%s;charset=utf8mb4;", $host, $port);
$conn = new PDO($dsn, $username, $password);
echo '<br/>Database Connection Status: ' . $conn->getAttribute(PDO::ATTR_CONNECTION_STATUS);
Try to access index.php
via the browser.
- http://php74/index.php
- http://php80/index.php
- http://php81/index.php
- http://php82/index.php
- http://php83/index.php
docker exec -it <container name or ID> bash
Open phpMyAdmin http://localhost:9092
- Default username: root
- Default password: root
- Server choice: mariadb104 (select from dropdown)
Additional Resources