If I understand your Dockerfile correctly, you are using Aggregate with an external PostgreSQL database. If this is correct I think you could improve it by doing two things:
First, you could avoid having to run the install by directly using the Gradle build result. We're already doing similar stuff for the installer and packer tasks, and it should be "easy" to repurpose one of them for the Docker image. The Gradle task would take care of producing all the conf files for a specific Docker setup.
Second, you could consider not building a Docker image at all. You could use a stock tomcat:8-alpine image and mount a volume with the Aggregate build files into the container's /var/lib/tomcat8/webapp/ROOT path
This would make your setup less portable but it would make much easier changing confs and would take care of any writing to filesystem needs.
@yanokwa No problem. So you're planning to officially support dockerized deployment?
@ggalmazor Yes, as I just want to use a single shared Postgres service/instance for both Aggregate and our own website.
I did try to use a gradle build stage (basing off https://hub.docker.com/_/gradle/) but I hit some snags and I was afraid of doing something wrong (as said I don't have prior experience with the stack). The installer looks to be the canonical way of deployment and is ready to use without me building anything so I just used it. But yes I do understand that doing a gradle build and tweaking the configuration there should be the goal.
What I really just need is a way to reconfigure Aggregate without reinstalling / rebuilding the WAR file. I think using environment variables is the most straightforward way to do this. I do realize that this will have far reaching implications on how Aggregate do and use configuration hence the questions I presented. I want to approach this first without changing anything in the Aggregate source code if possible (i.e. making a fork).
A docker deployment of Aggregate would be very helpful for the Red Cross, as I think we could then easily incorporate Aggregate into our POSM stack install.
Hi everyone,
First of all very good initiative to have created odk aggregate docker image with postgresql. I am a new user of ODK and I'm a fan.
I am interested to use this image as part of my academic background on a raspberry pi.
I'm just starting with docker so I don't understand all the details to properly install the image with docker compose (https://github.com/opendatakit/aggregate/blob/master/docs/build-and-run-with-docker-compose.md)
On the SD card of the raspberry pi, i flashed the image of hypriot (http://blog.hypriot.com/downloads/), but then I'm lost, I don't know what are the other steps.
I don't understand how to use: Build the setup with ./gradle clean docker ComposeBuild -xtest -PwarMode = complete
Do you have a little tutorial to know all the steps, please?
Thank you in advance for your help.
Regards,
In one hand, you need to ensure your raspi is ready for running Docker containers:
Have you installed Docker? Did you try to run docker run hello-world?
Have you installed Docker Compose? You can check this by running docker-compose
On the other hand, you need to build the Docker Compose build. You can (and should) do this in another, more powerful computer. This is a rough step list of what you should do:
Run the command ./gradlew clean dockerComposeBuild -xtest -PwarMode=complete but I have this error - Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Do you have an idea why the command does not work?
Thank you in advance,
Regards
I see that the guide for installing Java8 you've linked is to install Java8 on the raspi, but you shouldn't do that. You should install Java8 in another, more powerful computer and build the Aggregate Docker Compose setup there.
Hi @ggalmazor,
Thanks for your help, it was me, now the application installs correctly.
However, when I want to change the password of the users, I have this error:
The first strange thing I see is that your Aggregate instance should run on the 8080 port, but the URL in the error message from your previous comment doesn't use any port.
Could you copy here the contents of the security.properties file from your docker-compose setup? You can find it at the relative path: webapps/ROOT/WEB-INF/classes/security.properties
Stop your Docker Compose setup with docker-compose down and try changing the line that has the property security.server.port so that it looks like this:
security.server.port=8080
Then try running it again with docker-compose up -d
Hi @ggalmazor,
Great, it works fine, very well. Thank you very much for the help.
I have another question, is it possible to automatically start the docker-compose.yml file, when starting the raspberry pi?
I think, that it must be indicated in the file yml:
I think the restart option could be useful for some users. Would you care to document it on the Docker Compose instructions for Aggregate? You can use the edit (pencil icon) button to edit it in place
Hi @ggalmazor,
No problem, I will edit the file in github to indicate how to do an automatic restart of the containers.
For information, I redid the procedure at the beginning, I have an error message:
Pulling db (postgres: 9.6-alpine) ...
9.6-alpine: Pulling from library / postgres
ERROR: no matching manifest for linux
Replacing in the file image: postgres: 9.6-alpine by image: postgres: 9.6 it works.
Is it normal?
Regards,