-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#60 in docker - more clear #148
Conversation
If in docker and if the `runsvdir` process is running, we can wait for the service directory to be initialized by `runsvdir.` (To avoid the error: `warning: /etc/service/{service_name}: unable to open supervise/ok: file does not exist`). It is not enough to check only `supervise/ok` and `log/supervise/ok` files, we also need to wait for `runsv` process. (To avoid the error `fail: {service_name}: runsv not running`).
Unfortunately I had to run `apt-get update` in phusion ubuntu baseimage and I couldn't put it in .kitchen.yml (under `driver_config` section).
This is known, the standard Runit packages all use Upstart or Systemd to launch runsvdir, so when runsvdir doesn't exist the sv command can't do much. |
Is there any reason why this won't get merged? As far as I understand It does not break anything, only fixes runit in docker. |
@tomzo @xmik this will need a rebase before we can consider merging it. As for any perceived delay, we recently undertook a very large effort to resolve an overly complex change set for this cookbook. We absolutely had to get that out of the way before we could consider additional PRs. Now that that is done, I expect we can review this sometime soon, provided it is rebased to be mergeable. |
Is this still being considered for a merge? Would love to see this in so we can use it in docker based CI setups with phusion baseimage and the like... :-) |
@tknerr please see: #148 (comment) We'll absolutely consider it once it is mergeable. |
For anyone that wants to try this now, |
@luckymike sorry I overread that @xmik would be awesome to have that rebased, since this is really essential when integration testing cookbooks that use runit on docker based build systems (e.g. CircleCI) @coderanger thanks for the pointer, will give it a try! |
(this will probably break usage for `docker build`, but should work for usage in phusion baseimage and the like)
@tknerr @luckymike @coderanger I rebased #60_in_docker_better branch against develop branch. The rebased branch is called #60_in_docker_better_rebased. I tested it with Test-Kitchen on ubuntu 14.04 docker container and debian-7.8 virtual machine. Same as previously, there is 1 error when running Failures:
1) runit_test::service on {:family=>"ubuntu", :release=>"14.04", :arch=>"x86_64"} behaves like common runit_test services creates a service that uses the default svlog Command "file /var/log/default-svlog/*.s" stdout should contain "gzip compressed data"
Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
expected "/var/log/default-svlog/*.s: ERROR: cannot open `/var/log/default-svlog/*.s' (No such file or directory)\n" to contain "gzip compressed data"
/bin/sh -c file\ /var/log/default-svlog/\*.s
/var/log/default-svlog/*.s: ERROR: cannot open `/var/log/default-svlog/*.s' (No such file or directory)
Shared Example Group: "common runit_test services" called from /tmp/verifier/suites/serverspec/linux_spec.rb:50
# /tmp/verifier/suites/serverspec/service_example_groups.rb:45:in `block (4 levels) in <top (required)>'
Finished in 4.05 seconds (files took 0.93268 seconds to load)
125 examples, 1 failure Also, I know I should have stubbed method |
@xmik thanks for the new PR. From you comments here and @coderanger's above, it sounds like the above is an expected failure. Am I correct that this is totally, 100% innocuous in Docker-land? If so, would the correct test resolution be a guard to not attempt that in the Docker context? Thanks! |
@luckymike, I think @coderanger wasn't talking at all about the test-kitchen failure. Rather he was saying why The failure happened for me inside docker container with ubuntu and inside virtual machine with debian 7.8 too (I should have written that before). I don't know if this failure is introduced by my PR. |
Closing in favor of #193 |
This is a better, more clear version of that PR, which you can ignore
Resolved errors
When running in Docker container I ran into those errors:
STDOUT: warning: /etc/service/<service_name>: unable to open supervise/ok: file does not exist
. Thus I changed the methodwait_for_service
so that it waits for that file:supervise/ok
not only in vm, but also in Docker container. The ruby_block that invokes this method is idempotent and does not go into infinite loop (because of the check ifrunsvdir
process is running (== monitoring a directory with services files)). (runit_service enable failing in docker #60)"fail: <service_name>: runsv not running"
. It shows that it's not enough to check ifsupervise/ok
exists and thus I added another check, ifrunsv
process is running (== monitoring that one service). Only then the service can be correctly started.When using
runit_service
resource in docker container instantiated from Phusion Baseimage, it was enough for me to use onlyaction :enable
(withoutaction: start
), because therunsvdir
is running and should result in starting that service anyway. Using alsoaction :start
works too.Checking, if
runsvdir
process is running, is crucial in Docker container, because when runningkitchen converge
, that process is running, but it is not when runningdocker build
.Tests
I added the Docker platform in
.kitchen.yml
for integration tests, usingkitchen-docker_cli
kitchen driver (no ssh here). I ran the tests in Docker container and also in Debian 7.8 virtual machine. In each case there was 1 error:Conclusion
There are comments in code, so I assume no more explanation is needed here.
I depended on this in other cookbooks and it worked.