ODK Central Build Error

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

3 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

After executing :point_up_2: command, this is what I got back.

{"Status":"unhealthy","FailingStreak":8333,"Log":[{"Start":"2020-09-21T04:55:17.372930056-04:00","End":"2020-09-21T04:55:17.474724042-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:55:47.478806438-04:00","End":"2020-09-21T04:55:47.581083314-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:56:17.584939398-04:00","End":"2020-09-21T04:56:17.688484183-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:56:47.692954492-04:00","End":"2020-09-21T04:56:47.794798131-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"},{"Start":"2020-09-21T04:57:17.7982906-04:00","End":"2020-09-21T04:57:17.901514048-04:00","ExitCode":1,"Output":"/bin/sh: 1: nc: not found\n"}]}

Then connect to the nginx container and install netcat

apt-get install netcat

This is not normal because netcat should be installed already (nginx.dockerfile) and it worked when you executed it manually :face_with_monocle: (may be I am mistaken and you should install netcat on the host instead of the container)

RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib 

May be there is no link between nc and netcat, so you might want to update the health check in the docker-composer (line 40) but I doubt it

 nginx:
   container_name: nginx
   build:
     context: .
     dockerfile: nginx.dockerfile
   depends_on:
     - service
     - enketo
   environment:
     - SSL_TYPE=${SSL_TYPE}
     - DOMAIN=${DOMAIN}
     - CERTBOT_EMAIL=${SYSADMIN_EMAIL}
   ports:
     - "80:80"
     - "443:443"
   healthcheck:
     test: [ "CMD-SHELL", "netcat -z localhost 443 || exit 1" ]
   restart: always

br

Did you try to rebuild everything after you change the EOL? (this will remove all container and image, be careful if you have a bad internet connectivity, that means downloading them all over again)

docker-compose down --rmi all

br

A dialogue between terminal and :smile_cat: yours truly...lol

:man_technologist:: docker exec -it ebfaecfd15fb bash
:asterisk: : <got into root@ebfaecfd15fb>

:man_technologist:: apt-get install netcat
:asterisk:: E: Unable to locate package netcat

:man_technologist:: apt-get update --fix-missing
:asterisk: : Reading package lists... Done

:man_technologist:: apt-get install netcat
:asterisk: : Setting up netcat (1.10-41.1) ...

:man_technologist:: RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib
:asterisk: : E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

:man_technologist:: apt-get update --fix-missing
:asterisk: : Reading package lists... Done

:man_technologist:: RUN apt-get update; apt-get install -y openssl netcat nginx-extras lua-zlib
:asterisk: :

