rethinkdb / horizon-docs

Other
24 stars 35 forks source link

Upgrade docker-compose files to v2 of the docker-compose file spec #100

Open antoniocanas opened 8 years ago

antoniocanas commented 8 years ago

Using the example docker-compose.dev.yml,

horizon_1    | debug: Connection to RethinkDB terminated: ReqlDriverError: Could not connect to rethinkdb:28015.

rethinkdb container is linked to the horizon one, so the database start and later horizon try to connect to it but rethinkdb is not initialized yet.

As a workaround:

docker-compose up rethinkdb
[Wait for it and Ctrl+C]
docker-compose up
danielmewes commented 8 years ago

Thanks for reporting this @antoniocanas .

Pinging @dalanmiller

danielmewes commented 8 years ago

@antoniocanas Another question: Does Horizon still come up in the end? If I'm not mistaken, the Horizon CLI retries connecting to the RethinkDB server a few times before giving up. So other than seeing these debug messages, this might not actually be an issue.

antoniocanas commented 8 years ago
node_1       | Horizon failed to start after 30 seconds
node_1       | Try running hz serve again with the --debug flag
dalanmiller commented 8 years ago

Hey @antoniocanas, @danielmewes is correct in that Horizon will retry for some time to connect to RethinkDB. It should not take this long for RethinkDB to startup. What logs are you getting from the database instance?

In my testing it worked fine, but one thing I need to do is move the docker-compose.yml files to v2 of spec so I can use the depends_on config.

https://docs.docker.com/compose/compose-file/#/depends-on

antoniocanas commented 8 years ago

I'm using v1 of docker-compose yaml file. Another workaround could be restart: always on the horizon container.

rethinkdb is initialized fine but with a big delay.

rethinkdb_1  | Running rethinkdb 2.3.4~0jessie (GCC 4.9.2)...
rethinkdb_1  | Running on Linux 4.4.15-moby x86_64
rethinkdb_1  | Loading data from directory /data/rethinkdb_data
rethinkdb_1  | Listening for intracluster connections on port 29015
rethinkdb_1  | Listening for client driver connections on port 28015
rethinkdb_1  | Listening for administrative HTTP connections on port 8080
rethinkdb_1  | Listening on cluster addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%232
rethinkdb_1  | Listening on driver addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%232
rethinkdb_1  | Listening on http addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%232
rethinkdb_1  | Server ready, "01336733cdfb_kh6" 9a4e29d9-d234-44e9-8d4c-888cb9673398
dalanmiller commented 8 years ago

@antoniocanas what kind of hardware are you running this on? Locally?

antoniocanas commented 8 years ago

Yeah it's local, macbook pro with 'docker for mac'

dalanmiller commented 8 years ago

Hey @antoniocanas sorry it took me a couple days to test this out:

I got it working, here's what I did:

  1. went into the Horizon repository and to /examples/react-chat-app example.
  2. I moved the dev docker-compose file into this folder with: cp ../../docker-compose.dev.yml .
  3. I then commented out the rethinkdb ports as they were conflicting with my system running RethinkDB. (probably unnecessary)
  4. I then ran docker-compose -f ./docker-compose.dev.yml up

Here is the output:

$ docker-compose -f docker-compose.dev.yml up
Recreating reactchatapp_rethinkdb_1
Creating reactchatapp_horizon_1
Attaching to reactchatapp_rethinkdb_1, reactchatapp_horizon_1
rethinkdb_1  | Recursively removing directory /data/rethinkdb_data/tmp
rethinkdb_1  | Initializing directory /data/rethinkdb_data
rethinkdb_1  | Running rethinkdb 2.3.4~0jessie (GCC 4.9.2)...
rethinkdb_1  | Running on Linux 4.4.15-moby x86_64
rethinkdb_1  | Loading data from directory /data/rethinkdb_data
rethinkdb_1  | Listening for intracluster connections on port 29015
rethinkdb_1  | Listening for client driver connections on port 28015
rethinkdb_1  | Listening for administrative HTTP connections on port 8080
rethinkdb_1  | Listening on cluster addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%18
rethinkdb_1  | Listening on driver addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%18
rethinkdb_1  | Listening on http addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%18
rethinkdb_1  | Server ready, "c0f430a60501_s8h" f8a5bbd5-3420-451d-abe9-ae65ae708a5a
horizon_1    | App available at http://0.0.0.0:8181
horizon_1    | Starting Horizon...
horizon_1    | 🌄 Horizon ready for connections
horizon_1    | warn: Auto-creating collection (dev mode): react_messages
horizon_1    | warn: Collection created (dev mode): "react_messages"
horizon_1    | warn: Auto-creating index on collection "react_messages" (dev mode): ["datetime"]
^CGracefully stopping... (press Ctrl+C again to force)
Killing reactchatapp_horizon_1 ... done
Killing reactchatapp_rethinkdb_1 ... done

I then wanted to check that after it created the rethinkdb_data directory that it would still work, and so I started it up again with the same command and indeed it worked:

$ docker-compose -f docker-compose.dev.yml up
Starting reactchatapp_rethinkdb_1
Starting reactchatapp_horizon_1
Attaching to reactchatapp_rethinkdb_1, reactchatapp_horizon_1
rethinkdb_1  | Running rethinkdb 2.3.4~0jessie (GCC 4.9.2)...
rethinkdb_1  | Running on Linux 4.4.15-moby x86_64
rethinkdb_1  | Loading data from directory /data/rethinkdb_data
rethinkdb_1  | Listening for intracluster connections on port 29015
rethinkdb_1  | Listening for client driver connections on port 28015
rethinkdb_1  | Listening for administrative HTTP connections on port 8080
rethinkdb_1  | Listening on cluster addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%22
rethinkdb_1  | Listening on driver addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%22
rethinkdb_1  | Listening on http addresses: 127.0.0.1, 172.17.0.2, ::1, fe80::42:acff:fe11:2%22
rethinkdb_1  | Server ready, "c0f430a60501_s8h" f8a5bbd5-3420-451d-abe9-ae65ae708a5a
horizon_1    | App available at http://0.0.0.0:8181
horizon_1    | Starting Horizon...
horizon_1    | 🌄 Horizon ready for connections

I realize this isn't the same experience you're having, do you think it might be because you have more data stored in your RethinkDB instance already? Or are you on a Macbook with a spinning disk drive?

I'm going to change the title of this issue to upgrade the docker-compose.yml to v2 of the spec that way we can use the depends_on property to make sure the rethinkdb image is spun up and ready for the horizon one.