yongjhih / docker-parse-server

Provide docker images and docker stack for parse-server npm versions and latest commit
https://hub.docker.com/r/yongjhih/parse-server/
Apache License 2.0
475 stars 166 forks source link

Error: ENOENT: no such file or directory, lstat '/certs/production-pfx' #38

Closed peebles closed 8 years ago

peebles commented 8 years ago
wget https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose.yml
export APP_ID=myAppId
export MASTER_KEY=myMasterKey
export USER1=admin
export USER1_PASSWORD=parse
export PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1
docker-compose up -d

But dashboard says "cannot connect to server". Logs on server shows this:

> docker-parse-server@2.2.7 start /parse
> nodemon --watch /parse/cloud index.js

[nodemon] 1.9.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /parse/cloud/**/*
[nodemon] starting `node index.js`
fs.js:976
  return binding.lstat(pathModule._makeLong(path));
                 ^

Error: ENOENT: no such file or directory, lstat '/certs/production-pfx'
    at Error (native)
    at Object.fs.lstatSync (fs.js:976:18)
    at Object.<anonymous> (/parse/index.js:35:9)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:159:18)
[nodemon] app crashed - waiting for file changes before starting...
kyuumeitai commented 8 years ago

Hi there. Did you try to update the docker-compose.yml file?

peebles commented 8 years ago

No ... I literally did only what is shown in my original issue. I simply did a

wget https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose.yml

and used that. It that the correct docker-compose to use?

kyuumeitai commented 8 years ago

Yeah, it happened to me too, in my case I had an old docker-compose.yml. The new one has volumes configured with preconfigured files. If you erase the docker-compose.yml and download again change anything?

If that doesn't work, maybe there's something preventing the volume specified in the new docker-compose.yml file.

peebles commented 8 years ago

I see in the docker-compose file:

volumes:
   - /parse/cloud
   - "./volumes/certs:/certs"

but, as I indicated in my issue, I did nothing except wget the docker-compose file. I have not cloned the repo! So I have no "./volumns/certs". So at this point I am starting to assume I need to clone the repo before running docker-compose ... right? This (I think) was not clear in the DockerHub page.

peebles commented 8 years ago

But ... in the repo ( https://github.com/yongjhih/docker-parse-server ), there is not a ./volumes/certs, so I am confused. I must say I am new to parse itself. I know next to nothing about it.

peebles commented 8 years ago

Ok, this cert business looks like its for iOS push notifications. I do not care about this, at least for now. Any way to bypass this whole issue? I tried to simply "touch" the six files that are needed, but then:

[nodemon] starting `node index.js`
{ ios: 
   [ { pfx: '/certs/production-pfx',
       cert: '/certs/production-pfx-cert.pem',
       key: '/certs/production-pfx-key.pem',
       bundleId: '',
       production: true },
     { pfx: '/certs/dev-pfx',
       cert: '/certs/dev-pfx-cert.pem',
       key: '/certs/dev-pfx-key.pem',
       bundleId: '',
       production: false } ] }
false

undefined

/parse/node_modules/parse-server-push-adapter/lib/ParsePushAdapter.js:80
          throw _iteratorError;
          ^
[object Object]
[nodemon] app crashed - waiting for file changes before starting...

which I assume is because the certs are not valid (they are zero-length files).

yongjhih commented 8 years ago

You can use docker-compose-production.xml temporarily instead before I fixed it.

MASTER_KEY=myMasterKey APP_ID=myAppId docker-compose -f docker-compose-production.yml up
peebles commented 8 years ago

Same problem.

wget https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose-production.yml
docker-compose -f docker-compose-production.yml build
docker-compose -f docker-compose-production.yml up -d
[nodemon] starting `node index.js`
fs.js:976
  return binding.lstat(pathModule._makeLong(path));
                 ^

Error: ENOENT: no such file or directory, lstat '/certs/production-pfx'
    at Error (native)
    at Object.fs.lstatSync (fs.js:976:18)
    at Object.<anonymous> (/parse/index.js:35:9)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:159:18)
[nodemon] app crashed - waiting for file changes before starting...

which is no suprizing because in docker-compose-production, we still have:

  volumes:
    - /parse/cloud
    - "./volumes/certs:/certs"

and ./volumns still does not exit.

What the heck am I doing wrong? How come no one else has the same problem? I feel like I am following the directions on the Getting Started.

peebles commented 8 years ago

Maybe I am not being clear. I do not have your repo checked out.

$ ls
docker-compose-production.yml   docker-compose.yml      launch.sh
peebles@Andrews-MacBook-Pro:~/parse$ 
peebles@Andrews-MacBook-Pro:~/parse$ 
peebles@Andrews-MacBook-Pro:~/parse$ 
peebles@Andrews-MacBook-Pro:~/parse$ cat launch.sh 
eval $(docker-machine env parse-server)
export APP_ID=myAppId
export MASTER_KEY=myMasterKey
export USER1=admin
export USER1_PASSWORD=parse
export PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1
export SERVER_URL=http://localhost:1337/parse
export PARSE_DASHBOARD_SERVER_URL=http://localhost:1337/parse
docker-compose -f docker-compose-production.yml build
docker-compose -f docker-compose-production.yml up -d
yongjhih commented 8 years ago

docker pull yongjhih/parse-server for going to update latest image

peebles commented 8 years ago

Definitely progress. The server comes up and I can curl to it. But that dashboard says "unable to connect to server". I am running on a Mac, and when I bash into the parse_parse-dashboard_1 container and try

curl -v http://localhost:1337/parse

I get connection refused. If I try

curl -v http://parse-server:1337/parse

I get {"error":"unauthorized"}, which is much more promising (and what I would have expected given that I am not running docker native under linux). So I change docker-compose-production.yml to use http://parse-server:1337/parse for SERVER_URL and PARSE_DASHBOARD_SERVER_URL, but still, dashboard says "unable to connect to server". ???

peebles commented 8 years ago

In fact, based into the dashboard container:

# curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json"  -d '{}' http://192.168.99.103:1337/parse
{"result":"Hi"}

Yet ... the dashboard UI "cannot connect to server".

peebles commented 8 years ago

Opps. Above should have read:

# curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json"  -d '{}' http://parse-server:1337/parse/functions/hello
{"result":"Hi"}

(cut-n-paste issue!)

I see in the browser dev tools that dashboard tries to

http://parse-server:1337/parse/serverInfo

but it gets: (failed) net::ERR_NAME_NOT_RESOLVED

which is mysterious because I can clearly curl that URL on the command line. Any ideas?

yongjhih commented 8 years ago

I think it's mac with docker machine issue. SERVER_URL is for your browser to fetch parse-server, not for parse-dashboard container, so you must make sure that your browser can be reachable to parse-server with SERVER_URL

peebles commented 8 years ago

Actually, its PARSE_DASHBOARD_SERVER_URL that appears to be used by the dashboard client side javascript to access the parse server. Once I set that to http://192.168.99.103:1337/parse, it starts to work!

Thanks for all of your help (so far!). I should have really caught the last issue myself, but I wasn't thinking strait.

katopz commented 8 years ago

@peebles Not only you tho, I took a week for that lol, see here and here and now I mess up with Docker (beta) for Mac at the moment (without Docker toolbox) with another gotcha ;)