Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Raspberry - Docker Zenbot server issue - bug #1217

Closed
elRadix opened this issue Jan 24, 2018 · 15 comments
Closed

Raspberry - Docker Zenbot server issue - bug #1217

elRadix opened this issue Jan 24, 2018 · 15 comments
Labels

Comments

@elRadix
Copy link

elRadix commented Jan 24, 2018

System information

  • Have I written custom code (as opposed to using zenbot vanilla):

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux 4.9.62-v7+ armv7l GNU/Linux

  • Zenbot version: v4.1.0

  • NodeJS version: v8.8.1

  • Python version: Python 2.7.9

  • Exact command to reproduce: docker-compose up

Describe the problem.

Installed docker and zenbot based on this guide, all the steps - no issues with docker setup
https://github.com/DeviaVir/zenbot/blob/unstable/docs/raspberrypi.md

Source code / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.

root@raspi:/opt/zenbot# docker-compose up
Creating zenbot_mongodb_1 ... done
Creating zenbot_mongodb_1 ...
Creating zenbot_server_1  ... done
Attaching to zenbot_mongodb_1, zenbot_server_1
mongodb_1  | warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
mongodb_1  | Wed Jan 24 18:49:00.026
mongodb_1  | Wed Jan 24 18:49:00.027 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
mongodb_1  | Wed Jan 24 18:49:00.027
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
mongodb_1  | all output going to: /dev/null
zenbot_server_1 exited with code 1
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
zenbot_server_1 exited with code 1
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"
server_1   | standard_init_linux.go:195: exec user process caused "exec format error"

docker ps:
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS                        PORTS                                 NAMES
a6d3ee8de8da        deviavir/zenbot:unstable   "/usr/local/bin/node…"   2 minutes ago       Restarting (1) 1 second ago                                         zenbot_server_1
2a5b5d540515        mongo:latest               "/usr/bin/entry.sh m…"   8 minutes ago       Up 13 seconds                 0.0.0.0:27017->27017/tcp, 28017/tcp   zenbot_mongodb_1

@ferdiesletering
Copy link

I'm having the exact same issue with the same setup. Can't fix it either, I've tried still the same result.

@AcelisWeaven
Copy link

AcelisWeaven commented Jan 25, 2018

Same problem too, on the latest Raspbian Stretch Lite distribution. I found that if you rebuild the container yourself, you can run it but you need to do some changes.

In your docker-composer.yml, replace your server by:

  server:
    # image: deviavir/zenbot:unstable
    build:
        context: .
    volumes:
      - ./conf.js:/app/conf.js
      - ./extensions:/app/extensions
      - ./simulations:/app/simulations
    links:
      - mongodb
    working_dir: /app
    entrypoint: sh -c
    command: [ "tail", "-f", "/dev/null" ]
    restart: always
    tty: true
    depends_on:
      - mongodb
    environment:
      - MONGODB_PORT_27017_TCP_ADDR=mongodb

And then run docker-compose build and docker-compose up -d.

It will take some time, but your containers should now be running.

You can now run a command like this:

docker-compose exec server /app/zenbot.sh [command]

This is the only way I found to make it work. The command tail -f /dev/null (stolen from #1082) keeps the server running.


If you try to run a command using the way described in the Raspberry doc it won't work, but I couldn't figure out why.

pi@raspberrypi:~/zenbot $ docker run --rm --link zenbot_mongodb_1:mongodb -it zenbot_server list-strategies
docker: Error response from daemon: Cannot link to /zenbot_mongodb_1, as it does not belong to the default network.

My Docker knowledge is pretty limited and I find my solution a bit hacky, so I won't be able make a PR but I hope it will help you.

@elRadix
Copy link
Author

elRadix commented Jan 26, 2018

@AcelisWeaven followed your solution, now it's a mongo issue closing down quickly

root@raspi:/opt/zenbot# docker-compose up
Creating zenbot_mongodb_1 ... done
Creating zenbot_mongodb_1 ...
Creating zenbot_server_1  ... done
Attaching to zenbot_mongodb_1, zenbot_server_1
mongodb_1  | warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
mongodb_1  | Fri Jan 26 13:41:17.667
mongodb_1  | Fri Jan 26 13:41:17.668 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
mongodb_1  | Fri Jan 26 13:41:17.668
mongodb_1  | all output going to: /dev/null
zenbot_mongodb_1 exited with code 100

@acecilia
Copy link
Contributor

@elRadix what? I guess you mix up the names? ;P

@elRadix
Copy link
Author

elRadix commented Jan 26, 2018

@acecilia Sorry indeed :)

