colloqi / pisignage-server

Local Server to manage piSignage players based on node.js
http://www.pisignage.com
MIT License
372 stars 153 forks source link

docker-compose : mongo not running #200

Open slfhstr opened 10 months ago

slfhstr commented 10 months ago

Used the linked docker-compose.yml with additions for traefik. App page https://pisignage.domain.tld returns 404 docker logs show :

********************************************
*          MongoDB Process not running     *
********************************************

wait-for-it.sh: waiting 15 seconds for mongo:27017
nc: bad address 'mongo'

Docker-compose.yml is :

version: '3'
services:
  mongo:
    image: mongo:4.4
    restart: unless-stopped
    ports:
      - 27017:27017
    volumes:
      - $PWD/mongodb:/data/db
      - $PWD/mongodb_config:/data/configdb
  pisignage-server:
    image: pisignage/pisignage-server:latest
    restart: unless-stopped
    volumes:
      - $PWD/media:/media
      - $PWD/data:/data
    depends_on:
      - mongo
    labels:
      - traefik.docker.network=traefik
      - traefik.port=3000
      - "traefik.enable=true"
      - "traefik.http.routers.pisignage.rule=Host(`pisignage.domain.tld`)"
      - "traefik.http.routers.pisignage.entrypoints=websecure"
      - "traefik.http.routers.pisignage.tls.certresolver=letsencrypt"
    networks:
      - traefik

networks:
  traefik:
    external: true

volumes:
  mongodb:
  mongodb_config:
  media:
  data:

How do I get mongo started in the container ?

AbhijithBn commented 10 months ago

Hi @slfhstr

There is a chance that the $PWD might be causing issues. Can you remove the $PWD and check if you see MongoDB Volumes?

slfhstr commented 10 months ago

Thank you. I added the $PWD as it also didn't start without. Removing the $PWD gives the following in docker logs :

Express server listening on port 3000 in production mode
********************************************
*        system check passed               *
********************************************
Downloading http://pisignage.com/releases/package.json
#Done
Downloading http://pisignage.com/releases/package-p2.json
#Done
nc: bad address 'mongo'
********************************************
*          MongoDB Process not running     *
********************************************

wait-for-it.sh: waiting 15 seconds for mongo:27017
nc: bad address 'mongo'
nc: bad address 'mongo'
wait-for-it.sh: timeout occurred after waiting 15 seconds for mongo:27017
********************************************************************
*    After update if you do not see your groups, please change     *
*    change the uri variable to "mongodb://localhost/pisignage-dev"*
*    in config/env/development.js and restart the server           *
******************************************************************

info: socket.io started
(node:1) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:1) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Express server listening on port 3000 in production mode
********************************************
*        system check passed               *
********************************************
Downloading http://pisignage.com/releases/package.json
#Done
Downloading http://pisignage.com/releases/package-p2.json
#Done
nc: bad address 'mongo'
********************************************
*          MongoDB Process not running     *
********************************************

wait-for-it.sh: waiting 15 seconds for mongo:27017
nc: bad address 'mongo'

pisignage-server restarts every 15 seconds so there is no time to edit config/env/development.js No volumes created in working directory, and don't see them elsewhere on system.

slfhstr commented 10 months ago

Is it significant that no ports are shown for pisignage-server when running docker ps -a ?

NAMES                          STATUS                 IMAGE                                       CONTAINER ID   PORTS
pisignage_pisignage-server_1   Up 8 seconds           pisignage/pisignage-server:latest           809b12cad20e
pisignage_mongo_1              Up 30 seconds          mongo:4.4                                   17bd6fb424b6   0.0.0.0:27017->27017/tcp, :::27017->27017/tcp

Also I notice that docker-compose up -d shows another network is auto-created (it's not specified in docker-compose) :

Creating network "pisignage_default" with the default driver
Creating pisignage_mongo_1 ... done
Creating pisignage_pisignage-server_1 ... done

Also volumes are only created when I add $PWD or ./ Then mongo volumes are owned by a different user.

drwxr-xr-x  5 root             root 4096 Jan  2 08:20 data
-rw-r--r--  1 root             root  811 Jan  2 08:20 docker-compose.yml
drwxr-xr-x  4 root             root 4096 Jan  2 08:20 media
drwxr-xr-x  4 systemd-coredump root 4096 Jan  2 08:24 mongodb
drwxr-xr-x  2 systemd-coredump root 4096 Jan  2 08:20 mongodb_config
slfhstr commented 10 months ago

I realised that in docker-compose.yml the mongo service did not have same network assigned. I added the traefik network to that service. The pisignage-server service stays up 🍾 And no errors in docker logs about mongo not running. But visiting pisignage.domain.tld still produces 404. Changing config/env/development.js has no effect - still 404. No errors shown in browser console