Skip to content

Commit

Permalink
Merge pull request #8 from ismell/2014-updates
Browse files Browse the repository at this point in the history
2014 updates
  • Loading branch information
ismell committed May 12, 2014
2 parents 00959ee + 2129199 commit c1e8cd9
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ License and Author

Author:: Raul E Rangel (<[email protected]>)

Copyright 2013, Raul E Rangel.
Copyright 2014, Raul E Rangel.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#

default['docker-registry']['repository'] = "https://github.com/dotcloud/docker-registry.git"
default['docker-registry']['revision'] = "0.6.3"
default['docker-registry']['revision'] = "0.6.8"

default['docker-registry']['install_dir'] = "/opt/docker-registry"

Expand All @@ -32,7 +32,7 @@
default['docker-registry']['workers'] = 8
default['docker-registry']['max_requests'] = 100
default['docker-registry']['timeout'] = 3600
default['docker-registry']['packages'] = %w(libevent-dev git)
default['docker-registry']['packages'] = %w(libevent-dev git libffi-dev liblzma-dev)

default['docker-registry']['flavor'] = 'dev'
default['docker-registry']['secret_key'] = nil
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email "[email protected]"
license "Apache 2.0"
description "Installs and configures docker-registry"
version "0.0.4dev"
version "0.0.5"

recipe "docker-registry", "Installs the docker-registry and sets up configuration"

Expand Down
23 changes: 23 additions & 0 deletions recipes/application_server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Cookbook Name:: docker-registry
# Recipe:: application_server
# Author:: Raul E Rangel (<[email protected]>)
#
# Copyright 2014, Raul E Rangel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

node.default['docker-registry']['application_server'] = true

include_recipe "docker-registry"
21 changes: 16 additions & 5 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@

raise ArgumentError, "secret_key is not defined" unless secret_key

# Make sure we create the env directory before gunicorn
[node['docker-registry']['install_dir'], ::File.join(node['docker-registry']['install_dir'], "env")].each do |path|
directory path do
owner node['docker-registry']['owner']
group node['docker-registry']['group']
mode 00755
end
end

application "docker-registry" do
owner node['docker-registry']['owner']
group node['docker-registry']['group']
Expand All @@ -93,8 +102,10 @@
revision node['docker-registry']['revision']
packages node['docker-registry']['packages']

shallow_clone false

action :force_deploy
symlinks "config.yml" => "config.yml"
symlinks "config.yml" => "config/config.yml"

before_migrate do
template "#{new_resource.path}/shared/config.yml" do
Expand All @@ -103,11 +114,11 @@
owner node['docker-registry']['owner']
group node['docker-registry']['group']
variables({
:secret_key => secret_key,
:secret_key => secret_key,
:storage => node['docker-registry']['storage'],
:storage_path => node['docker-registry']['storage_path'],
:standalone => node['docker-registry']['standalone'],
:index_endpoint => node['docker-registry']['index_endpoint'],
:index_endpoint => node['docker-registry']['index_endpoint'],
:s3_access_key => node['docker-registry']['s3_access_key'],
:s3_secret_key => s3_secret_key,
:s3_bucket => node['docker-registry']['s3_bucket'],
Expand All @@ -116,7 +127,7 @@
end

gunicorn do
only_if { node['roles'].include?('docker-registry_application_server') }
only_if { node['docker-registry']['application_server'] }

requirements "requirements.txt"
max_requests node['docker-registry']['max_requests']
Expand All @@ -130,7 +141,7 @@
end

nginx_load_balancer do
only_if { node['roles'].include?('docker-registry_load_balancer') }
only_if { node['docker-registry']['load_balancer'] }

application_port node['docker-registry']['internal_port']
application_server_role node['docker-registry']['application_server_role']
Expand Down
23 changes: 23 additions & 0 deletions recipes/load_balancer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Cookbook Name:: docker-registry
# Recipe:: load_balancer
# Author:: Raul E Rangel (<[email protected]>)
#
# Copyright 2014, Raul E Rangel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

node.default['docker-registry']['load_balancer'] = true

include_recipe "docker-registry"
2 changes: 1 addition & 1 deletion roles/docker-registry_application_server.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"chef_type": "role",
"run_list": [
"recipe[docker-registry]"
"recipe[docker-registry::application_server]"
],
"env_run_lists": {
}
Expand Down
2 changes: 1 addition & 1 deletion roles/docker-registry_load_balancer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"chef_type": "role",
"run_list": [
"recipe[docker-registry]"
"recipe[docker-registry::load_balancer]"
],
"env_run_lists": {
}
Expand Down

0 comments on commit c1e8cd9

Please sign in to comment.