this is my docker config:

version: '3.1'

services:


  server:
    # image: deviavir/zenbot:unstable
    build:
        context: .
    volumes:
      - ./conf.js:/app/conf.js
      - ./extensions:/app/extensions
      - ./simulations:/app/simulations
    links:
      - mongodb
    working_dir: /app
    entrypoint: sh -c
    command: [ "tail", "-f", "/dev/null" ]
    restart: always
    tty: true
    depends_on:
      - mongodb
    environment:
      - MONGODB_PORT_27017_TCP_ADDR=mongodb
    ports:
      - 20080:20080

  mongodb:
    image: mongo:latest
    volumes:
      - ./data/db:/data/db
    command: mongod --smallfiles --bind_ip=0.0.0.0 --logpath=/dev/null
    ports:
      - 27017:27017

@AcelisWeaven
Copy link

@elRadix Can you do a docker version and a docker-compose version, just to see if we have similar versions?

pi@raspberrypi:~ $ docker version
Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f5
 Built: Wed Jan 10 20:25:15 2018
 OS/Arch:       linux/arm
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:21:22 2018
  OS/Arch:      linux/arm
  Experimental: false                                                                                                                                                          

pi@raspberrypi:~ $ docker-compose version
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.7.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.1.0f  25 May 2017

By the way, I've got the exact same docker-compose.yml.

@elRadix
Copy link
Author

elRadix commented Jan 26, 2018

This is what I have

root@raspi:/opt/zenbot#  docker version
Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f5
 Built: Wed Jan 10 20:16:34 2018
 OS/Arch:       linux/arm
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:12:44 2018
  OS/Arch:      linux/arm
  Experimental: false
root@raspi:/opt/zenbot# docker-compose version
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.7.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

@AcelisWeaven
Copy link

Well, this may not come from Docker itself then. Maybe the port is already used, or something like that?

Can I ask you to do another command for comparison?

pi@raspberrypi:~/zenbot $ docker-compose logs
Attaching to zenbot_server_1, zenbot_mongodb_1
mongodb_1  | warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
mongodb_1  | Thu Jan 25 22:25:31.530
mongodb_1  | Thu Jan 25 22:25:31.531 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
mongodb_1  | Thu Jan 25 22:25:31.531
mongodb_1  | all output going to: /dev/null

@elRadix
Copy link
Author

elRadix commented Jan 26, 2018

same output

root@raspi:/opt/zenbot# docker-compose logs
Attaching to zenbot_server_1, zenbot_mongodb_1
mongodb_1  | warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
mongodb_1  | Fri Jan 26 16:05:19.884
mongodb_1  | Fri Jan 26 16:05:19.884 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
mongodb_1  | Fri Jan 26 16:05:19.884
mongodb_1  | all output going to: /dev/null

root@raspi:/opt/zenbot# docker-compose up
Creating zenbot_mongodb_1 ... done
Creating zenbot_mongodb_1 ...
Creating zenbot_server_1  ... done
Attaching to zenbot_mongodb_1, zenbot_server_1
mongodb_1  | warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
mongodb_1  | Fri Jan 26 16:05:19.884
mongodb_1  | Fri Jan 26 16:05:19.884 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
mongodb_1  | Fri Jan 26 16:05:19.884
mongodb_1  | all output going to: /dev/null
zenbot_mongodb_1 exited with code 100


list of open ports

root@raspi:/opt/zenbot# lsof -i -P -n | grep LISTEN

