Hypfer / ICantBelieveItsNotValetudo

A Valetudo companion service which renders maps to pngs
Apache License 2.0
129 stars 80 forks source link

mapping config #4

Closed Seb788 closed 5 years ago

Seb788 commented 5 years ago

Hi, im trying to map the config file to /app/config.json in docker. it doesn't work for me. i always get " invalid configuration file...using default configuration.

I use this command. docker container run -it --rm p 3000:3000 -v $PWD/config.json:app mapclient

Could you write an example for the proper way to map this file? Thank you

Hypfer commented 5 years ago

This is how my docker-compose file looks like

    icantbelieveitsnotvaletudo:
        build:
          context: ./ICantBelieveItsNotValetudo/
          dockerfile: Dockerfile
        container_name: "ICantBelieveItsNotValetudo"
        restart: always
        volumes:
            - /opt/dockerized/ICantBelieveItsNotValetudo/config.json:/app/config.json
Seb788 commented 5 years ago

Hi Hypfer, It is still not working,

I created a file on the host named config.json with my mqtt info in it. /root/Documents/mapclient/IcantBelieveItsNotValetudo/config.json

then I created a simple docker file like this

`    icantbelieveitsnotvaletudo:
        build: .
        container_name: "ICantBelieveItsNotValetudo"
        volumes:
            - /root/Documents/mapclient/IcantBelieveItsNotValetudo/config.json:/app/config.json`

The image gets build and the container starts but I always get this error,

`root@debian-ha:~/Documents/mapclient/ICantBelieveItsNotValetudo# docker-compose up
Starting ICantBelieveItsNotValetudo ... done
Attaching to ICantBelieveItsNotValetudo
ICantBelieveItsNotValetudo    | 
ICantBelieveItsNotValetudo    | > i-cant-believe-its-not-valetudo@0.2.0 start /app
ICantBelieveItsNotValetudo    | > node app.js
ICantBelieveItsNotValetudo    | 
ICantBelieveItsNotValetudo    | Loading configuration file: /app/config.json
ICantBelieveItsNotValetudo    | Invalid configuration file!
ICantBelieveItsNotValetudo    | Writing new file using defaults
ICantBelieveItsNotValetudo    | fs.js:646
ICantBelieveItsNotValetudo    |   return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
ICantBelieveItsNotValetudo    |                  ^
ICantBelieveItsNotValetudo    | 
ICantBelieveItsNotValetudo    | Error: EISDIR: illegal operation on a directory, open '/app/config.json'
ICantBelieveItsNotValetudo    |     at Object.fs.openSync (fs.js:646:18)
ICantBelieveItsNotValetudo    |     at Object.fs.writeFileSync (fs.js:1299:33)
ICantBelieveItsNotValetudo    |     at Configuration.persist (/app/lib/Configuration.js:80:8)
ICantBelieveItsNotValetudo    |     at new Configuration (/app/lib/Configuration.js:45:18)
ICantBelieveItsNotValetudo    |     at Object.<anonymous> (/app/app.js:6:14)
ICantBelieveItsNotValetudo    |     at Module._compile (module.js:653:30)
ICantBelieveItsNotValetudo    |     at Object.Module._extensions..js (module.js:664:10)
ICantBelieveItsNotValetudo    |     at Module.load (module.js:566:32)
ICantBelieveItsNotValetudo    |     at tryModuleLoad (module.js:506:12)
ICantBelieveItsNotValetudo    |     at Function.Module._load (module.js:498:3)
ICantBelieveItsNotValetudo    | npm ERR! code ELIFECYCLE
ICantBelieveItsNotValetudo    | npm ERR! errno 1
ICantBelieveItsNotValetudo    | npm ERR! i-cant-believe-its-not-valetudo@0.2.0 start: `node app.js`
ICantBelieveItsNotValetudo    | npm ERR! Exit status 1
ICantBelieveItsNotValetudo    | npm ERR! 
ICantBelieveItsNotValetudo    | npm ERR! Failed at the i-cant-believe-its-not-valetudo@0.2.0 start script.
ICantBelieveItsNotValetudo    | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
ICantBelieveItsNotValetudo    | 
ICantBelieveItsNotValetudo    | npm ERR! A complete log of this run can be found in:
ICantBelieveItsNotValetudo    | npm ERR!     /root/.npm/_logs/2019-05-08T02_33_29_067Z-debug.log
ICantBelieveItsNotValetudo exited with code 1
`

Thanks for your help.

Hypfer commented 5 years ago

/root/Documents/mapclient/IcantBelieveItsNotValetudo/config.json is most likely a directory

Seb788 commented 5 years ago

Thanks, it works now.