- Notifications
You must be signed in to change notification settings - Fork0
itk-dev/event-database-api
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is the next iteration ofthe event database used by themunicipality of Aarhus.
This repository contains the frontend API, if you are looking for the event imports, the code is located athttps://github.com/itk-dev/event-database-imports.
The event database is an API platform for event aggregation from the public vendors throughout the cites. It gets datamainly from feeds (JSON/XML) or APIs provided by the vendors. It is highly configurable in doing custom feed mappingsand extendable to read data from APIs and map this data to event. It also has a user interface to allow manual enteringof events.
The data input is pulled/pushed from a range of differently formatted sources and normalized into an event format thatcan be used across platforms.
For more detailed and technical documentation, see thedocs folder in this repository.
This project utilizes record architecture decisions documents which can be located inhttps://github.com/itk-dev/event-database-imports/tree/develop/docsin this repository.
docker compose pulldocker compose up --detachdocker composeexec phpfpm composer installThe project comes with doctrine fixtures to help development on local machines. They can be loaded with the standarddoctrine fixture load command:
docker composeexec phpfpm bin/console app:fixtures:load<index>
<index> must be one ofevents,organizations,occurrences,daily_occurrences,tags,vocabularies orlocations (cf.src/Model/IndexName.php).
The fixtures are related to the backend where the fixtures are generated by using theapp:index:dump command. The loadabove command downloads the fixtures fromGitHub and loads them intoElasticSearch.
Tip
Usetask fixtures:load to load all fixtures into Elasticsearch.
Caution
If thetask fixtures:load command (or anybin/console app:fixtures:load incantation) fails with an error like
No alive nodes. All the 1 nodes seem to be down.
you must reset the Elasticsearch service to be ready for requests, e.g. by running
docker composeexec elasticsearch curl'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s' --verbose
until it returnsHTTP/1.1 200 OK (cf.How to Implement Elasticsearch Health Check in DockerCompose).
Alternatively, you can rundocker compose up --detach --wait to recreate all services and(automatically) wait for Elasticsearch to be ready – it takes a while …
To access the API, a valid API key must be presented in theX-Api-Key header, e.g.
curl --header"X-Api-Key: api_key_1""http://$(docker compose port nginx 8080)/api/v2/events"
Valid API keys are defined via theAPP_API_KEYS environment variable:
# .env.localAPP_API_KEYS='[ {"username": "user_1", "apikey": "api_key_1"}, {"username": "user_2", "apikey": "api_key_2"}]'
When installing composer and Symfony based application in production, you should not install development packages,hence use this command:
docker composeexec phpfpm composer install --no-dev --optimize-autoloaderGet events with(out) public access:
curl --silent --header"X-Api-Key: api_key_1""http://$(docker compose port nginx 8080)/api/v2/events?publicAccess=true"| docker run --rm --interactive ghcr.io/jqlang/jq:latest'.["hydra:member"]|length'curl --silent --header"X-Api-Key: api_key_1""http://$(docker compose port nginx 8080)/api/v2/events?publicAccess=false"| docker run --rm --interactive ghcr.io/jqlang/jq:latest'.["hydra:member"]|length'
task fixtures:load:test --yestask api:test
You can pass additional arguments to filter tests, e.g.
task api:test -- --filter Event
Tip
Use Task'sDry run mode (task --dry) to see the commands that areactually run, e.g.
$ task --dry api:test -- --filter Eventtask: [compose] docker composeexec phpfpm bin/phpunit --filter EventThis is useful to tweak a (test) command without changingTaskfile.yml.
About
Event database 2.0 API
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.