New OpenLMIS install not creating demo data and log in not working

Hello all,

I just installed OpenLMIS and i can reach the login page from the browser. I followed the instruction on the Github page of the openlmis-ref-distro.

When i try to login with administrator/password, I get this error: Unknown server error. Please contact your OpenLMIS administrator. Also, a pop up comes up that says Bad Gateway.

One strange thing is that when i start the application with docker-compose up, I always get this warning:
WARNING: The spring_profiles_active variable is not set. Defaulting to a blank string.

However, i have spring_profiles_active=demo-data,refresh-db in the settings.env file. I also tried to export it on the terminal using export spring_profiles_active=demo-data but i still get the warning.

I have Ubuntu 18.04, docker-compose 1.24.1, docker 18.09.7.

Please point me in the right direction of where I can see error logs or any other thing I can check to make this work.

Thanks.

Perhaps you have not waited long enough for all the containers to start and load the demo data? You can watch the CPU usage with docker stats to see if they’re still loading data. For me it takes at least 5 minutes to start up.

I also get the warning about spring_profiles_active if I set it in settings.env instead of as an environment variable, but it doesn’t seem to cause problems.

The logging section of the github page has more info on how to read the normal “syslog” logs and the nginx logs.

Thanks for your response, I have waited long enough - over a day. I have also found the nginx error logs (posted below). 108.123.123.232 is my cloud server ip where i installed OpenLMIS and 129.00.00.140 is my PC trying to connect to server and access OLMIS.

From the logs, one can see that API access is a challenge. Host unreachable and time out. Is there somewhere I should have configured this API?

In the quick setup guide, step 2 says: Update api access configs in https://github.com/OpenLMIS/openlmis-ref-distro/blob/master/reporting/.env but no such file in the ref-distro. The closest semblance is at reporting/.env inside distro folder. However, i don’t see any api access settings in it or am I missing them?

Kindly advise where the api access configs should be updated and what updates to be done.

Thanks

Hi @swedge218,

You can ignore this, it’s set in settings.env.

Looks good.

Apologies you can ignore this step if you’re not setting up the separate reporting stack. Our documentation for this step needs to be improved.

Would you mind posting your settings.env file? Usually these sorts of errors are caused by that file needing a minor tweak. Also in rare cases you might have another network setting that’s interfering, such as a particular route set or perhaps even a custom DNS rule. If you have any custom network settings it might be worth a look to see if they’re routing/blocking a request in a way that doesn’t work out of the box here.

Best,
Josh

Thanks for your response, below is my settings.env file.

### Nginx, Consul and other common settings ###

# The base url of the OpenLMIS distribution. Will be used in generated links pointing $
# as well as for communication between services.
BASE_URL=http://108.161.129.232

# The virtual host for the nginx server - nginx will make services available under thi$
VIRTUAL_HOST=108.161.129.232

######################################################################################$
# Profile:  use one of the desired deployment profiles below by uncommenting one (and $
######################################################################################$
## Production - doesn't wipe the database - WARNING unless this profile is active, you$
## every time the application starts
# spring_profiles_active=production
## Demo data - the default, loads a basic set of demo data on startup
## Refresh DB - refreshes some necessary DB tables as services start, outside of Hiber$
## (notably referencedata.right_assignments).
spring_profiles_active=demo-data,refresh-db
## Performance testing - optionally load more junk data on top of the demo data for pe$
# spring_profiles_active=demo-data,performance-data,refresh-db
######################################################################################


# Identifies the IP address or DNS name of the Consul server. Most deployments should $
# Otherwise, if needed, set this to the host or IP under which the distribution is ava$
# CONSUL_HOST=consul

# The port used by the Consul server - change this setting if you can't or don't want $
CONSUL_PORT=8500

# The tag used to mark openlmis services (those exposing public endpoints) and disting$
# (like postgres, or consul itself) in service discovery mechanism. Default: openlmis-$
SERVICE_TAG=openlmis-service


# Whether SSL is required for all communications with services. If true, all HTTP conn
REQUIRE_SSL=false

# System time zone ID
# This should either be UTC, or a location in the tz database $
# Examples: America/Los_Angeles, Europe/Warsaw, Africa/Maputo
TIME_ZONE_ID=UTC

# Default language
LOCALE=en

# Default currency settings
CURRENCY_CODE=USD
CURRENCY_SYMBOL=$
CURRENCY_SYMBOL_SIDE=left
CURRENCY_DECIMAL_PLACES=2
CURRENCY_LOCALE=US

# Default number settings
GROUPING_SEPARATOR=,
GROUPING_SIZE=3
DECIMAL_SEPARATOR=.

# Default datetime settings
# DATE_FORMAT AND DATE_TIME_FORMAT follow the AngularJS format for date filters (https$
# DATEPICKER_FORMAT follows Bootstrap's datepicker format (bootstrap-datepicke$
#
# Detailed explanation:
# Datepicker uses different syntax, i.e. "dd MM yyyy" as date format returns 06 09 201$
# because "MM" means month's name. In date format, "MMMM" means the name of month, so $
# but as datepicker format, it returns 06 SeptemberSeptember 2018.
# On the other hand, "dd/mm/yyyy" as date format returns minutes on the second place i$
DATE_FORMAT=dd/MM/yyyy
DATE_TIME_FORMAT=dd/MM/yyyy HH:mm:ss
DATEPICKER_FORMAT=dd/mm/yyyy

# Offline time out that represents the maximum latency before the UI considers the net$
# This will allow implementers to easily tune how the UI behaves in low connectivity e$
OFFLINE_CHECK_TIME_OUT=20000

