Closed almereyda closed 9 years ago
After nsenter
ing the container, it seems not even a simple curl http://localhost:5984/
gives the desired welcome message. Maybe that's the culprit, then.
Well, the linked container is mapped through its alias db
in the hosts
file, so maybe the db config just needs to be sed
ed. couchdb
appears to be a much more appealing alias.
Running the image via docker run -i --name="ethermap" --link couch_db:couchdb -p 8080:3000 almereyda/ethermap:testing
after introducing
RUN sed -i 's/localhost/couchdb/' /data/Ethermap/lib/couchdb.js
before the WORKDIR
directive in the Dockerfile
unfortunately didn't yield any result. It still crashes.
I'm not quite sure, but sometimes the 'ECONNREFUSED' occurs if a port is already in use or not accessible. Is there something else running on one of the ports?
No, it's a direct mapping between the containers. I can also successfully curl the couchdb container from within the ethermap container through
[ root@9ec92a52d01b:/ ]$ curl http://couchdb:5984
{"couchdb":"Welcome","uuid":"123c43544ae5893a53fe5605ee6a1ff1","version":"1.6.1","vendor":{"version":
"1.6.1","name":"The Apache Software Foundation"}}
Therefore I wonder if the Ethermap database has to created first, an admin user has to be created to get the Couch out of Admin party or anything else.
[ root@9ec92a52d01b:/data/Ethermap {master *} ]$ git diff
diff --git a/lib/couchdb.js b/lib/couchdb.js
index 73192a2..932d853 100644
--- a/lib/couchdb.js
+++ b/lib/couchdb.js
@@ -4,7 +4,7 @@
* @author Dennis Wilhelm
*/
-var nano = require('nano')('http://localhost:5984');
+var nano = require('nano')('http://couchdb:5984');
var Q = require('q');
/**
are all resulting changes that happen to be within the Ethermap repository to comply with the linked CouchDB container.
Or did you mean the Express application itself? That's quite impossible, as it runs completely isolated:
[ root@9ec92a52d01b:/ ]$ netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 1/node
tcp 0 0 0.0.0.0:10843 0.0.0.0:* LISTEN 1/node
[ root@9ec92a52d01b:/ ]$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.8 669908 32636 ? Ssl 15:33 0:00 node dist/server.js
root 143 0.0 0.1 19396 4592 ? S 15:46 0:00 -bash
root 172 0.0 0.0 15576 2220 ? R+ 15:46 0:00 ps aux
I'd like to know which connection is refused and I believe your Sentry may contain entries for that?
I guess the error is not related to CouchDB but rather to the http server of node, as the stacktrace reveals errors deep inside the node http modules (net.js, stream.js).
A database connection error should probably occur in 'lib/couchdb.js'.
I'm directly mapping Node's Port 3000 to a public IP and port 8080
.
Does the second port, in my case 10843
, also have to be reachable publicly or is it proxied through the main Node process?
Maybe the nested-error-stacks
npm module may help here.
I just tested your docker container resulting in the same error.
However, installing Ethermap natively works without problems. Tested on Ubuntu 12.04 and 14.04 up to the newest node.js version.
So basically I'm not sure what causes this error, but I guess the error is not in the application.
Let's keep this issue open for now as long as I try to track down the error. A Dockerfile wouldn't be too bad, either.
But did your Sentry instance register any problems? Do I need my own instance? And should error handling be improved, so the server doesn't crash anymore in cases of?
The sentry didn't register any errors. It sould only accept errors from my server domain so you don't have to worry about it.
Of course, error handling could be improved!
Ok my mistake. Turns out it really is the connection to the database which is failing. However, I still don't know why this is occuring in Docker.
I included a quick fix to prevent the node app from crashing (https://github.com/dwilhelm89/Ethermap/commit/53adc5273b9b3615be5b0465bc92856ff3ea2977) but of course there should be a better errorhandling for non-existent databases ;-)
You're right. It doesn't crash anymore and I can even use it ( http://ethermap.transformap.co ).
I'm closing this issue, but will open new ones for the new errors I'm experiencing:
/api/history
produces 500 responses./api/features/<MAPNAME>
returns 504 (Gateway Time-out)In case if you're interested, I'm now using my own Sentry service https://github.com/14mmm/Ethermap/commit/b313bbd3bef41b2262e2e38e4680495dd6c10898 and will investigate those questions a little further.
@ubergesundheit Did this work inform your Dockerfile PR anyhow?
did you update everything?
Before I created the PR, I tested everything on an empty host with just docker and fig installed (see http://128.176.133.116:8081).
What are your errors?
My live site is down now, but the UI was never loading properly and there were blockers.
Now that your Dockerfile exists, I would love to use it, but your commits didn't contain any updates on the README.
Can I suppose it should work similarily to the following?
Die CouchDB Quelle ist https://github.com/klaemo/docker-couchdb, erstellt mit
docker build -t couchdb .
gestartet mitdocker run -d -p 127.0.0.1::5984 --name="couch_db" couchdb
erstellt mit
docker build -t almereyda/ethermap:testing .
, gestartet mitdocker run -i --name="ethermap" --link couch_db:db -p 8080:3000 almereyda/ethermap:testing
just use fig ?!
@ubergesundheit I see. There's the configuration. I always understood fig to be for local deployments only, though. Or do you know of production uses for it?
I also use it in production. Daemonize with -d
Am 18.12.2014 23:51 schrieb "Jon Richter" notifications@github.com:
@ubergesundheit https://github.com/ubergesundheit I see. There's the configuration. I always understood fig to be for local deployments only, though. Or do you know of production uses for it?
— Reply to this email directly or view it on GitHub https://github.com/dwilhelm89/Ethermap/issues/2#issuecomment-67571206.
Ich benutze Ethermap mit einem selbstgeschriebenen Dockerfile, welches mit einer CouchDB Instanz verlinkt wird:
Die CouchDB Quelle ist https://github.com/klaemo/docker-couchdb, erstellt mit
docker build -t couchdb .
gestartet mitdocker run -d -p 127.0.0.1::5984 --name="couch_db" couchdb
erstellt mit
docker build -t almereyda/ethermap:testing .
, gestartet mitdocker run -i --name="ethermap" --link couch_db:db -p 8080:3000 almereyda/ethermap:testing
Der Server startet und zeigt auch die Startseite, jedoch das Öffnen einer Map crasht per
Womöglich ist eine Mitteilung darüber auch in eurem Sentry gelandet; hätte ich gestern Abend doch mal eine eigene Instanz aufgebaut.
Was für ein Fehler kann das sein?
Danke.