Kobo Install Not working

Hello,
I’m trying to install the kobo server on my Ubuntu 16.04 but I’ve been stuck on the “KoBoToolbox has not started yet… Wait for another 600seconds?” for the past 4 hours.
I have checked my Kpi.error.log and have this error:
“connect() failed (111: Connection refused) while connection to upstream, client: myIPAddress, server: mydomain.com, request: GET /service_health/HTTP/1.1, upstream :uwsgi://192.168.32.5:8000, host: kf.mydomain.com”.

What do I need to do to get the connection to take place?

Hi @derricknyakiba,
Do you use HTTPS proxy provided by kobo-install ?
What does docker ps command return?
Can you paste the output of ./run.py --setup (do not share your credential)

1 Like

Hi,
No, I’m not using https proxy by kobo-install
The following images are up:
1.kpi
2. kobocat
3. nginx
4. enketo-express-extra-widgets
5. mongo
6 redi
7. mdillon/postgis

Below is the output:

“Where do you want to install?
[/kobo-docker]:
Please confirm path [/kobo-docker]
1) Yes
2) No
[1]:
Do you want to see advanced options?
1) Yes
2) No
[2]:
What kind of installation do you need?
1) On your workstation
2) On a server
[2]:
Public domain name [mydomain.com]:
KPI sub domain [kf]:
KoBoCat sub domain [kc]:
Enketo Express sub domain name [ee]:
Do you want to use HTTPS?
1) Yes
2) No
[2]:
SMTP server:
SMTP port [25]:
SMTP user:
From email address [support@mydomain.com]:
Super user’s username [super_admin]:
Super user’s password [some_random_string]:
Do you want to activate backups?
1) Yes
2) No
[2]:
Already on ‘master’”

Is mydomain.com a valid domain? Does it resolve on your DNS?
What does ./run.py --logs says?

1 Like

Yes, Mydomain is a valid domain.
./run.py --logs returns evertything as okay and “worker ## ready for duty at port 8005”
. My kpi.access.logs now returns an error 499

worker ## ready for duty at port 8005 tells that enketo runs. It doesn’t say if kpi or kobocat are running.
Try to access http://kc.mydomain.com/service_health/ and copy/paste the logs docker returns.

1 Like

