Could not connect to any BMA endpoint: status code != 200 => 502 Bad Gateway

After weeks of struggling with home network bugs, I’m finally back at being able to test Sakia again
and encounter an error that might not be due to my home network.

Here’s my root_server.yml file:

Guilder-Test:
  display: European Basic Guilder Test 
  nodes:
    AbE4R2fg4hmf6FPYuSuxx9MC9abnSMaPPenoYp8kHsf6:
    - "BMAS guilder-test.eu.org 443"

This is the result of testing:

[me@MyComupter sakia]$ sakia --currency=Guilder-Test --debug
[2276] PyInstaller Bootloader 3.x
[2276] LOADER: executable is /opt/sakia/sakia.bin
[2276] LOADER: homepath is /opt/sakia
[2276] LOADER: _MEIPASS2 is NULL
[2276] LOADER: archivename is /opt/sakia/sakia.bin
[2276] LOADER: Extracting binaries
[2276] LOADER: Executing self as child
[2276] LOADER: set _MEIPASS2 to /opt/sakia
[2276] LOADER: LD_LIBRARY_PATH=/opt/sakia
[2277] PyInstaller Bootloader 3.x
[2277] LOADER: executable is /opt/sakia/sakia.bin
[2277] LOADER: homepath is /opt/sakia
[2277] LOADER: _MEIPASS2 is /opt/sakia
[2277] LOADER: archivename is /opt/sakia/sakia.bin
[2277] LOADER: Already in the child - running user's code.
[2277] LOADER: Python library: /opt/sakia/libpython3.5m.so.1.0
[2277] LOADER: Loaded functions from Python library.
[2277] LOADER: Manipulating environment (sys.path, sys.prefix)
[2277] LOADER: Pre-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[2277] LOADER: sys.prefix is /opt/sakia
[2277] LOADER: Setting runtime options
[2277] LOADER: Initializing python
[2277] LOADER: Overriding Python's sys.path
[2277] LOADER: Post-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[2277] LOADER: Setting sys.argv
[2277] LOADER: setting sys._MEIPASS
[2277] LOADER: importing modules from CArchive
[2277] LOADER: extracted struct
[2277] LOADER: callfunction returned...
[2277] LOADER: extracted pyimod01_os_path
[2277] LOADER: callfunction returned...
[2277] LOADER: extracted pyimod02_archive
[2277] LOADER: callfunction returned...
[2277] LOADER: extracted pyimod03_importers
[2277] LOADER: callfunction returned...
[2277] LOADER: Installing PYZ archive with Python modules.
[2277] LOADER: PYZ archive: out00-PYZ.pyz
[2277] LOADER: Running pyiboot01_bootstrap.py
[2277] LOADER: Running pyi_rth_qt5.py
[2277] LOADER: Running pyi_rth_multiprocessing.py
[2277] LOADER: Running pyi_rth_pkgres.py
[2277] LOADER: Running main.py
DEBUG:meta:prepare:Initializing meta database
DEBUG:meta:upgrade_database:Begin upgrade of database...
DEBUG:meta:upgrade_database:Upgrading to version 0...
DEBUG:meta:create_all_tables:Initialiazing all databases
DEBUG:meta:upgrade_database:Upgrading to version 1...
DEBUG:meta:add_ud_rythm_parameters:Add ud rythm parameters to blockchains table
DEBUG:meta:upgrade_database:Upgrading to version 2...
DEBUG:meta:add_contacts:Add contacts table
DEBUG:meta:upgrade_database:Upgrading to version 3...
DEBUG:meta:add_sentry_property:Add sentry property
DEBUG:meta:upgrade_database:Upgrading to version 4...
DEBUG:meta:add_last_state_change_property:Add last state change property
DEBUG:meta:upgrade_database:Upgrading to version 5...
DEBUG:meta:refactor_transactions:Refactor transactions
DEBUG:meta:upgrade_database:Upgrading to version 6...
DEBUG:meta:drop_incorrect_nodes:Drop incorrect nodes
DEBUG:meta:upgrade_database:Upgrading to version 7...
DEBUG:meta:insert_last_mass_attribute:Insert last_mass attribute
DEBUG:meta:upgrade_database:End upgrade of database...
DEBUG:network:add_connector:AbE4R connected
DEBUG:node:connect_current_block:[AbE4R] Websocket block WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:connect_peers:[AbE4R] Websocket peer WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:change_state_and_emit:[AbE4R] Changing state 1 > 2
DEBUG:node:request_current_block:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:connect_peers:[AbE4R] Websocket peer WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:connect_current_block:[AbE4R] Websocket block WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_current_block:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:blockchain:initialize_blockchain:Requesting blockchain parameters
DEBUG:network:stop_coroutines:Start closing
DEBUG:network:stop_coroutines:Closing 1 websockets
DEBUG:network:stop_coroutines:Closed
ERROR:quamash._QEventLoop:Task was destroyed but it is pending!
task: <Task pending coro=<NetworkService.discovery_loop() running at sakia/services/network.py:178> wait_for=<Future pending cb=[Task._wakeup()]>>
[2276] LOADER: Back to parent (RC: 0)
[2276] LOADER: Doing cleanup
[2276] LOADER: Freeing archive status for /opt/sakia/sakia.bin
[me@MyComputer sakia]$ 

