Archive abandoned project
This commit is contained in:
parent
bc8862d90b
commit
65be894048
501 changed files with 24305 additions and 0 deletions
17
esh_webhook/recipes/default.rb
Normal file
17
esh_webhook/recipes/default.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# Cookbook:: esh_webhook
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright:: 2023, https://easyself.host
|
||||
#
|
||||
# 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.
|
72
esh_webhook/recipes/service.rb
Normal file
72
esh_webhook/recipes/service.rb
Normal file
|
@ -0,0 +1,72 @@
|
|||
#
|
||||
# Cookbook:: esh_webhook
|
||||
# Recipe:: service
|
||||
#
|
||||
# Copyright:: 2023, https://easyself.host
|
||||
#
|
||||
# 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.
|
||||
|
||||
version = node['esh']['webhook']['service']['version']
|
||||
url = "https://github.com/adnanh/webhook/releases/download/#{version}/webhook-linux-amd64.tar.gz"
|
||||
|
||||
remote_file "webhook.#{version}.tar.gz" do
|
||||
source url
|
||||
path "#{Chef::Config[:file_cache_path]}/webhook.#{version}.tar.gz"
|
||||
notifies :run, 'execute[extract webhook]', :immediately
|
||||
end
|
||||
|
||||
execute 'extract webhook' do
|
||||
command <<~EOT
|
||||
tar -zxvf \
|
||||
#{Chef::Config[:file_cache_path]}/webhook.#{version}.tar.gz \
|
||||
-C /usr/local/bin webhook-linux-amd64/webhook \
|
||||
--strip-components=1
|
||||
EOT
|
||||
action :nothing
|
||||
end
|
||||
|
||||
cookbook_file '/usr/local/bin/webhook.sh' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
template '/etc/webhook/hooks.json' do
|
||||
owner 'webhook'
|
||||
group 'webhook'
|
||||
mode '0400'
|
||||
variables secret: node['esh']['webhook']['service']['hook_secret']
|
||||
action :create
|
||||
end
|
||||
|
||||
systemd_unit 'webhook.service' do
|
||||
content <<~EOU
|
||||
[Unit]
|
||||
Description=Webhook service
|
||||
|
||||
[Service]
|
||||
User=webhook
|
||||
Group=webhook
|
||||
ExecStart=/usr/local/bin/webhook -hooks /etc/webhook/hooks.json -debug
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOU
|
||||
action :create
|
||||
end
|
||||
|
||||
service 'webhook' do
|
||||
action [:enable, :start]
|
||||
subscribes :restart, 'template[/etc/webhook/hooks.json]', :delayed
|
||||
end
|
38
esh_webhook/recipes/system.rb
Normal file
38
esh_webhook/recipes/system.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# Cookbook:: esh_webhook
|
||||
# Recipe:: system
|
||||
#
|
||||
# Copyright:: 2023, https://easyself.host
|
||||
#
|
||||
# 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.
|
||||
|
||||
group 'webhook' do
|
||||
system true
|
||||
action :create
|
||||
end
|
||||
|
||||
user 'webhook' do
|
||||
comment 'webhook system user'
|
||||
gid 'webhook'
|
||||
home '/'
|
||||
shell '/sbin/nologin'
|
||||
system true
|
||||
action :create
|
||||
end
|
||||
|
||||
directory '/etc/webhook' do
|
||||
owner 'webhook'
|
||||
group 'webhook'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
Reference in a new issue