Below is the output of running docker logs kobo-docker_kobocat_1
docker logs kobo-docker_kobocat_1
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh…
*** Running /etc/my_init.d/01_wait_for_mongo.bash…
Waiting for container mongo.
2019/10/31 19:19:56 Waiting for host: tcp://mongo.mydomain.private:27017
2019/10/31 19:19:56 Connected to tcp://mongo.mydomain.private:27017
Container mongo up.
*** Running /etc/my_init.d/02_wait_for_postgres.bash…
Waiting for container postgres.
2019/10/31 19:19:56 Waiting for host: tcp://postgres.mydomain.private:5432
2019/10/31 19:19:56 Connected to tcp://postgres.mydomain.private:5432
Container postgres up.
Waiting for Postgres service.
postgres.mydomain.private:5432 - no response
postgres.mydomain.private:5432 - no response
postgres.mydomain.private:5432 - no response
postgres.mydomain.private:5432 - no response
postgres.mydomain.private:5432 - no response
postgres.mydomain.private:5432 - no response
postgres.mydomain.private:5432 - accepting connections
Postgres service running; ensuring kobotoolbox database exists and has PostGIS extensions…
ERROR: database “kobotoolbox” already exists
You are now connected to database “kobotoolbox” as user “kobo”.
CREATE EXTENSION
NOTICE: extension “postgis” already exists, skipping
NOTICE: extension “postgis_topology” already exists, skipping
CREATE EXTENSION
Postgres database kobotoolbox ready for use!
*** Running /etc/my_init.d/03_wait_for_kpi.bash…
Waiting for container kpi.
2019/10/31 19:20:03 Waiting for host: tcp://kpi:8000
2019/10/31 19:20:34 Connected to tcp://kpi:8000
Container kpi up.
Waiting for kpi web service.
kpi web service ready.
*** Running /etc/my_init.d/10_init_kobocat.bash…
KoBoCAT intializing…
Synchronizing database.
Your environment is:“onadata.settings.kc_environ”
Operations to perform:
Synchronize unmigrated apps: gis, staticfiles, admindocs, messages, django_extensions, readonly, humanize, export, django_nose, rest_framework, libs, corsheaders, survey_report, sms_support, pure_pagination
Apply all migrations: authtoken, oauth2_provider, reversion, django_celery_beat, admin, guardian, sessions, sites, auth, viewer, django_digest, contenttypes, api, taggit, registration, stats, logger, main, restservice
Synchronizing apps without migrations:
Creating tables…
Creating table corsheaders_corsmodel
Running deferred SQL…
Installing custom SQL…
Running migrations:
Rendering model states… DONE
Applying logger.0001_initial… OK
Applying main.0001_initial… OK
Applying api.0001_initial… OK
Applying guardian.0001_initial… OK
Applying logger.0002_attachment_filename_length… OK
Applying logger.0003_add-index-on-attachment-media-file… OK
Applying logger.0004_increase-length-of-attachment-mimetype-field… OK
Applying logger.0005_instance_xml_hash… OK
Applying logger.0006_add_validation_status_json_field_in_instance_table… OK
Applying logger.0007_add_validate_permission_on_xform… OK
Applying logger.0008_add_instance_is_synced_with_mongo_and_xform_has_kpi_hooks… OK
Applying logger.0009_add_posted_to_kpi_field_to_logger_instance… OK
Applying logger.0010_attachment_media_file_basename… OK
Applying logger.0011_add-index-to-instance-uuid_and_xform_uuid… OK
Applying main.0002_auto_20160205_1915… OK
Applying restservice.0001_initial… OK
Applying restservice.0002_add_related_name_with_delete_on_cascade… OK
Applying sites.0001_initial… OK
Applying stats.0001_initial… OK
Applying viewer.0001_initial… OK
Applying viewer.0002_auto_20160205_1915… OK
Applying viewer.0003_auto_20171123_1521… OK
Running migrations.
Your environment is:“onadata.settings.kc_environ”
Operations to perform:
Synchronize unmigrated apps: gis, staticfiles, admindocs, messages, django_extensions, readonly, humanize, export, django_nose, rest_framework, libs, corsheaders, survey_report, sms_support, pure_pagination
Apply all migrations: authtoken, oauth2_provider, reversion, django_celery_beat, admin, guardian, sessions, sites, auth, viewer, django_digest, contenttypes, api, taggit, registration, stats, logger, main, restservice
Synchronizing apps without migrations:
Creating tables…
Running deferred SQL…
Installing custom SQL…
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won’t be applied.
Run ‘manage.py makemigrations’ to make new migrations, and then re-run ‘manage.py migrate’ to apply them.
KoBoCat tmp clean-up cron installed
KoBoCAT media automatic backups disabled.
KoBoCAT initialization complete.
*** Running /etc/my_init.d/10_syslog-ng.init…
Oct 31 19:21:02 kobocat syslog-ng[231]: syslog-ng starting up; version=‘3.5.6’
Oct 31 19:21:03 kobocat syslog-ng[231]: EOF on control channel, closing connection;
*** Running /etc/my_init.d/11_sync_static.bash…
Collecting static files…
Your environment is:“onadata.settings.kc_environ”
Done
Resetting ownership of media directory…
Done.
%%%%%%% NOTICE %%%%%%%
% To avoid long delays, we no longer reset ownership recursively
% every time this container starts. If you have trouble with
% permissions, please run the following command inside the
% kobocat container:
% chown -R “wsgi” “/srv/src/kobocat”
%%%%%%%%%%%%%%%%%%%%%%
Syncing to nginx folder…
Done
*** Running /etc/rc.local…
*** Booting runit daemon…
*** Runit started as PID 315
Oct 31 19:21:06 kobocat cron[321]: (CRON) INFO (pidfile fd = 3)
Oct 31 19:21:06 kobocat cron[321]: (CRON) INFO (Running @reboot jobs)
Restoring ownership of Logs directory.
Running kobocat container with uWSGI application server.
[uWSGI] getting INI configuration from /srv/src/kobocat/docker/kobocat.ini

Kobocat is up&running.
What about kpi?
Have tried the url I gave you?