bash: RUN: command not found
Reading package lists... Done
Building dependency tree
Reading state information... Done
netcat is already the newest version (1.10-41.1).
The following additional packages will be installed:
libgdbm-compat4 libgdbm6 libhiredis0.14 libluajit-5.1-2 libluajit-5.1-common
libnginx-mod-http-auth-pam libnginx-mod-http-cache-purge libnginx-mod-http-dav-ext
libnginx-mod-http-echo libnginx-mod-http-fancyindex libnginx-mod-http-geoip
libnginx-mod-http-headers-more-filter libnginx-mod-http-image-filter libnginx-mod-http-lua
libnginx-mod-http-ndk libnginx-mod-http-perl libnginx-mod-http-subs-filter
libnginx-mod-http-uploadprogress libnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter
libnginx-mod-mail libnginx-mod-nchan libnginx-mod-stream libperl5.28 netbase nginx-common perl
perl-base perl-modules-5.28
Suggested packages:
gdbm-l10n fcgiwrap nginx-doc ssl-cert perl-doc libterm-readline-gnu-perl
| libterm-readline-perl-perl make libb-debug-perl liblocale-codes-perl
The following packages will be REMOVED:
nginx nginx-module-geoip nginx-module-image-filter nginx-module-njs nginx-module-xslt
The following NEW packages will be installed:
libgdbm-compat4 libgdbm6 libhiredis0.14 libluajit-5.1-2 libluajit-5.1-common
libnginx-mod-http-auth-pam libnginx-mod-http-cache-purge libnginx-mod-http-dav-ext
libnginx-mod-http-echo libnginx-mod-http-fancyindex libnginx-mod-http-geoip
libnginx-mod-http-headers-more-filter libnginx-mod-http-image-filter libnginx-mod-http-lua
libnginx-mod-http-ndk libnginx-mod-http-perl libnginx-mod-http-subs-filter
libnginx-mod-http-uploadprogress libnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter
libnginx-mod-mail libnginx-mod-nchan libnginx-mod-stream libperl5.28 lua-zlib netbase nginx-common
nginx-extras perl perl-modules-5.28
The following packages will be upgraded:
openssl perl-base
2 upgraded, 30 newly installed, 5 to remove and 22 not upgraded.
Need to get 12.5 MB of archives.
After this operation, 47.2 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 perl-base amd64 5.28.1-6+deb10u1 [1514 kB]
Get:2 http://security.debian.org/debian-security buster/updates/main amd64 nginx-common all 1.14.2-2+deb10u3 [121 kB]
Err:3 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-auth-pam amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-cache-purge amd64 1.14.2-2+deb10u3 [95.1 kB]
Err:5 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-dav-ext amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:6 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-echo amd64 1.14.2-2+deb10u3 [104 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 perl-modules-5.28 all 5.28.1-6+deb10u1 [2873 kB]
Err:8 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-fancyindex amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:9 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-geoip amd64 1.14.2-2+deb10u3 [94.0 kB]
Err:10 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-headers-more-filter amd64 1.14.2-2+deb10u3
400 Bad Request [IP: 151.101.248.204 80]
Get:11 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-image-filter amd64 1.14.2-2+deb10u3 [97.5 kB]
Get:12 http://deb.debian.org/debian buster/main amd64 libgdbm6 amd64 1.18.1-4 [64.7 kB]
Get:13 http://deb.debian.org/debian buster/main amd64 libgdbm-compat4 amd64 1.18.1-4 [44.1 kB]
Get:14 http://deb.debian.org/debian buster/main amd64 libperl5.28 amd64 5.28.1-6+deb10u1 [3894 kB]
Err:15 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-ndk amd64 1.14.2-2+deb10u3
501 Not Implemented [IP: 151.101.248.204 80]
Get:16 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-lua amd64 1.14.2-2+deb10u3 [238 kB]
Err:16 http://security.debian.org/debian-security buster/updates/main amd64 libnginx-mod-http-lua amd64 1.14.2-2+deb10u3
File has unexpected size (93232 != 237784). Mirror sync in progress? [IP: 151.101.248.204 80]
Hashes of expected file:

:man_technologist:: docker-compose down --rmi all
:asterisk: : Stopping nginx ... done Stopping service ... done Stopping enketo ... done Stopping mail ... done Stopping pyxform ... done Stopping enketo_redis_main ... done Stopping enketo_redis_cache ... done Stopping central_postgres_1 ... done Removing nginx ... done Removing service ... done Removing enketo ... done Removing mail ... done Removing pyxform ... done Removing enketo_redis_main ... done Removing enketo_redis_cache ... done Removing central_postgres_1 ... done Removing secrets ... done Removing network central_default Removing image postgres:9.6 Removing image itsissa/namshi-smtp:4.89-2.deb9u5 Removing image getodk/pyxform-http:v1.0.0 Removing image central_secrets Removing image redis:5 Removing image redis:5 WARNING: Image redis:5 not found. Removing image central_enketo Removing image central_service Removing image central_nginx

:man_technologist:: docker ps
:asterisk: : CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

:man_technologist:: docker-compose build
:asterisk: : 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

:man_technologist::
:asterisk: :