ODK Central Build Error

I attempted to get ODK Central running on Windows 10 1903 build 18362.1016 with an instance of Docker desktop 2.3.0.4. After executing docker-compose build I get
Service 'nginx' failed to build: The command '/bin/sh -c files/prebuild/write-version.sh' re turned a non-zero code: 127
I had the same error a few weeks back trying to do the same thing on an older PC running docker toolbox. Unfortunately, I can't include the version of that at this moment.
Anyone with any ideas on how to correct this?

Hi @aankrah

A warm welcome to the forum, when you get a chance, please introduce yourself and add a photo of yourself as the Avatar, it helps build community.

I do not use Docker for Windows, I assume you might be missing the Linux Subsystem for Windows. If you dont have it installed please install it following instructions here and reinstall ODK Central.

Hey there @Ronald_Munjoma. Thanks for your contribution. I found it quite informative.
However, even after installing the subsystem for linux and setting wsl 2 as the default, i still run into the same error when i get to docker-compose build.
Any ideas?

We don't test with WSL and I'd be surprised if it worked out of the box.

@Ronald_Munjoma have you successfully installed Central with WSL?

@aankrah It might be easiest to install an Ubuntu VM on your machine and install Central inside that CM.

Hi @yanokwa,
Thanks for your reply. Will I be right to assume the Ubuntu System I'm running off the WSL will land me in the same soup?

Hi @yanokwa.
I created an Ubuntu VM and started the process to get Central running as you suggested.
However, I ran into another issue. When I execute docker-compose build, it ends this time with
Service 'nginx' failed to build: The command '/bin/sh -c apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib' returned a non-zero code: 100

I found this within the forum and tried docker-compose logs nginx and git status. Guess its better if I just show you/the community the output of those.

Any ideas?

A little update.
I opened the nginx.dockerfile in the central directory and executed the command that throws the error (RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib) as root but without the 'run'. Funny thing was, it run just fine without any issues but reported the same error when I tried to build the project afterwards. What could be the issue?

The errors that are being shown look like network errors from a poor network connection. Try another docker-compose build.

1 Like

Hi again @yanokwa,
Didn't think it was network related but I tried another docker-compose build anyway. As expected, I got the same errors. I went further to try get the file that yielded the first of those errors via a web browser and sure enough, it was available for download.

I took things a step further and checked the closest debian.org server and used Ookla for a speed test to a random server in the same area. Results can be seen attached.

Anything else I could try?

Dear,

this can be fixed easily:
1- in nginx.dockerfile add /bin/sh to those 2 lines:

RUN /bin/sh ./files/prebuild/write-version.sh
RUN /bin/sh ./files/prebuild/build-frontend.sh

Then replace the Windows EOL by linux EOLin all the files (Git wrongly configured to use CRLF instead of LF when writing the files)

br

2 Likes

@aankrah, did you find a way to solve the problem?

Worked like a charm!
Thanks @delcroip.

After editing the 2 lines (as root), I used sed -i.bak 's/\r$//' nginx.dockerfile to change the Windows EOL to Linux EOL and to create a backup file nginx.dockerfile.bak (you can ignore the -i.bak if you don't need the backup file).

Leaving this here in case someone faces this issue.
Going forward with my installation. Will let the community know how it goes.

1 Like

Yes sir!
It's right here

Hi,

My message was actually to make the windows docker working but if it helped for the linux one I happy for you :slight_smile:

br

Hi community,
after my last success, I encountered an issue when I ran docker-compose up -d. It reports that Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use but a quick look at the activity on the port with lsof -i:80 (as root) shows that it is occupied by the nginx.

Any ideas?

Hello again community :grin:

I was able to solve that :point_up_2: issue. Turns out, I had nginx running globally on my instance of Ubuntu. To check if you have the same (ie if you're facing the same issue) run ps waux | grep nginx. If you see more than one instance of nginx, then you may have nginx running globally as well.

To kill nginx global and be on your merry way, you can run sudo nginx -s stop.
Let us know if this helps.
Ciao! :wave: :kissing:

Here I am again :man_facepalming:t4:
New day, new error. After running docker-compose ps nginx is marked as unhealthy.

Any ideas @yanokwa @delcroip @mkjawadi @LN?

Hi,
To troubleshoot it, connect to the nginx and run the healthcheck as defined in the docker-compose
nc -z localhost 443 || exit 1

by starting to test the left part
nc -z localhost 443

on my stack it doesn't return anything and it is shown as healthy

# nc -z localhost 443 || exit 1
# nc -z localhost 443

Got nothing back when I executed those 2. However, the state hasn't gotten any better.

I should have asked you to check first hat was the HC result

docker inspect --format "{{json .State.Health }}" nginx 

br

1 Like