Yes i have tried the url. I get a 504 bad gateway on the browser.
Below is the output in kpi.access.log
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:20:00 +0000] “GET /servic e_health/ HTTP/1.1” 502 (182 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:20:10 +0000] “GET /servic e_health/ HTTP/1.1” 502 (182 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:20:20 +0000] “GET /servic e_health/ HTTP/1.1” 502 (182 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:20:30 +0000] “GET /servic e_health/ HTTP/1.1” 502 (182 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:20:40 +0000] “GET /servic e_health/ HTTP/1.1” 500 (388 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:20:50 +0000] “GET /servic e_health/ HTTP/1.1” 500 (392 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:21:00 +0000] “GET /servic e_health/ HTTP/1.1” 500 (391 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:21:20 +0000] “GET /servic e_health/ HTTP/1.1” 499 (0 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:21:41 +0000] “GET /servic e_health/ HTTP/1.1” 499 (0 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:22:01 +0000] “GET /servic e_health/ HTTP/1.1” 499 (0 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:22:21 +0000] “GET /servic e_health/ HTTP/1.1” 499 (0 bytes) “-” “-”
kf.mydomain.com | myipaddress - - [31/Oct/2019:19:22:41 +0000] “GET /servic e_health/ HTTP/1.1” 499 (0 bytes) “-” “-”

This is what is under kpi.error.log.
2019/10/31 19:20:00 [error] 84#84: *1 connect() failed (111: Connection refused) while connecting to upstream, client: myipaddress, server: kf.mydomain.com, request: “GET /service_health/ HTTP/1.1”, upstream: “uwsgi://172.25.0.4:8000”, host: “kf.mydomain.com
2019/10/31 19:20:10 [error] 84#84: *3 connect() failed (111: Connection refused) while connecting to upstream, client: myipaddress, server: kf.mydomain.com, request: “GET /service_health/ HTTP/1.1”, upstream: “uwsgi://172.25.0.4:8000”, host: “kf.mydomain.com
2019/10/31 19:20:20 [error] 84#84: *5 connect() failed (111: Connection refused) while connecting to upstream, client: myipaddress, server: kf.mydomain.com, request: “GET /service_health/ HTTP/1.1”, upstream: “uwsgi://172.25.0.4:8000”, host: “kf.mydomain.com
2019/10/31 19:20:30 [error] 84#84: *7 connect() failed (111: Connection refused) while connecting to upstream, client: myipaddress, server: kf.mydomain.com, request: “GET /service_health/ HTTP/1.1”, upstream: “uwsgi://172.25.0.4:8000”, host: “kf.mydomain.com

The contents of the kobocat error and access log is similar

Ok, that means nginx is accessible but it cannot communicate with kpi from some reason.
Look at docker logs

$kobo-install>python run.py --logs

Try to activate DEBUG mode.

  1. Modify config files
    In kobo-deployments/envfiles/kpi.txt, change
    KPI_DJANGO_DEBUG=False to KPI_DJANGO_DEBUG=True
    and in kobo-deployments/envfiles/kobocat.txt change
    KOBOCAT_DJANGO_DEBUG=False to KOBOCAT_DJANGO_DEBUG=True

  2. Restart containers with this command from kobo-docker directory.

$kobo-docker> docker-compose -f docker-compose.frontend.yml -f docker-compose.frontend.override.yml up -d --force-recreate nginx kpi kobocat
  1. Look at kpi docker logs
$kobo-docker>docker-compose -f docker-compose.frontend.yml -f docker-compose.frontend.override.yml logs -f kpi
  1. Wait until you see request to /service_health/

You should see the error that kpi returns. Please report here, it can help.

One more thing, if you have an active firewall, ensure that containers can talk to each other. Be sure to not open PostgreSQL, Mongo and Redis ports publicly.

1 Like

I was getting an erro 499 which I still don’t understand the reason for. I cleared out everything and reinstalled using http only, as https installation was not working. I have generated my own certificates and would like to know how I can configure the server to use https instead of http. I have placed my certificates in the nginx/secrets folder and restarted the nginx certbot container but https connection is still refusing

According to what you pasted. HTTPS was not activated with KoBoInstall .