So I’m getting 502 Bad Gateway errors, yet when accessing the site, I don’t get Bad Gateway errors.

Does anyone from the dev team have any ideas what could be the cause?

Your BMA endpoint is probably not configured correctly. Check your peering entry on /network/peering URI.

Network peering? What’s that?

This is my duniter configuration:

folatt@Xroklaus:~/.config/duniter/duniter_default $ cat conf.json 
{
 "currency": "Guilder-Test",
 "endpoints": [
  "BMAS guilder-test.eu.org 443"
 ],
 "rmEndpoints": [],
 "upInterval": 3600000,
 "c": "0.000054218",
 "dt": "86400",
 "dtReeval": 2629800,
 "ud0": "100",
 "stepMax": 3,
 "sigPeriod": "0",
 "sigValidity": 31536000,
 "msValidity": 31536000,
 "sigQty": "3",
 "xpercent": 1,
 "percentRot": 0.6666666666666666,
 "powDelay": "1200",
 "avgGenTime": 960,
 "dtDiffEval": 10,
 "medianTimeBlocks": 20,
 "httplogs": false,
 "udid2": false,
 "timeout": 3000,
 "isolate": false,
 "forksize": 100,
 "switchOnHeadAdvance": 3,
 "sync": {},
 "port": 10901,
 "msPeriod": 604800,
 "loglevel": "info",
 "cpu": 0.6,
 "ipv4": "192.168.178.30",
 "remotehost": "guilder-test.eu.org",
 "remoteport": "443",
 "upnp": false,
 "dos": {
  "whitelist": [
   "127.0.0.1"
  ],
  "maxcount": 50,
  "burst": 20,
  "limit": 40,
  "maxexpiry": 10,
  "checkinterval": 1,
  "trustProxy": true,
  "includeUserAgent": true,
  "errormessage": "Error",
  "testmode": false,
  "silent": false,
  "silentStart": false,
  "responseStatus": 429
 },
 "sigStock": "300000",
 "sigWindow": 604800,
 "idtyWindow": 604800,
 "msWindow": 604800,
 "rootoffset": 0,
 "remoteipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "ipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "remoteipv4": "None"

There’s nothing on /network/peering

You should have something like this if your node was working properly https://g1.duniter.inso.ovh/network/peering/

Actually I think that it is not initialized at all. That’s probably why there is nothing answering to BMA requests.

And where/how would this be initiliazed?

Try :

duniter wizard network

to configure BMA endpoint. Try without SSL first.

There is a french documentation here :

Will Sakia use WS2P soon as well?
Should I use WS2P now or still stick with BMA/BMAS?

Current setup:

conf.json

folatt@Gildurklaus:~ $ cat .config/duniter/duniter_default/conf.json 
{
 "currency": "Guilder-Test",
 "endpoints": [
  "BASIC_MERKLED_API guilder-test.eu.org 10901"
 ],
 "rmEndpoints": [],
 "upInterval": 3600000,
 "c": "0.000054218",
 "dt": "86400",
 "dtReeval": 2629800,
 "ud0": "100",
 "stepMax": 3,
 "sigPeriod": "0",
 "sigValidity": 31536000,
 "msValidity": 31536000,
 "sigQty": "3",
 "xpercent": 1,
 "percentRot": 0.6666666666666666,
 "powDelay": "1200",
 "avgGenTime": 960,
 "dtDiffEval": 10,
 "medianTimeBlocks": 20,
 "httplogs": false,
 "udid2": false,
 "timeout": 3000,
 "isolate": false,
 "forksize": 100,
 "switchOnHeadAdvance": 3,
 "sync": {},
 "port": 10901,
 "msPeriod": 604800,
 "loglevel": "info",
 "cpu": 0.6,
 "ipv4": "192.168.178.30",
 "remotehost": "guilder-test.eu.org",
 "remoteport": "10901",
 "upnp": false,
 "dos": {
  "whitelist": [
   "127.0.0.1"
  ],
  "maxcount": 50,
  "burst": 20,
  "limit": 40,
  "maxexpiry": 10,
  "checkinterval": 1,
  "trustProxy": true,
  "includeUserAgent": true,
  "errormessage": "Error",
  "testmode": false,
  "silent": false,
  "silentStart": false,
  "responseStatus": 429
 },
 "sigStock": "300000",
 "sigWindow": 604800,
 "idtyWindow": 604800,
 "msWindow": 604800,
 "rootoffset": 0,
 "remoteipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "ipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "remoteipv4": "None"
}

result:

[me@MyComputer sakia]$ sakia --currency=Guilder-Test --debug
[28091] PyInstaller Bootloader 3.x
[28091] LOADER: executable is /opt/sakia/sakia.bin
[28091] LOADER: homepath is /opt/sakia
[28091] LOADER: _MEIPASS2 is NULL
[28091] LOADER: archivename is /opt/sakia/sakia.bin
[28091] LOADER: Extracting binaries
[28091] LOADER: Executing self as child
[28091] LOADER: set _MEIPASS2 to /opt/sakia
[28091] LOADER: LD_LIBRARY_PATH=/opt/sakia
[28092] PyInstaller Bootloader 3.x
[28092] LOADER: executable is /opt/sakia/sakia.bin
[28092] LOADER: homepath is /opt/sakia
[28092] LOADER: _MEIPASS2 is /opt/sakia
[28092] LOADER: archivename is /opt/sakia/sakia.bin
[28092] LOADER: Already in the child - running user's code.
[28092] LOADER: Python library: /opt/sakia/libpython3.5m.so.1.0
[28092] LOADER: Loaded functions from Python library.
[28092] LOADER: Manipulating environment (sys.path, sys.prefix)
[28092] LOADER: Pre-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[28092] LOADER: sys.prefix is /opt/sakia
[28092] LOADER: Setting runtime options
[28092] LOADER: Initializing python
[28092] LOADER: Overriding Python's sys.path
[28092] LOADER: Post-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[28092] LOADER: Setting sys.argv
[28092] LOADER: setting sys._MEIPASS
[28092] LOADER: importing modules from CArchive
[28092] LOADER: extracted struct
[28092] LOADER: callfunction returned...
[28092] LOADER: extracted pyimod01_os_path
[28092] LOADER: callfunction returned...
[28092] LOADER: extracted pyimod02_archive
[28092] LOADER: callfunction returned...
[28092] LOADER: extracted pyimod03_importers
[28092] LOADER: callfunction returned...
[28092] LOADER: Installing PYZ archive with Python modules.
[28092] LOADER: PYZ archive: out00-PYZ.pyz
[28092] LOADER: Running pyiboot01_bootstrap.py
[28092] LOADER: Running pyi_rth_qt5.py
[28092] LOADER: Running pyi_rth_multiprocessing.py
[28092] LOADER: Running pyi_rth_pkgres.py
[28092] LOADER: Running main.py
DEBUG:meta:prepare:Initializing meta database
DEBUG:meta:upgrade_database:Begin upgrade of database...
DEBUG:meta:upgrade_database:End upgrade of database...
DEBUG:network:add_connector:AbE4R connected
DEBUG:node:connect_current_block:[AbE4R] Cannot connect to host guilder-test.eu.org:10901 ssl:False [Connect call failed ('2001:983:8610:1:2239:6fcb:6144:21d2', 10901)] : AbE4R
DEBUG:node:change_state_and_emit:[AbE4R] Changing state 1 > 2
DEBUG:node:connect_peers:[AbE4R] Cannot connect to host guilder-test.eu.org:10901 ssl:False [Connect call failed ('2001:983:8610:1:2239:6fcb:6144:21d2', 10901)]
DEBUG:node:connect_current_block:[AbE4R] Cannot connect to host guilder-test.eu.org:10901 ssl:False [Connect call failed ('2001:983:8610:1:2239:6fcb:6144:21d2', 10901)] : AbE4R
DEBUG:node:safe_request:[AbE4R] Cannot connect to host guilder-test.eu.org:10901 ssl:False [Connect call failed ('2001:983:8610:1:2239:6fcb:6144:21d2', 10901)]
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:connect_peers:[AbE4R] Cannot connect to host guilder-test.eu.org:10901 ssl:False [Connect call failed ('2001:983:8610:1:2239:6fcb:6144:21d2', 10901)]
DEBUG:blockchain:initialize_blockchain:Requesting blockchain parameters
DEBUG:network:stop_coroutines:Start closing
DEBUG:network:stop_coroutines:Closing 1 websockets
DEBUG:network:stop_coroutines:Closed
ERROR:quamash._QEventLoop:Task was destroyed but it is pending!
task: <Task pending coro=<NetworkService.discovery_loop() running at sakia/services/network.py:178> wait_for=<Future pending cb=[Task._wakeup()]>>
[28091] LOADER: Back to parent (RC: 0)
[28091] LOADER: Doing cleanup
[28091] LOADER: Freeing archive status for /opt/sakia/sakia.bin

It looks like sakia fails to connect to your node, like if nothing listens on port 10901.

1 J'aime

Trying port 80 instead still fails.

[me@MyComputer sakia]$ sakia --currency=Guilder-Test --debug
[7118] PyInstaller Bootloader 3.x
[7118] LOADER: executable is /opt/sakia/sakia.bin
[7118] LOADER: homepath is /opt/sakia
[7118] LOADER: _MEIPASS2 is NULL
[7118] LOADER: archivename is /opt/sakia/sakia.bin
[7118] LOADER: Extracting binaries
[7118] LOADER: Executing self as child
[7118] LOADER: set _MEIPASS2 to /opt/sakia
[7118] LOADER: LD_LIBRARY_PATH=/opt/sakia
[7119] PyInstaller Bootloader 3.x
[7119] LOADER: executable is /opt/sakia/sakia.bin
[7119] LOADER: homepath is /opt/sakia
[7119] LOADER: _MEIPASS2 is /opt/sakia
[7119] LOADER: archivename is /opt/sakia/sakia.bin
[7119] LOADER: Already in the child - running user's code.
[7119] LOADER: Python library: /opt/sakia/libpython3.5m.so.1.0
[7119] LOADER: Loaded functions from Python library.
[7119] LOADER: Manipulating environment (sys.path, sys.prefix)
[7119] LOADER: Pre-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[7119] LOADER: sys.prefix is /opt/sakia
[7119] LOADER: Setting runtime options
[7119] LOADER: Initializing python
[7119] LOADER: Overriding Python's sys.path
[7119] LOADER: Post-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[7119] LOADER: Setting sys.argv
[7119] LOADER: setting sys._MEIPASS
[7119] LOADER: importing modules from CArchive
[7119] LOADER: extracted struct
[7119] LOADER: callfunction returned...
[7119] LOADER: extracted pyimod01_os_path
[7119] LOADER: callfunction returned...
[7119] LOADER: extracted pyimod02_archive
[7119] LOADER: callfunction returned...
[7119] LOADER: extracted pyimod03_importers
[7119] LOADER: callfunction returned...
[7119] LOADER: Installing PYZ archive with Python modules.
[7119] LOADER: PYZ archive: out00-PYZ.pyz
[7119] LOADER: Running pyiboot01_bootstrap.py
[7119] LOADER: Running pyi_rth_qt5.py
[7119] LOADER: Running pyi_rth_multiprocessing.py
[7119] LOADER: Running pyi_rth_pkgres.py
[7119] LOADER: Running main.py
DEBUG:meta:prepare:Initializing meta database
DEBUG:meta:upgrade_database:Begin upgrade of database...
DEBUG:meta:upgrade_database:End upgrade of database...
DEBUG:network:add_connector:AbE4R connected
DEBUG:node:connect_current_block:[AbE4R] Websocket block WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:connect_peers:[AbE4R] Websocket peer WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_current_block:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:connect_current_block:[AbE4R] Websocket block WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_current_block:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:connect_peers:[AbE4R] Websocket peer WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:blockchain:initialize_blockchain:Requesting blockchain parameters
DEBUG:network:stop_coroutines:Start closing
DEBUG:network:stop_coroutines:Closing 1 websockets
DEBUG:network:stop_coroutines:Closed
ERROR:quamash._QEventLoop:Task was destroyed but it is pending!
task: <Task pending coro=<NetworkService.discovery_loop() running at sakia/services/network.py:178> wait_for=<Future pending cb=[Task._wakeup()]>>
[7118] LOADER: Back to parent (RC: 0)
[7118] LOADER: Doing cleanup
[7118] LOADER: Freeing archive status for /opt/sakia/sakia.bin

Sakia settings

[me@MyComputer sakia]$ cat /opt/sakia/sakia/root_servers.yml 
Guilder-Test:
  display: European Basic Guilder Test 
  nodes:
    AbE4R2fg4hmf6FPYuSuxx9MC9abnSMaPPenoYp8kHsf6:
    - "BASIC_MERKLED_API guilder-test.eu.org 80"

Daemon

folatt@Gildurklaus:~ $ systemctl --user status duniter.service
● duniter.service - Duniter node
   Loaded: loaded (/usr/lib/systemd/user/duniter.service; enabled)
   Active: active (running) since Tue 2018-01-16 07:09:29 UTC; 6min ago
  Process: 1835 ExecStart=/usr/bin/duniter webstart (code=exited, status=0/SUCCESS)
 Main PID: 1887 (duniter_default)
   CGroup: /user.slice/user-9514.slice/user@9514.service/duniter.service
           └─1887 duniter_default

Duniter settings


folatt@Gildurklaus:~ $ cat ~/.config/duniter/duniter_default/conf.json 
{
 "currency": "Guilder-Test",
 "endpoints": [
  "BASIC_MERKLED_API guilder-test.eu.org 80"
 ],
 "rmEndpoints": [],
 "upInterval": 3600000,
 "c": "0.000054218",
 "dt": "86400",
 "dtReeval": 2629800,
 "ud0": "100",
 "stepMax": 3,
 "sigPeriod": "0",
 "sigValidity": 31536000,
 "msValidity": 31536000,
 "sigQty": "3",
 "xpercent": 1,
 "percentRot": 0.6666666666666666,
 "powDelay": "1200",
 "avgGenTime": 960,
 "dtDiffEval": 10,
 "medianTimeBlocks": 20,
 "httplogs": false,
 "udid2": false,
 "timeout": 3000,
 "isolate": false,
 "forksize": 100,
 "switchOnHeadAdvance": 3,
 "sync": {},
 "port": 80,
 "msPeriod": 604800,
 "loglevel": "info",
 "cpu": 0.6,
 "ipv4": "192.168.178.30",
 "remotehost": "guilder-test.eu.org",
 "remoteport": "80",
 "upnp": false,
 "dos": {
  "whitelist": [
   "127.0.0.1"
  ],
  "maxcount": 50,
  "burst": 20,
  "limit": 40,
  "maxexpiry": 10,
  "checkinterval": 1,
  "trustProxy": true,
  "includeUserAgent": true,
  "errormessage": "Error",
  "testmode": false,
  "silent": false,
  "silentStart": false,
  "responseStatus": 429
 },
 "sigStock": "300000",
 "sigWindow": 604800,
 "idtyWindow": 604800,
 "msWindow": 604800,
 "rootoffset": 0,
 "remoteipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "ipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "remoteipv4": "None"
}

Yunohost firewall settings

admin@Gildurklaus:~ $ sudo yunohost firewall list -r
ipv4: 
  TCP: 
    - 22
    - 25
    - 53
    - 80
    - 443
    - 465
    - 993
    - 5222
    - 5269
    - 10901
  UDP: 53
ipv6: 
  TCP: 
    - 22
    - 25
    - 53
    - 80
    - 443
    - 465
    - 993
    - 5222
    - 5269
    - 10901
  UDP: 53
uPnP: 
  TCP: 
    - 22
    - 25
    - 53
    - 80
    - 443
    - 465
    - 993
    - 5222
    - 5269
    - 10901
  UDP: 53
  enabled: False

Modem port sharing settings

502 bad Gateway means Nginx cannot connect to Duniter.

Looking at the configuration, you configured the same “port” as “remotePort”. Port is supposed to be the one of duniter, and “remotePort” is supposed to be the one of nginx.

Meaning “port” should be 10901 by default while remoteport should be 80/443 by default?

Check the file /etc/nginx/conf.d/[duniter dns].d/duniter.conf . The port nginx is looking at is written in this file. For example, on my yunohost instance its :

       proxy_pass             http://localhost:10900;

Changing ports had no effect.

[me@MyComputer sakia]$ sakia --currency=Guilder-Test --debug
[7667] PyInstaller Bootloader 3.x
[7667] LOADER: executable is /opt/sakia/sakia.bin
[7667] LOADER: homepath is /opt/sakia
[7667] LOADER: _MEIPASS2 is NULL
[7667] LOADER: archivename is /opt/sakia/sakia.bin
[7667] LOADER: Extracting binaries
[7667] LOADER: Executing self as child
[7667] LOADER: set _MEIPASS2 to /opt/sakia
[7667] LOADER: LD_LIBRARY_PATH=/opt/sakia
[7668] PyInstaller Bootloader 3.x
[7668] LOADER: executable is /opt/sakia/sakia.bin
[7668] LOADER: homepath is /opt/sakia
[7668] LOADER: _MEIPASS2 is /opt/sakia
[7668] LOADER: archivename is /opt/sakia/sakia.bin
[7668] LOADER: Already in the child - running user's code.
[7668] LOADER: Python library: /opt/sakia/libpython3.5m.so.1.0
[7668] LOADER: Loaded functions from Python library.
[7668] LOADER: Manipulating environment (sys.path, sys.prefix)
[7668] LOADER: Pre-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[7668] LOADER: sys.prefix is /opt/sakia
[7668] LOADER: Setting runtime options
[7668] LOADER: Initializing python
[7668] LOADER: Overriding Python's sys.path
[7668] LOADER: Post-init sys.path is /opt/sakia/base_library.zip:/opt/sakia
[7668] LOADER: Setting sys.argv
[7668] LOADER: setting sys._MEIPASS
[7668] LOADER: importing modules from CArchive
[7668] LOADER: extracted struct
[7668] LOADER: callfunction returned...
[7668] LOADER: extracted pyimod01_os_path
[7668] LOADER: callfunction returned...
[7668] LOADER: extracted pyimod02_archive
[7668] LOADER: callfunction returned...
[7668] LOADER: extracted pyimod03_importers
[7668] LOADER: callfunction returned...
[7668] LOADER: Installing PYZ archive with Python modules.
[7668] LOADER: PYZ archive: out00-PYZ.pyz
[7668] LOADER: Running pyiboot01_bootstrap.py
[7668] LOADER: Running pyi_rth_qt5.py
[7668] LOADER: Running pyi_rth_multiprocessing.py
[7668] LOADER: Running pyi_rth_pkgres.py
[7668] LOADER: Running main.py
DEBUG:meta:prepare:Initializing meta database
DEBUG:meta:upgrade_database:Begin upgrade of database...
DEBUG:meta:upgrade_database:End upgrade of database...
DEBUG:network:add_connector:AbE4R connected
DEBUG:node:connect_current_block:[AbE4R] Websocket block WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:connect_peers:[AbE4R] Websocket peer WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_current_block:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:connect_current_block:[AbE4R] Websocket block WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:connect_peers:[AbE4R] Websocket peer WSServerHandshakeError : 502, message='Invalid response status'
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_current_block:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:node:safe_request:[AbE4R] status code != 200 => 502 (<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
DEBUG:node:request_peers:[AbE4R] Could not connect to any BMA endpoint
DEBUG:blockchain:initialize_blockchain:Requesting blockchain parameters
DEBUG:network:stop_coroutines:Start closing
DEBUG:network:stop_coroutines:Closing 1 websockets
DEBUG:network:stop_coroutines:Closed
ERROR:quamash._QEventLoop:Task was destroyed but it is pending!
task: <Task pending coro=<NetworkService.discovery_loop() running at sakia/services/network.py:178> wait_for=<Future pending cb=[Task._wakeup()]>>
[7667] LOADER: Back to parent (RC: 0)
[7667] LOADER: Doing cleanup
[7667] LOADER: Freeing archive status for /opt/sakia/sakia.bin
folatt@Gildurklaus:~ $ cat ~/.config/duniter/duniter_default/conf.json 
{
 "currency": "Guilder-Test",
 "endpoints": [
  "BASIC_MERKLED_API guilder-test.eu.org 80"
 ],
 "rmEndpoints": [],
 "upInterval": 3600000,
 "c": "0.000054218",
 "dt": "86400",
 "dtReeval": 2629800,
 "ud0": "100",
 "stepMax": 3,
 "sigPeriod": "0",
 "sigValidity": 31536000,
 "msValidity": 31536000,
 "sigQty": "3",
 "xpercent": 1,
 "percentRot": 0.6666666666666666,
 "powDelay": "1200",
 "avgGenTime": 960,
 "dtDiffEval": 10,
 "medianTimeBlocks": 20,
 "httplogs": false,
 "udid2": false,
 "timeout": 3000,
 "isolate": false,
 "forksize": 100,
 "switchOnHeadAdvance": 3,
 "sync": {},
 "port": 10901,
 "msPeriod": 604800,
 "loglevel": "info",
 "cpu": 0.6,
 "ipv4": "192.168.178.30",
 "remotehost": "guilder-test.eu.org",
 "remoteport": "80",
 "upnp": false,
 "dos": {
  "whitelist": [
   "127.0.0.1"
  ],
  "maxcount": 50,
  "burst": 20,
  "limit": 40,
  "maxexpiry": 10,
  "checkinterval": 1,
  "trustProxy": true,
  "includeUserAgent": true,
  "errormessage": "Error",
  "testmode": false,
  "silent": false,
  "silentStart": false,
  "responseStatus": 429
 },
 "sigStock": "300000",
 "sigWindow": 604800,
 "idtyWindow": 604800,
 "msWindow": 604800,
 "rootoffset": 0,
 "remoteipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "ipv6": "2001:983:8610:1:2239:6fcb:6144:21d2",
 "remoteipv4": "None"
}
folatt@Gildurklaus:~ $ cat /etc/nginx/conf.d/guilder-test.eu.org.d/duniter.conf 
location / {
       proxy_set_header        X-Real-IP       $remote_addr;
       proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header        Host            $http_host;
       proxy_set_header        X-NginX-Proxy  true;

       proxy_pass             http://localhost:10901;
       proxy_redirect          off;

       # Socket.io support
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_read_timeout 86400s; 
       proxy_send_timeout 86400s;

	location ~ \.(js|css|woff|woff2|ttf|png) {
		proxy_pass http://localhost:9220;
		access_by_lua_file /usr/share/ssowat/access.lua;
	}
	
	location /cesium {
		proxy_pass http://localhost:9220;
		access_by_lua_file /usr/share/ssowat/access.lua;
		# Include SSOWAT user panel.
		include conf.d/yunohost_panel.conf.inc;
	}

	location /webui {
		proxy_pass http://localhost:9220/;
		access_by_lua_file /usr/share/ssowat/access.lua;
		# Include SSOWAT user panel.
		include conf.d/yunohost_panel.conf.inc;
	}

	location ~ /webmin {
		proxy_pass http://localhost:9220$uri;
		access_by_lua_file /usr/share/ssowat/access.lua;
	}
	
	location ~ /modules {
		proxy_pass http://localhost:9220;
		access_by_lua_file /usr/share/ssowat/access.lua;
	}

}

Is Duniter listening on port 10901 ?

netstat -tulpn

No, despite running.

folatt@Gildurklaus:~ $ netstat -tulpn
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:5290          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:5582          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:61209         0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:6787          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:389             0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:11333           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:5222            0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::3306                 :::*                    LISTEN      -               
tcp6       0      0 ::1:5290                :::*                    LISTEN      -               
tcp6       0      0 :::587                  :::*                    LISTEN      -               
tcp6       0      0 ::1:5582                :::*                    LISTEN      -               
tcp6       0      0 :::143                  :::*                    LISTEN      -               
tcp6       0      0 :::80                   :::*                    LISTEN      -               
tcp6       0      0 :::465                  :::*                    LISTEN      -               
tcp6       0      0 :::5269                 :::*                    LISTEN      -               
tcp6       0      0 :::53                   :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 :::25                   :::*                    LISTEN      -               
tcp6       0      0 :::443                  :::*                    LISTEN      -               
tcp6       0      0 :::4190                 :::*                    LISTEN      -               
tcp6       0      0 :::993                  :::*                    LISTEN      -               
tcp6       0      0 ::1:9220                :::*                    LISTEN      1868/duniter_defaul
tcp6       0      0 :::389                  :::*                    LISTEN      -               
tcp6       0      0 :::11333                :::*                    LISTEN      -               
tcp6       0      0 :::5222                 :::*                    LISTEN      -               
tcp6       0      0 ::1:11334               :::*                    LISTEN      -               
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -               
udp        0      0 0.0.0.0:43434           0.0.0.0:*                           -               
udp        0      0 0.0.0.0:53              0.0.0.0:*                           -               
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -               
udp        0      0 192.168.178.30:123      0.0.0.0:*                           -               
udp        0      0 127.0.0.1:123           0.0.0.0:*                           -               
udp        0      0 0.0.0.0:123             0.0.0.0:*                           -               
udp6       0      0 :::5353                 :::*                                -               
udp6       0      0 :::42815                :::*                                -               
udp6       0      0 :::546                  :::*                                -               
udp6       0      0 :::53                   :::*                                -               
udp6       0      0 ::1:123                 :::*                                -               
udp6       0      0 2001:983:8610:1:223:123 :::*                                -               
udp6       0      0 fe80::7664:c1e:6989:123 :::*                                -               
udp6       0      0 :::123                  :::*                                -               
folatt@Gildurklaus:~ $ systemctl --user status duniter.service
● duniter.service - Duniter node
   Loaded: loaded (/usr/lib/systemd/user/duniter.service; enabled)
   Active: active (running) since Tue 2018-01-16 07:34:25 UTC; 5min ago
  Process: 1856 ExecStart=/usr/bin/duniter webstart (code=exited, status=0/SUCCESS)
 Main PID: 1868 (duniter_default)
   CGroup: /user.slice/user-9514.slice/user@9514.service/duniter.service
           └─1868 duniter_default

And what does duniter logs shows ?

admin@Gildurklaus:/home/folatt/.config/duniter/duniter_default $ cat duniter.log
2017-11-15T09:21:13+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-11-15T09:21:13+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-11-15T09:21:20+00:00 - info: Database closed.
2017-11-15T09:22:13+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-11-15T09:22:13+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-11-15T09:22:51+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-11-15T09:22:52+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-11-15T14:59:40+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-11-15T14:59:40+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-11-16T18:28:16+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-11-16T18:28:16+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-12-09T12:48:22+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-12-09T12:48:22+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-12-09T12:50:43+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-12-09T12:50:43+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-12-09T13:04:41+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-12-09T13:04:42+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-12-11T22:58:57+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-12-11T22:58:57+00:00 - info: Web administration accessible at following address: http://localhost:9220
2017-12-12T06:12:54+00:00 - info: Block resolution: 0 potential blocks for root block...
2017-12-12T06:12:54+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-06T16:03:10+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-06T16:03:10+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-08T16:53:19+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-08T16:53:19+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-10T13:38:16+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-10T13:38:16+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-10T14:22:41+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-10T14:22:41+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-10T14:25:19+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-10T14:25:20+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-10T14:27:30+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-10T14:27:30+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-11T00:41:08+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-11T00:41:09+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-11T00:48:41+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-11T00:48:41+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-11T07:58:59+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-11T07:58:59+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-13T07:29:57+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-13T07:29:57+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-14T10:36:51+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-14T10:36:51+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-16T07:09:30+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-16T07:09:30+00:00 - info: Web administration accessible at following address: http://localhost:9220
2018-01-16T07:34:26+00:00 - info: Block resolution: 0 potential blocks for root block...
2018-01-16T07:34:26+00:00 - info: Web administration accessible at following address: http://localhost:9220

It looks like BMA is disabled because the node is empty but I can’t understand why. You will probable have to dig into the code… Maybe @elois or @cgeek have an idea ?

Do I need multiple servers/nodes to create blocks?

No, only one node is necessary.