Required Dependencies
PHP >= 7.3
NodeJS version >= 10.0.0 < 15.0.0
Yarn version == 1.22.x
Git version >= 2.0.0
Docker version >= 17.12.0
docker-compose >= 1.12.0
Local environment with Docker
Clone project to your development workspace
git clone git@git.web-essentials.asia:hiv-tra-20/Distribution.git ~/dev/docker-projects/hiv/distribution
Navigate to your project
cd ~/dev/docker-projects/hiv/distribution sudo chown -R ${USER}:${USER} .
Run script to set up
chmod u+x local_setup/setup.sh ./local_setup/setup.sh
Note: Actually, the script is trying to kill all conflict ports but sometimes it could not. So if there are conflict ports, you have to kill it first then rerun the script. Here is the command to kill the port in Linux:
sudo kill $(sudo lsof -t -i:PORT_TO_FREE)
.Verify with your Docker host on the browser.
Configure Keycloak
Try login through web browser from Docker with credentials from
docker-compose.yml
If it does not work, copy all content from file
docker-compose-dev.yml
(expose static port) to replacedocker-compose.yml
and restart all containersdocker-compose up -d
Re-try login through http://localhost:8080/auth/ with same credentials
Import and update Realm Settings
Export Realm from Latest or Demo
hi
andhi-therapist
Import those two Realm into your local running Keycloak
Update
Frontend URL
of each Realm Settings tohttp://local-rehabilitation.wehost.asia/auth
orhttp://localhost:8080/auth/
(depend on which URL you have logged in success)
Create default user to generate access token (DO NOT DELETE these users)
Note: These users should have primary client roles:
manager-users
,query-groups
, andquery-users
(Client Roles -> realm-management)Create
hi_backend
with passwordhi_backendDBPWD
onhi
RealmCreate
therapist_backend
with passwordtherapist_backendDBPWD
ontherapist
Realm
Configure environment variables
cp ../admin-service/.env.example ../admin-service/.env cp ../therapist-service/.env.example ../therapist-service/.env cp ../patient-service/.env.example ../patient-service/.env
Edit
vi ../admin-service/.env
by replacing value forKEYCLOAK_BACKEND_SECRET
getting fromhi
Realm -> Clients
Edit
vi ../therapist-service/.env
by replacing value forKEYCLOAK_BACKEND_SECRET
getting fromhi-therapist
Realm -> Clients
Migrate database tables
docker-compose run --rm admin_service php artisan migrate docker-compose run --rm therapist_service php artisan migrate docker-compose run --rm patient_service php artisan migrate
Access database via user interface: http://localhost:8060/
Enjoy your development on admin-web-app
or therapist-web-app
Useful docker command
Manually up docker
docker-compose up -d
Manually kill running docker
docker-compose kill
Add Comment