grounds/grounds.io

Setup Issues - Docker and Console/Runner

Closed this issue · 7 comments

I'm posting this as an issue, but it's really a setup question. I couldn't find an IRC channel listed anywhere. If there are other means of communication preferred for this sort of thing, let me know and I'll continue further discussion there.

At any rate, I have been attempting to set up grounds.io in my own environment. There seems to be two ways to run docker - via the regular server (service docker start) and then through a more direct invocation (docker -d). Which is the appropriate way?

When I use docker -d I am able to run the application (make run) and view the web page. Building also works fine (docker-compose -p groundsio build web). However, the console/runner seems to be having problems. The console area displays "Connection with remote server failed. Trying to reconnect..." and the following tests fail (make test):

rspec ./spec/features/run_ground_spec.rb:17 # Run a ground when running any code example console displays a waiting message
rspec ./spec/features/run_ground_spec.rb:26 # Run a ground when running any code example after a run console stop displaying a waiting message
rspec ./spec/features/run_ground_spec.rb:10 # Run a ground behaves like a connected ground ground is connected to runner
rspec ./spec/features/run_ground_spec.rb:51 # Run a ground when running default code example console displays a status equal to 0
rspec ./spec/features/run_ground_spec.rb:47 # Run a ground when running default code example console displays runner output on stdout
rspec ./spec/features/run_ground_spec.rb:68 # Run a ground when running custom code example console displays a status equal to -1
rspec ./spec/features/run_ground_spec.rb:64 # Run a ground when running custom code example console displays runner output on stderr

On the other hand, if I start docker as a daemon via docker -d I get different errors. The build (docker-compose -p groundsio build web) process is successful again. However, both make run and make test fail with errors about missing Rakefiles. Here's the last few lines of output from make test:

Step 23 : WORKDIR $APP
---> Using cache
---> 5815feb75249
Successfully built 5815feb75249
docker-compose -p groundsio kill
Killing groundsio_redis_1...
docker-compose -p groundsio rm --force
Going to remove groundsio_redis_1, groundsio_runner_1
Removing groundsio_runner_1...
Removing groundsio_redis_1...
rm -f tmp/pids/server.pid
RAILS_ENV='development' REPOSITORY='grounds' docker-compose -p groundsio up -d runner
Creating groundsio_runner_1...
RAILS_ENV='development' REPOSITORY='grounds' docker-compose -p groundsio run --service-ports web rake test
Creating groundsio_redis_1...
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
(See full trace by running task with --trace)
make: *** [test] Error 1

Are there any additional configuration options related to the 'runner' and/or 'grounds' I should know about? Also, it might be useful to know the difference between the runner and a "ground". I am guessing that the code entered via the browser is executed in a "ground" (container?) via the runner. Is this right?

I've poked around a bit to try and understand what's going on, but I'm having trouble grasping what my problem might be. Any tips would be appreciated! Thanks

The more appropriate way of running docker is service docker start.

The runner is a reference to https://github.com/grounds/grounds-exec, wich is basically a socket.io server, who creates a container to run the code and returns to the web browser the output of this run.

docker-compose is in charge here of running the web app, the code runner and a redis instance.

It seems that in your case the code runner is dead.

Wich version of docker and docker-compose are you running?
Can you paste here the output of docker-compose ps after running the test suite?
Can you also past the output of docker logs groundsio_runner_1?

When docker-compose launch the task rake test, is the RUNNER_URL
properly set? (it should be automatically set if DOCKER_URL is specified).
You should have an ouput like this:

RAILS_ENV=test
  RUNNER_URL=http://<dockerhost>:8080   bundle exec rspec --format documentation --color

We don't have an IRC channel, but if you prefer, we have a slack avalaible here:
https://grounds.slack.com

docker: 1.4.1
docker-compose 1.1.0

docker-compose ps:

       Name                     Command               State     Ports   
-----------------------------------------------------------------------
groundsio_redis_1    redis-server /etc/redis/re ...   Exit 0   6379/tcp 
groundsio_runner_1   scripts/server.sh                Exit 1

docker logs goundsio_runner_1: FATA[0000] Invalid bind address format: http://192.168.1.125:4243

There are two variables DOCKER_HOST and DOCKER_URL. It looks like it was complaining about the format of DOCKER_HOST, so I changed it to 192.168.1.125:4243. Now, I get "Docker API Is not responding."

As a sanity check, http://192.168.1.125:4243/images/json responds back with a list of images. So, I believe docker is up and running fine.

Should DOCKER_HOST and DOCKER_URL always be equal (except for http/https protocol in front)?

When running rake test, RUNNER_URL is set as follows:

  RAILS_ENV=test
  RUNNER_URL=http://192.168.1.125:8080   bundle exec rspec --format documentation --color

Communicating here is fine with me - I just wanted to be sure this was the appropriate place to do so.

Yeah DOCKER_HOST should be something like tcp://ip:port, but it also works directly with a unix socket, that's why we use DOCKER_URL with format http(s)://ip:port.

Your docker configuration seems fine.

It's quite weird actually. I will investigate a bit more on this one.

I doubt it is related to the issue, but I'm running on Fedora 20 (just for reference)

Can you write the output of echo $DOCKER_HOST ? You should have semething like tcp://192.168.1.125:4243, and docker logs goundsio_runner_1 should not fail. I think docker-compose use also DOCKER_URL if it's present, but the docker client must have a valid DOCKER_HOST.

Sorry for the delayed response.

I changed from 192.168.1.125 to 127.0.0.1 to avoid any potential routing issues for now. Everything else is the same as before. Here's the last few lines again (from make run), as well as output from the echo's, and groundsio_runner_1 log output.

groundsio run --service-ports web rake run
Creating groundsio_redis_1...
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

(See full trace by running task with --trace)
make: *** [run] Error 1
[druotic@localhost grounds.io]$ docker-compose ps
       Name                     Command               State     Ports   
-----------------------------------------------------------------------
groundsio_redis_1    redis-server /etc/redis/re ...   Up       6379/tcp 
groundsio_runner_1   scripts/server.sh                Exit 1            
[druotic@localhost grounds.io]$ docker logs groundsio_runner_1
Docker API not responding.
[druotic@localhost grounds.io]$ echo $DOCKER_HOST 
tcp://127.0.0.1:4243
[druotic@localhost grounds.io]$ echo $DOCKER_URL 
http://127.0.0.1:4243

On a side note - previously (in my earlier post), the reason the output was differing between running docker as a daemon directly (docker -d) versus a service (service docker start) was because I wasn't passing docker -d the host/port info. I'm using OPTIONS='--selinux-enabled -H unix:///var/run/docker.sock -H tcp://127.0.0.1:4243' in /etc/sysconfig/docker (which is read when running as a service). I forgot these options when running docker -d. So, if I run docker -d --selinux-enabled -H unix:///var/run/docker.sock -H tcp://127.0.0.1:4243, the same result is obtained when running make run -- "No Rakefile found".

In the end, I wasn't able to get everything up and 100% functional. However, I got the pieces working that I needed to try out some experiments.

Closing this issue since it is no longer relevant.