Skip to content
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

Configurable url and no ulimit warning #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,26 @@ suites:
attributes:
caddy:
features:
- cors
- git
email: [email protected]
# you cannot define two hosts but only one is a hash, there must at least be one key
hosts:
localhost:8080:
tls: 'off'
localhost:
log: /var/tmp/caddy.log
- name: github
run_list:
- recipe[caddy::default]
attributes:
caddy:
ark:
url: https://github.com/mholt/caddy/releases/download/v0.8.3/caddy_linux_amd64.tar.gz
binary_name: caddy_linux_amd64
features:
email: [email protected]
# you cannot define two hosts but only one is a hash, there must at least be one key
hosts:
localhost:8080:
tls: 'off'
localhost:
log: /var/tmp/caddy.log
7 changes: 6 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
default['caddy']['features'] = []
default['caddy']['email'] = nil
default['caddy']['hosts'] = {}
default['caddy']['ulimit'] = 4096
default['caddy']['ulimit'] = 8192
default['caddy']['ark']['url'] = "https://caddyserver.com/download/build?os=linux&arch=amd64&features=#{node['caddy']['features'].join(',')}"
default['caddy']['ark']['extension'] = 'tar.gz'
default['caddy']['ark']['binary_name'] = 'caddy'
default['caddy']['ark']['binaries'] = ["./#{node['caddy']['ark']['binary_name']}"]
default['caddy']['ark']['strip_components'] = 0
12 changes: 6 additions & 6 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
require 'chef/version_constraint'

ark 'caddy' do
url "https://caddyserver.com/download/build?os=linux&arch=amd64&features=#{node['caddy']['features'].join(',')}"
extension 'tar.gz'
has_binaries ['./caddy']
strip_components 0
url node['caddy']['ark']['url']
extension node['caddy']['ark']['extension']
has_binaries node['caddy']['ark']['binaries']
strip_components node['caddy']['ark']['strip_components']
notifies :restart, 'service[caddy]'
end

# caddy path as autogenerated by ark
caddy_path = '/usr/local/caddy-1'

execute 'setcap cap_net_bind_service=+ep caddy' do
execute "setcap cap_net_bind_service=+ep #{node['caddy']['ark']['binary_name']}" do
cwd caddy_path
action :nothing
subscribes :run, 'ark[caddy]', :immediately
Expand All @@ -49,7 +49,7 @@

variables = ({
:workdir => caddy_path,
:command => '/usr/local/bin/caddy',
:command => "/usr/local/bin/#{node['caddy']['ark']['binary_name']}",
:options => "#{caddy_letsencrypt_arguments} -pidfile /var/run/caddy.pid -log #{caddy_path}/caddy.log -conf /etc/Caddyfile",
:ulimit => node['caddy']['ulimit']
})
Expand Down