Initial ipfs cookbook
Supports Ubuntu >= 15.04 * Installs ipfs * Runs the daemon as a systemd service
This commit is contained in:
55
site-cookbooks/ipfs/recipes/default.rb
Normal file
55
site-cookbooks/ipfs/recipes/default.rb
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2017, Kosmos
|
||||
#
|
||||
# All rights reserved - Do Not Redistribute
|
||||
#
|
||||
|
||||
version = node["ipfs"]["version"]
|
||||
|
||||
ark "ipfs" do
|
||||
url "https://dist.ipfs.io/go-ipfs/v#{version}/go-ipfs_v#{version}_linux-amd64.tar.gz"
|
||||
checksum node["ipfs"]["checksum"]
|
||||
has_binaries ["ipfs"]
|
||||
end
|
||||
|
||||
group "ipfs" do
|
||||
gid 4737
|
||||
end
|
||||
|
||||
user "ipfs" do
|
||||
comment "ipfs"
|
||||
uid 4737
|
||||
gid 4737
|
||||
home "/home/ipfs"
|
||||
manage_home true
|
||||
end
|
||||
|
||||
execute "ipfs init --empty-repo" do
|
||||
environment "IPFS_PATH" => "/home/ipfs/.ipfs"
|
||||
user "ipfs"
|
||||
not_if { File.directory? "/home/ipfs/.ipfs" }
|
||||
end
|
||||
|
||||
if platform?('ubuntu') && node[:platform_version].to_f >= 15.04
|
||||
service "ipfs" do
|
||||
provider Chef::Provider::Service::Systemd
|
||||
end
|
||||
|
||||
execute "systemctl daemon-reload" do
|
||||
command "systemctl daemon-reload"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
template "ipfs.systemd.service.erb" do
|
||||
path "/lib/systemd/system/ipfs.service"
|
||||
source 'ipfs.systemd.service.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :restart, "service[ipfs]", :delayed
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user