Skip to content

Commit

Permalink
Add initial apt_package recipe
Browse files Browse the repository at this point in the history
It adds the official repository, installs openresty from the package and
configures it
  • Loading branch information
gregkare committed Jul 6, 2023
1 parent db7df0f commit 0406e84
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions recipes/apt_package.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Cookbook Name:: openresty
# Recipe:: apt_package
#

openresty_dir = '/usr/local/openresty'

node.force_default['openresty']['service']['resource'] = 'service[openresty]'
node.force_default['openresty']['dir'] = '/etc/openresty'
node.force_default['openresty']['log_dir'] = "/var/log/nginx/logs/"
node.force_default['openresty']['cache_dir'] = '/var/cache/nginx'
node.force_default['openresty']['binary'] = "#{openresty_dir}/nginx/sbin/nginx"
node.force_default['openresty']['pid'] = "#{openresty_dir}/nginx/logs/nginx.pid"
# Needed to compile LuaRocks
node.force_default['openresty']['source']['prefix'] = openresty_dir

apt_repository 'openresty' do
uri "https://openresty.org/package/#{node['platform']}"
distribution node['lsb']['codename']
components ['main']
key 'https://openresty.org/package/pubkey.gpg'
end

package 'openresty'

service 'openresty' do
supports :status => true, :restart => true, :reload => true
if node['openresty']['service']['start_on_boot']
action [ :enable, :start ]
end
end

include_recipe 'openresty::ohai_plugin'
include_recipe 'openresty::commons_user'
include_recipe 'openresty::commons_dir'
include_recipe 'openresty::commons_script'
include_recipe 'openresty::commons_conf'
include_recipe 'openresty::luarocks'

0 comments on commit 0406e84

Please sign in to comment.