LoRaServer (docker-compose) won't run on Win 10


#1

Following the instructions here, no joy.

https://www.loraserver.io/guides/docker-compose/

Using Docker Desktop 2.0.0.3.

I have a variety of issues depending upon which Win10 I make the attempt.

First question. Has ANYONE been successful executing LoRaServer with docker-compose on Win10?

Startup log attached.


LoRa Server on Windows Server - native or docker?
#2

Are you able to completely reset your Docker environment or at least make sure that all LoRa Server related containers and volumes are removed and then re-execute docker-compose up.

I’m interested to see your postgresql logs from a clean init. From your logs I see that the postgresql container is resumed. On first init, it should execute a couple of SQL commands to provision the database. Is seems that this doesn’t work properly under Windows.

Unfortunately, I’m unable to test this myself.

This is the log I see using Linux or MacOS:

postgresql_1     | The files belonging to this database system will be owned by user "postgres".
postgresql_1     | This user must also own the server process.
postgresql_1     |
postgresql_1     | The database cluster will be initialized with locale "en_US.utf8".
postgresql_1     | The default database encoding has accordingly been set to "UTF8".
postgresql_1     | The default text search configuration will be set to "english".
postgresql_1     |
postgresql_1     | Data page checksums are disabled.
postgresql_1     |
postgresql_1     | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgresql_1     | creating subdirectories ... ok
postgresql_1     | selecting default max_connections ... 100
postgresql_1     | selecting default shared_buffers ... 128MB
postgresql_1     | selecting dynamic shared memory implementation ... posix
postgresql_1     | creating configuration files ... ok
postgresql_1     | running bootstrap script ... ok
postgresql_1     | performing post-bootstrap initialization ... No usable system locales were found.
postgresql_1     | Use the option "--debug" to see details.
postgresql_1     | sh: locale: not found
postgresql_1     | ok
postgresql_1     | syncing data to disk ... ok
postgresql_1     |
postgresql_1     | Success. You can now start the database server using:
postgresql_1     |
postgresql_1     |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgresql_1     |
postgresql_1     |
postgresql_1     | WARNING: enabling "trust" authentication for local connections
postgresql_1     | You can change this by editing pg_hba.conf or using the option -A, or
postgresql_1     | --auth-local and --auth-host, the next time you run initdb.
postgresql_1     | ****************************************************
postgresql_1     | WARNING: No password has been set for the database.
postgresql_1     |          This will allow anyone with access to the
postgresql_1     |          Postgres port to access your database. In
postgresql_1     |          Docker's default configuration, this is
postgresql_1     |          effectively any other container on the same
postgresql_1     |          system.
postgresql_1     |
postgresql_1     |          Use "-e POSTGRES_PASSWORD=password" to set
postgresql_1     |          it in "docker run".
postgresql_1     | ****************************************************
postgresql_1     | waiting for server to start....LOG:  database system was shut down at 2019-02-15 15:26:27 UTC
postgresql_1     | LOG:  MultiXact member wraparound protections are now enabled
postgresql_1     | LOG:  database system is ready to accept connections
postgresql_1     | LOG:  autovacuum launcher started
postgresql_1     |  done
postgresql_1     | server started
postgresql_1     |
postgresql_1     | /usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/001-init-loraserver_ns.sh
postgresql_1     | CREATE ROLE
postgresql_1     | CREATE DATABASE
postgresql_1     |
postgresql_1     | /usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/002-init-loraserver_as.sh
postgresql_1     | CREATE ROLE
postgresql_1     | CREATE DATABASE
postgresql_1     |
postgresql_1     | /usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/003-loraserver_as_trgm.sh
postgresql_1     | CREATE EXTENSION
postgresql_1     |
postgresql_1     | waiting for server to shut down....LOG:  received fast shutdown request
postgresql_1     | LOG:  aborting any active transactions
postgresql_1     | LOG:  autovacuum launcher shutting down
postgresql_1     | LOG:  shutting down
postgresql_1     | LOG:  database system is shut down
postgresql_1     |  done
postgresql_1     | server stopped
postgresql_1     |
postgresql_1     | PostgreSQL init process complete; ready for start up.
postgresql_1     |
postgresql_1     | LOG:  database system was shut down at 2019-02-15 15:26:29 UTC
postgresql_1     | LOG:  MultiXact member wraparound protections are now enabled
postgresql_1     | LOG:  database system is ready to accept connections
postgresql_1     | LOG:  autovacuum launcher started

The /usr/local/bin/docker-entrypoint.sh logs lines is where the database is initialized with the loraserver_ns and loraserver_as roles (+ pg_trgm extension).

These are loaded from https://github.com/brocaar/loraserver-docker/tree/master/configuration/postgresql/initdb and mounted at https://github.com/brocaar/loraserver-docker/blob/master/docker-compose.yml#L31.

You could try:

# stop all services
docker-compose stop

# remove all containers
docker-compose rm -f

# list docker volumes, there should be an entry with 'postgresqldata` in the name
docker volume ls

# then remove this volume, e.g.
docker volume rm loraserver-docker_postgresqldata

# re-create the docker-compose environment
docker-compose up

#3

The problem is Windows versus Unix line termination in the three shell scripts in the folder \configuration\postgresql\initdb

These files were written into my working directory (git clone) with CR LF line termination. Changing these three files to LF line termination, it appears all the LoRaServer services startup properly when “docker-compose up” is issued. Startup logs look clean and I am able to access http://localhost:8080

I believe the folders containing the above files (and the .toml files) need a .gitattributes file which forces preservation of the LF line termination when these files are written to the working directory as a result of a git clone.


#5

The issue has been fixed by https://github.com/brocaar/loraserver-docker/pull/11 :slight_smile: