# # Cookbook:: esh_kanboard # 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. apt_package %w( nginx php-curl php-fpm php-gd php-json php-mbstring php-sqlite3 php-xml php-zip ) cookbook_file '/etc/nginx/sites-available/default' do owner 'root' group 'root' mode '0444' notifies :restart, 'service[nginx]', :delayed action :create end directory '/var/www/kanboard' do owner 'www-data' group 'www-data' mode '0755' action :create end version = node['esh']['kanboard']['version'] url = "https://github.com/kanboard/kanboard/archive/refs/tags/v#{version}.tar.gz" remote_file "kanboard.#{version}.tar.gz" do source url path "#{Chef::Config[:file_cache_path]}/kanboard.#{version}.tar.gz" notifies :run, 'execute[extract kanboard]', :immediately end execute 'extract kanboard' do command <<~EOT tar -zxvf \ #{Chef::Config[:file_cache_path]}/kanboard.#{version}.tar.gz \ -C /var/www/kanboard kanboard-#{version}/ \ --strip-components=1 chown -R www-data:www-data /var/www/kanboard EOT action :nothing end file '/var/www/kanboard/config.php' do content node['esh']['kanboard']['config'] owner 'www-data' group 'www-data' mode '0400' action :create end service 'nginx' do action [:start, :enable] end