65 lines
1.8 KiB
Ruby
65 lines
1.8 KiB
Ruby
#
|
|
# Cookbook:: esh_writefreely
|
|
# Recipe:: install
|
|
#
|
|
# Copyright:: 2022, 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']['writefreely']['version']
|
|
url = node['esh']['writefreely']['url']
|
|
|
|
group 'writefreely' do
|
|
system true
|
|
action :create
|
|
end
|
|
|
|
user 'writefreely' do
|
|
gid 'writefreely'
|
|
home '/home/writefreely'
|
|
manage_home true
|
|
shell '/usr/sbin/nologin'
|
|
system true
|
|
action :create
|
|
end
|
|
|
|
remote_file "#{Chef::Config['file_cache_path']}/writefreely_#{version}_linux_amd64.tar.gz" do
|
|
source url
|
|
action :create_if_missing
|
|
end
|
|
|
|
archive_file "#{Chef::Config['file_cache_path']}/writefreely_#{version}_linux_amd64.tar.gz" do
|
|
destination '/home/'
|
|
owner 'writefreely'
|
|
group 'writefreely'
|
|
mode '0755'
|
|
overwrite true
|
|
not_if do
|
|
`/home/writefreely/writefreely --version | awk '{print $2}'`.strip == version
|
|
end
|
|
end
|
|
|
|
template '/home/writefreely/config.ini' do
|
|
owner 'writefreely'
|
|
group 'writefreely'
|
|
mode '0600'
|
|
variables database_password: node['esh']['writefreely']['mariadb']['password'],
|
|
site_name: node['esh']['writefreely']['app']['site_name'],
|
|
host: node['esh']['writefreely']['app']['host'],
|
|
single_user: node['esh']['writefreely']['app']['single_user']
|
|
action :create
|
|
end
|
|
|
|
esh_nginx_basic_proxy node['esh']['writefreely']['nginx']['ip_addr'] do
|
|
port node['esh']['writefreely']['nginx']['port']
|
|
end
|