ODK aggregate docker image for PostgreSQL


(Guillermo) #22

Hi, @nicolas!

I love RaspberryPi & ODK projects :slight_smile:

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:

  • Install Java8
  • Download the Aggregate git repo
  • Run the command ./gradlew clean dockerComposeBuild -xtest -PwarMode=complete

Now you should copy the build/docker-compose into the raspi and run it. You should follow the instructions from the Quick Guide


(nicolas) #23

Hi,
Thanks for your help.
I first tested the ggalmazor solution:

  • docker, docker-compose are installed correctly
  • for java I install it as shown on http://wp.brodzinski.net/uncategorized/install-latest-java-8-raspbian/
  • downloading the Aggregate git repo in odk folder
  • 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

(Guillermo) #24

Hi, @nicolas!

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.


(nicolas) #25

Hi @ggalmazor,
When I run the command ./gradlew clean dockerComposeBuild -xtest -PwarMode=complete
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


(Guillermo) #26

Hi, @nicolas!

Did you install Git LFS before cloning the Aggregate repo? This guide explains how to get the code


(nicolas) #27

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:

JSON change-password request to http://192.168.1.30/ssl/user-manage-passwords failed

What needs to change to make it work, knowing that I don't plan to install SSL certificate and the IP address could change?

Regards,


(Guillermo) #28

Hi, @nicolas

I'm glad you were able to build the Docker Compose setup :slight_smile:

Did you make any change to the docker-compose.yml file? Could you copy it here so that I can see what setup you're running?


(nicolas) #29

Hi @ggalmazor,
Here is the docker-compose.yml file that i use to run odk aggregate


First, on the SD card of the RaspberryPI, I flashed the image of hypriot - https://github.com/hypriot/image-builder-rpi/releases/download/v1.9.0/hypriotos-rpi-v1.9.0.img.zip
Regards,


(Guillermo) #30

Thanks for sharing that conf file, @nicolas!

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


(nicolas) #31

Thank you for your reply.
Here is the contents of the security.properties file:

#Thu Nov 07 18:08:31 CET 2018
security.server.realm.realmString=ODK Aggregate
security.server.channelType=ANY_CHANNEL
wink.handlersFactoryClass=org.opendatakit.aggregate.odktables.impl.api.wink.AppEngineHandlersFactory
security.server.superUserUsername=administrator
security.server.forceHttpsLinks=false
security.server.superUser=
security.server.port=80
security.server.securePort=443
security.help.about=auto-generated on 1970-01-01T00:00:00+0000 for ODK Aggregate
security.server.deviceAuthentication=digest
security.server.hostname=
security.server.secureChannelType=ANY_CHANNEL

Regards


(Guillermo) #32

Thanks! It looks like that might be wrong.

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


(nicolas) #33

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:

version: "3"
services:
db:
image: postgres:9.6-alpine
restart: unless-stopped
ports:
- 5432:5432
volumes:
- ./initdb:/docker-entrypoint-initdb.d
- ./pgdata:/var/lib/postgresql/data

wait_for_db:
image: dadarek/wait-for-dependencies
restart: unless-stopped
depends_on:
- db
command: db:5432

tomcat8:
depends_on:
- wait_for_db
image: tomcat:alpine
restart: always
ports:
- 8080:8080
volumes:
- ./webapps:/usr/local/tomcat/webapps

Regards,


(Guillermo) #34

I'm glad that it's working now :slight_smile:

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 :wink:


(nicolas) #35

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,


(Yaw Anokwa) #36

It's not normal. We use the alpine image because it's a lot smaller. The no matching manifest for linux error message you got was likely some kind of networking issue with Docker Hub.


(nicolas) #37

Hi @yanokwa,
Thank you for your reply.
I redid everything and now it works with 9.6-alpine. So it's cool, everything works fine.
Regards,