rpcbind     814             root    8u  IPv4   13493      0t0  TCP *:111 (LISTEN)
tor         934       debian-tor    7u  IPv4   13854      0t0  TCP 127.0.0.1:9050 (LISTEN)
smbd       1358             root   35u  IPv4   16385      0t0  TCP *:445 (LISTEN)
smbd       1358             root   36u  IPv4   16386      0t0  TCP *:139 (LISTEN)
nginx      1387             root   14u  IPv4   17484      0t0  TCP *:443 (LISTEN)
nginx      1388         www-data   14u  IPv4   17484      0t0  TCP *:443 (LISTEN)
nginx      1389         www-data   14u  IPv4   17484      0t0  TCP *:443 (LISTEN)
nginx      1390         www-data   14u  IPv4   17484      0t0  TCP *:443 (LISTEN)
nginx      1391         www-data   14u  IPv4   17484      0t0  TCP *:443 (LISTEN)
mysqld     1864            mysql   10u  IPv4   17684      0t0  TCP 127.0.0.1:3306 (LISTEN)
mosquitto  2345        mosquitto    4u  IPv4   17183      0t0  TCP *:8883 (LISTEN)
mosquitto  2345        mosquitto    5u  IPv4   17189      0t0  TCP *:1883 (LISTEN)
mosquitto  2345        mosquitto    6u  IPv4   17197      0t0  TCP *:8083 (LISTEN)
node-red   2355             root   10u  IPv4   19817      0t0  TCP *:1880 (LISTEN)
monit      3063             root    5u  IPv4   21200      0t0  TCP *:2812 (LISTEN)
python     4380             root    3u  IPv4 4197932      0t0  TCP 127.0.0.1:5009 (LISTEN)
find       4383             root    5u  IPv4 4197536      0t0  TCP *:8003 (LISTEN)
hass       5104             root   19u  IPv4  195130      0t0  TCP *:8123 (LISTEN)
Plex       6268             plex   59u  IPv4 2819992      0t0  TCP *:32400 (LISTEN)
Plex       6268             plex   60u  IPv4 2819993      0t0  TCP 127.0.0.1:32401 (LISTEN)
Plex       6338             plex    9u  IPv4 2823567      0t0  TCP 127.0.0.1:36205 (LISTEN)
Plex       6710             plex   14u  IPv4 2822570      0t0  TCP 127.0.0.1:32600 (LISTEN)
sshd      14775             root    3u  IPv4  253276      0t0  TCP *:2800 (LISTEN)
docker-pr 15415             root    4u  IPv4 4425874      0t0  TCP *:20080 (LISTEN)
influxd   19631         influxdb    3u  IPv4 3286382      0t0  TCP 127.0.0.1:8088 (LISTEN)
influxd   19631         influxdb   25u  IPv4 3286465      0t0  TCP *:8086 (LISTEN)
grafana-s 24451          grafana    7u  IPv4 3983197      0t0  TCP *:3000 (LISTEN)

docker ps

root@raspi:/opt/zenbot# docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES
374a8f644541        zenbot_server       "sh -c tail -f /dev/…"   6 minutes ago       Up 6 minutes        0.0.0.0:20080->20080/tcp   zenbot_server_1


root@raspi:/opt/zenbot# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
<none>               <none>              5488ab7b06ea        About an hour ago   582MB
deviavir/zenbot      unstable            efd8d3d62167        2 hours ago         1.01GB
zenbot_server        latest              d8d1a19a249a        3 hours ago         1.01GB
resin/rpi-raspbian   stretch             79d4a99c6e95        2 weeks ago         145MB
node                 8                   fd517d01b822        3 weeks ago         554MB
mongo                latest              58f904c8d776        16 months ago       229MB

@elRadix
Copy link
Author

elRadix commented Jan 26, 2018

@AcelisWeaven provided additional log output above, anything else ?

seems that the mongo docker is shutting down quickly

@AcelisWeaven
Copy link

