Sonoma::Remote
Manage Docker-based apps on remote servers.
Installation
gem "sonoma-remote"
load "sonoma/remote/tasks/all.rake"
Sonoma::Deploy.configure!({
application: "your_app_name",
docker_registry: "host_of_registry",
docker_repository: "path_in_docker_registry",
user: "your_deploy_user"
})
lock "{capistrano-version}"
server("localhost", { roles: %W{app db worker}, user: fetch(:user), primary: true })
Configuration
load "sonoma/remote/tasks/all.rake"
Sonoma::Deploy.required_config
Sonoma::Deploy.optional_config
Sample
load "sonoma/remote/tasks/all.rake"
verify = ->(host) do
deployed_correct_version = false;
on(host) do
response = capture("curl", "localhost/status")
json_response = JSON.parse(response)
deployed_correct_version = (json_response["revision"] == fetch(:revision))
end
deployed_correct_version
end
docker_options = -> {[
"-e HOSTS_IN_ENVIRONMENT=[#{roles(:app).collect(&:hostname).join(",")}]",
"-v /var/groupon/#{fetch(:application)}/log:/usr/src/app/log",
"-v /var/groupon/#{fetch(:application)}/config/local:/usr/src/app/config/local"
]}
Sonoma::Remote.configure!({
application: "gstream",
docker_options: docker_options,
docker_registry: "docker.groupondev.com",
docker_repository: "grpn_stream/gstream",
load_balancer_delay: 3,
server_boot_time: 3,
user: "gstream_deploy",
verify: verify
})