Closed glenda-wee closed 4 years ago
Hey @glenda-wee ! It looks like you were just trying to build the docker image locally, without building the application jar itself beforehand. So that's the reason the jar couldn't be found.
The most convenient solution would be to just use our pre-build docker image. Have a look here in the readme and here on docker hub. Feel free to ask more questions or tell us how it worked out for you :)
Also, if you specifically want to continue to build the image locally, have a look here in the readme.
Hi @jakesmolka ! Thanks for your quick reply, I have followed the instructions and it appears to be running on the Docker desktop.
However, upon running the build EHRbase (executing the command mvn package), I encountered this error:
I'm rather new to OpenEHR, can I get your advice on this? Thanks a ton! :)
You need to build without executing the tests, as they need an additional test database.
Try running mvn -DskipTests package
.
However, I think it would be more convenient to move the jar building to docker as well. To keep the image size reasonable small, the building container and the container for the final jar file could be separated.
@glenda-wee I would recommend to not build EHRbase locally, if you just want to use it (compared to developing). So I wouldn't execute anything with maven or java directly.
There are some approaches to get an EHRbase docker setup running. But the basic architecture is, that you will need the the postgres database and the EHRbase image to run configured containers with them.
For instance, in the docker hub link from above it states the following two commands:
First, to start the database:
docker run --name ehrdb --network ehrbase-net -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e EHRBASE_USER=ehrbase -e EHRBASE_PASSWORD=ehrbase ehrbaseorg/ehrbase-postgres:latest
And second, to start EHRbase itself:
docker run --name ehrbase --network ehrbase-net -d -p 8080:8080 -e DB_URL=jdbc:postgresql://ehrdb:5432/ehrbase -e DB_USER=ehrbase -e DB_PASS=ehrbase -e SYSTEM_NAME=local.ehrbase.org ehrbaseorg/ehrbase:latest
Using those two should result in a running setup.
To verify that you could either peek into the docker logs or use a REST-tool like Postman or Insomia, to create a simple HTTP POST request pointing at http://localhost:8080/ehrbase/rest/openehr/v1/ehr
. This should create an EHR.
From that point on you're in the realm of openEHR. Maybe have a look at our Getting Started page to learn more. If you're completely new to openEHR the concepts can be overwhelming. So if you stuck somewhere or just want to see a simple running example, ping us again. We are also in the process of extending our SDK documentation with a tutorial application, which I could give a sneak peak at.
@jakesmolka I used the commands that you sent me and managed to get something up, but it showed a bad request:
May I know what the 'subject id' and 'subject namespace' parameters are?
Also thank you for the link! It has helped me understand better :)
You need to build without executing the tests, as they need an additional test database. Try running
mvn -DskipTests package
.However, I think it would be more convenient to move the jar building to docker as well. To keep the image size reasonable small, the building container and the container for the final jar file could be separated.
I tried this, but it resulted in the same error :( is the 'api' failure supposed to be due to the lack of an additional testing database?
@glenda-wee This Whitelabel Error Page looks like you had it almost working. But instead of going to http://localhost:8080/ehrbase/rest/openehr/v1/ehr
with your browser, you should use on of the REST-tools I mentioned (Postman or Insomia). There you need to explicitly create a POST request with that URL as target.
Altogether this request and its response might look like that:
Our REST API is build on the specification of the official openEHR REST API, so you should also have a look at its documentation: https://specifications.openehr.org/releases/ITS-REST/latest/ehr.html#ehr-ehr-post (here directly the POST EHR we are talking about)
Looking at another possible endpoint, the GET EHR, you can also see where the subject_id
and subject_namespace
were coming from. Your web browser just did a GET, without any parameters. The error on the error page in your comment just complains, because those parameters would have been required to make that request valid.
Basically, your setup was working already, so that's great.
Now that you have created your first EHR, which is the root object, you can go on an explore the rest of the API.
Depending on what your goal is, and why you are looking into openEHR and EHRbase, it would make sense to learn more about specific parts of the openEHR ecosystem.
Anyway, feel free to ask more questions or report on your progress. We are always keen to help to understand EHRbase and openEHR, especially while leaning more about how accessible EHRbase is.
I consider this issue as resolved. Please let me know if this is incorrect, then we can open again.
I am working on a Catalina 10.15.4.
When I tried to run this command: docker build -f application/Dockerfile --build-arg JAR_FILE=application-*.jar -t ehrbaseorg/ehrbase:latest .
I replaced the application version with 0.13.0, as seen here: docker build -f application/Dockerfile --build-arg JAR_FILE=application-0.13.0.jar -t ehrbaseorg/ehrbase:latest .
However, I got this result:
Sending build context to Docker daemon 30.4MB Step 1/9 : FROM adoptopenjdk:11-jre-openj9 ---> c0256f774b32 Step 2/9 : ARG JAR_FILE ---> Using cache ---> cc5639afc540 Step 3/9 : ENV AUTH_TYPE="BASIC" ---> Using cache ---> 132255153805 Step 4/9 : ENV AUTH_USER="ehrbase-user" ---> Using cache ---> 21a056a1bdd1 Step 5/9 : ENV AUTH_PASSWORD="SuperSecretPassword" ---> Using cache ---> 0defeb1133d9 Step 6/9 : COPY application/target/${JAR_FILE} app.jar COPY failed: stat /var/lib/docker/tmp/docker-builder234823719/application/target/application-0.13.0.jar: no such file or directory
Did I key in the wrong application version? Thank you!