# Sets the maximum allowed size of the client request body, specified in the “Content-$
CLIENT_MAX_BODY_SIZE=1m

# Defines a timeout for establishing a connection with a proxied server.
# PROXY_CONNECT_TIMEOUT=60s
# Sets a timeout for transmitting a request to the proxied server.
# PROXY_SEND_TIMEOUT=60s
# Defines a timeout for reading a response from the proxied server.
# PROXY_READ_TIMEOUT=60s
# Sets a timeout for transmitting a response to the client.
# SEND_TIMEOUT=60s
# This property set the same value for PROXY_CONNECT_TIMEOUT, PROXY_SEND_TIMEOUT, PROX$
NGINX_TIMEOUT=60s

# A list of origins that are allowed. Comment out to disable CORS.
# CORS_ALLOWED_ORIGINS=*
# A list of methods that are allowed for the above origins.
CORS_ALLOWED_METHODS=HEAD,GET,POST,PUT,DELETE,PATCH,OPTIONS

### PostgreSQL Database ###

# The url under which the database server used by services accepts connections.
DATABASE_URL=jdbc:postgresql://db:5432/open_lmis
# The database username that services will use.
POSTGRES_USER=postgres
# The database password that services will use.
POSTGRES_PASSWORD=p@ssw0rd

### Auth Service ###

# The period of inactivity in seconds after which authentication tokens from the auth $
TOKEN_DURATION=1800

### Notification Service ###

# The hostname or IP of the SMTP server - used for sending outgoing e-mail by the noti$
MAIL_HOST=localhost
# The SMTP port to use for sending outgoing e-mail by the notification service.
MAIL_PORT=25
# The SMTP username to use for sending outgoing e-mail by the notification service.
MAIL_USERNAME=noreply@openlmis.org
# The SMTP password to use for sending outgoing e-mail by the notification service.
MAIL_PASSWORD=
# The sender email address that will be used for sending all outgoing e-mail messages $
MAIL_ADDRESS=noreply@openlmis.org

# The API URL used for sending outgoing SMS messages by the notification service.
SMS_SEND_API_URL=textit.in/api/v2/broadcasts.json
# The API token used for sending outgoing SMS messages by the notification service.
SMS_SEND_API_TOKEN=your-api-token

### Requisition Service ###

# URI for viewing a requisition on UI, used in emails
REQUISITION_URI=/#!/requisition/{0}/fullSupply

### Fulfillment Service ###

# Whether the CSV file created by Export Order operation should include products which$
ORDER_EXPORT_INCLUDE_ZERO_QUANTITY=false

### FTP Server ###

# The FTP username for the FTP container we start with the ref distribution.
# This is a test FTP server that can be used by the fulfillment service.
FTP_USERNAME=admin
# The FTP password for the FTP container we start with the ref distribution.
# This is a test FTP server that can be used by the fulfillment service.
FTP_PASSWORD=p@ssw0rd

### Service building commons ###

# Push local translations to transifex repository upon service build
TRANSIFEX_PUSH=false
# Pull translations from transifex repository upon service build
TRANSIFEX_PULL=true

# The ID of the reason in Stock Management that should be used to create consumption i$
CONSUMED_REASON_ID=b5c27da7-bdda-4790-925a-9484c5dfb594

# The ID of the reason in Stock Management that should be used to create reeceipts inv$
RECEIPTS_REASON_ID=313f2f5f-0c22-4626-8c49-3554ef763de3


# The ID of the reason in Stock Management that should be used for unpacking a kit.
KIT_UNPACK_REASON_ID=9b4b653a-f319-4a1b-bb80-8d6b4dd6cc12

# The ID of the reason in Stock Management that should be used to increment stock of c$
UNPACKED_FROM_KIT_REASON_ID=0676fdea-9ba8-4e6d-ae26-bb14f0dcfecd

# Schedule database table clustering, based on a cron expression.
DB_CLUSTERING_ENABLED=true
DB_CLUSTERING_CRON_EXP=0 0 0 * * ?

### Scalyr Service ###

# The Scalyr log write API key to use
SCALYR_API_KEY=replaceme

# Schedule stock management to check for lots that are near expiry
LOT_NEAR_EXPIRY_CRON=0 0 0 * * ?

I also see below error message on the docker logs all the time. Sometimes the IP adress changes.

consul_1 | 2019/08/08 11:02:39 [WARN] agent: http request failed 'http://192.168.0.12:8080/health': Get http://192.168.0.12:8080/health: dial tcp 192.168.0.12:8080: getsockopt: connection refused

Hmm @swedge218,

This error indicates that Consul, running in it’s container, can’t reach one of the other containers - the ip address is that of Docker’s internal network.

Your settings.env file looks okay - that means we’ll need to do some debugging.

The first thing I’d try is to just clear the application, it’s data, and try again:

docker-compose down -v
docker-compose up --build -d

Wait 5-10 minutes and then lets see if it appears to be running:

docker ps -a
docker stats --no-stream

If it’s not working go ahead and post the output to those last two commands.

If things are still wrong, run these commands and let us know the output (from where the ref-distro files are):

docker network inspect openlmis-ref-distro_default
docker-compose logs auth

I think/hope that restarting the containers this time will help solve it. Otherwise my next guesses are that there is a networking configuration issue in the cloud instance or perhaps the instance doesn’t have enough available resources (does it have 8GB or RAM?).

Let us know and we’ll try to help.

Best,
Josh

Thanks Josh and Philip, so I increased the RAM to 8GB and now I can log in. I hope to be able to continue more smoothly from here.