Dilps/Tiresias is a web application based on GraphQL for the API and Angular for the client.
The recommended way to get a working copy is the following:
- Set up a nginx virtual host to point to
htdocs/
directory and to includeconfiguration/nginx.conf
- Create a database in MariaDB named "dilps"
- Configure database in
config/autoload/local.php
(see exampleconfig/autoload/local.php.dist
) - Copy & rename the example.env file to .env (
cp example.env .env
). Replace the values if needed. - Finally, build the app:
./bin/build.sh
A working Docker installation is mandatory.
Copy the following files:
cp example.env .env
cp dev/example.env dev/.env
cp config/autoload/local.php.dist config/autoload/local.php
cp config/autoload/tiresias.local.php.dist config/autoload/tiresias.local.php
You can replace the values if needed, but the default ones should work.
Edit hosts file to point dilps.docker
and tiresias.docker
to your docker host.
Run the following docker commands from the project root directory.
Build & run all the containers for this project:
docker-compose up
(add -d if you want to run in the background and silence the logs)
The project is compiled each time the containers are started. You'll get a Build at log message as soon as everything is ready to be used.
To load some dummy data & users, please run the following command:
docker exec dilps-tiresias-app ./bin/load-test-data.php
To access the application container (apache-php):
docker exec -it dilps-tiresias-app bash
Data for the mysql service is persisted using docker named volumes. You can see what volumes are currently present with:
docker volume ls
If you want to remove a volume (e.g. to start with a fresh database), you can use the following command.
docker volume rm volume_name
To access the main application please use the following links.
- http://dilps.docker:8181 (administrator / administrator)
- http://tiresias.docker:8181 (administrator / administrator)
To access the database please use the following link.
- Server: dilps-tiresias-mysql
- Username: user
- Password: password
To access mails please use the following link.
Or to get the messages in JSON format.
http://dilps.docker:8027/api/v2/messages
To switch the API to development (to enable logging), run:
composer development-enable
Logs will be available in logs/all.log
.
When in development mode, the configuration cache is disabled, and switching in and out of development mode will remove the configuration cache.
You may need to clear the configuration cache in production when deploying if you deploy to the same directory. You may do so using the following:
composer clear-config-cache
PHPUnit tests require a reference database dump. When the dump is loaded it will destroy existing database. This must be done once before running tests. Then each test is ran within a transaction which is rolled back, so the database state is always predictable.
To run PHPunit test:
./bin/load-test-data.php
./vendor/bin/phpunit # as many times as necessary
Run ng test
to execute the unit tests via Karma.
To run Karma or e2e tests inside a Docker container, run the following command from the base repository directory.
The image tag used should be the same as the playwright version installed for this app.
The docker compose must be up for these tests to be executed.
# Karma
docker run -it --rm -v $PWD:/var/www -w /var/www --ipc host --network dilps-tiresias_dilps-tiresias-net mcr.microsoft.com/playwright:v1.33.0-focal yarn ng test --watch false --browsers ChromeHeadlessCustom
# e2e
docker run -it --rm -v $PWD:/var/www -w /var/www --ipc host --network dilps-tiresias_dilps-tiresias-net mcr.microsoft.com/playwright:v1.33.0-focal yarn e2e
Run yarn e2e
to execute the end-to-end tests via Playwright.
This project is tested with BrowserStack.