@elRadix Sorry for the late answer, I won't be at my place for a few days. I don't have any more idea about this, have you found a solution to your problem?
By the way, my model is a Raspberry PI 3 (don't remember the model) and I'm running Raspbian Stretch Lite. Maybe you could try running this distribution and try my workarounds, if that's an option?

Good luck anyway! Sorry I can't help you more, I wish I could.

@elRadix
Copy link
Author

elRadix commented Feb 2, 2018

@AcelisWeaven I've installed Raspbian strech on my Pi3, both containers are running now:

installation:

 ---> 2ec422cca948
Step 7/10 : RUN ln -s /app/zenbot.sh /usr/local/bin/zenbot
 ---> Running in 89bb56509b5d
Removing intermediate container 89bb56509b5d
 ---> ef06a65c900a
Step 8/10 : ENV NODE_ENV production
 ---> Running in e2e759586a0b
Removing intermediate container e2e759586a0b
 ---> d07b0e81969f
Step 9/10 : ENTRYPOINT ["/usr/local/bin/node", "zenbot.js"]
 ---> Running in 78c7586c2129
Removing intermediate container 78c7586c2129
 ---> 3386e0de850b
Step 10/10 : CMD [ "trade", "--paper" ]
 ---> Running in 56b75ee8f5a7
Removing intermediate container 56b75ee8f5a7
 ---> d10a2c20ff46
Successfully built d10a2c20ff46
Successfully tagged zenbot_server:latest
root@DietPi:/opt/zenbot# docker-compose up
Creating zenbot_mongodb_1 ... done
Creating zenbot_mongodb_1 ...
Creating zenbot_server_1  ... done
Attaching to zenbot_mongodb_1, zenbot_server_1
mongodb_1  | warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
mongodb_1  | Fri Feb  2 12:53:49.434
mongodb_1  | Fri Feb  2 12:53:49.436 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
mongodb_1  | Fri Feb  2 12:53:49.436
mongodb_1  | all output going to: /dev/null

root@DietPi:/opt/zenbot# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                 NAMES
67976ba37d5c        zenbot_server       "sh -c tail -f /dev/…"   2 minutes ago       Up 28 seconds       0.0.0.0:20080->20080/tcp              zenbot_server_1
60200782b90c        mongo:latest        "/usr/bin/entry.sh m…"   2 minutes ago       Up 29 seconds       0.0.0.0:27017->27017/tcp, 28017/tcp   zenbot_mongodb_1

It's not accepenting any of the commands apparently, can you pls check what I'm doing wrong?

root@DietPi:/opt/zenbot# docker-compose exec server /app/zenbot.sh [ "trade", "--paper" ]

WARNING: MongoDB Connection Error:  { MongoError: Server at mongodb:27017 reports wire version 0, but this version of Node.js Driver requires at least 2 (MongoDB2.6).
    at /app/node_modules/mongodb-core/lib/topologies/server.js:377:39
    at /app/node_modules/mongodb-core/lib/connection/pool.js:541:18
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'MongoError',
  message: 'Server at mongodb:27017 reports wire version 0, but this version of Node.js Driver requires at least 2 (MongoDB2.6).' }
WARNING: without MongoDB some features (such as backfilling/simulation) may be disabled.
Attempted authentication string: mongodb://mongodb:27017/zenbot4?

  Usage: zenbot [options] [command]

@AcelisWeaven
Copy link

@elRadix Are you using the unstable branch? If so, try to downgrade the mongodb dependency to match the one in the master branch.

Quick and ugly fix:

docker-compose exec server bash
npm install [email protected]

@elRadix
Copy link
Author

elRadix commented Feb 3, 2018

I'm using the dietpi v6 - stable version OS, downgraded mongo but it's still complaining
Node.js Driver requires at least 2 (MongoDB2.6).' }

root@DietPi:~# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                 NAMES
67976ba37d5c        zenbot_server       "sh -c tail -f /dev/…"   21 hours ago        Up 21 hours         0.0.0.0:20080->20080/tcp              zenbot_server_1
60200782b90c        mongo:latest        "/usr/bin/entry.sh m…"   21 hours ago        Up 21 hours         0.0.0.0:27017->27017/tcp, 28017/tcp   zenbot_mongodb_1
root@DietPi:~# cd /opt/zenbot/
root@DietPi:/opt/zenbot# docker-compose exec server bash
root@67976ba37d5c:/app# npm install [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

+ [email protected]
added 3 packages, removed 18 packages and updated 2 packages in 104.527s
root@67976ba37d5c:/app# exit
exit
root@DietPi:/opt/zenbot# docker-compose exec server /app/zenbot.sh [ "trade", "--paper" ]
module.js:540
    throw err;
    ^

Error: Cannot find module 'numbro'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/commands/backfill.js:2:9)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
root@DietPi:/opt/zenbot# docker-compose down
Stopping zenbot_server_1  ... done
Stopping zenbot_mongodb_1 ... done
Removing zenbot_server_1  ... done
Removing zenbot_mongodb_1 ... done
Removing network zenbot_default
root@DietPi:/opt/zenbot# docker-compose up -d
Creating zenbot_mongodb_1 ... done
Creating zenbot_mongodb_1 ...
Creating zenbot_server_1  ... done
root@DietPi:/opt/zenbot# docker-compose exec server /app/zenbot.sh [ "trade", "--paper" ]
WARNING: MongoDB Connection Error:  { MongoError: Server at mongodb:27017 reports wire version 0, but this version of Node.js Driver requires at least 2 (MongoDB2.6).
    at /app/node_modules/mongodb-core/lib/topologies/server.js:377:39
    at /app/node_modules/mongodb-core/lib/connection/pool.js:541:18
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'MongoError',
  message: 'Server at mongodb:27017 reports wire version 0, but this version of Node.js Driver requires at least 2 (MongoDB2.6).' }
WARNING: without MongoDB some features (such as backfilling/simulation) may be disabled.
Attempted authentication string: mongodb://mongodb:27017/zenbot4?

@DeviaVir
Copy link
Owner

Dear issue reporter,

We have slightly changed our github issue policy and would now kindly request folks that have questions that they ask them in our zenbot subreddit.

You can find it here: https://reddit.com/r/zenbot

This issue will be closed, but if you disagree with your ticket being marked as a question feel free to leave a comment defending your case.

Thanks for contributing time and effort!

Greetings,
🤖

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants