diff --git a/site-cookbooks/ipfs/CHANGELOG.md b/site-cookbooks/ipfs/CHANGELOG.md new file mode 100644 index 0000000..988d28a --- /dev/null +++ b/site-cookbooks/ipfs/CHANGELOG.md @@ -0,0 +1,11 @@ +# ipfs CHANGELOG + +This file is used to list changes made in each version of the ipfs cookbook. + +## 0.1.0 +- [your_name] - Initial release of ipfs + +- - - +Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. + +The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. diff --git a/site-cookbooks/ipfs/README.md b/site-cookbooks/ipfs/README.md new file mode 100644 index 0000000..5bf9fd4 --- /dev/null +++ b/site-cookbooks/ipfs/README.md @@ -0,0 +1,80 @@ +# ipfs Cookbook + +TODO: Enter the cookbook description here. + +e.g. +This cookbook makes your favorite breakfast sandwich. + +## Requirements + +TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc. + +e.g. +### Platforms + +- SandwichOS + +### Chef + +- Chef 12.0 or later + +### Cookbooks + +- `toaster` - ipfs needs toaster to brown your bagel. + +## Attributes + +TODO: List your cookbook attributes here. + +e.g. +### ipfs::default + + + + + + + + + + + + + + +
KeyTypeDescriptionDefault
['ipfs']['bacon']Booleanwhether to include bacontrue
+ +## Usage + +### ipfs::default + +TODO: Write usage instructions for each cookbook. + +e.g. +Just include `ipfs` in your node's `run_list`: + +```json +{ + "name":"my_node", + "run_list": [ + "recipe[ipfs]" + ] +} +``` + +## Contributing + +TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section. + +e.g. +1. Fork the repository on Github +2. Create a named feature branch (like `add_component_x`) +3. Write your change +4. Write tests for your change (if applicable) +5. Run the tests, ensuring they all pass +6. Submit a Pull Request using Github + +## License and Authors + +Authors: TODO: List authors + diff --git a/site-cookbooks/ipfs/attributes/default.rb b/site-cookbooks/ipfs/attributes/default.rb new file mode 100644 index 0000000..f565585 --- /dev/null +++ b/site-cookbooks/ipfs/attributes/default.rb @@ -0,0 +1,2 @@ +node.default['ipfs']['version'] = "0.4.5" +node.default['ipfs']['checksum'] = "2d3b937596eeea98230adf9f60b2f55fdb8701a0ad50936185fe8855ba96fd46" diff --git a/site-cookbooks/ipfs/metadata.rb b/site-cookbooks/ipfs/metadata.rb new file mode 100644 index 0000000..cac927a --- /dev/null +++ b/site-cookbooks/ipfs/metadata.rb @@ -0,0 +1,11 @@ +name 'ipfs' +maintainer 'Kosmos' +maintainer_email 'mail@kosmos.org' +license 'All rights reserved' +description 'Installs/Configures ipfs' +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +version '0.1.0' + +supports ['ubuntu', 'debian'] + +depends 'ark' diff --git a/site-cookbooks/ipfs/recipes/default.rb b/site-cookbooks/ipfs/recipes/default.rb new file mode 100644 index 0000000..188957f --- /dev/null +++ b/site-cookbooks/ipfs/recipes/default.rb @@ -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 diff --git a/site-cookbooks/ipfs/templates/default/ipfs.systemd.service.erb b/site-cookbooks/ipfs/templates/default/ipfs.systemd.service.erb new file mode 100644 index 0000000..2217b29 --- /dev/null +++ b/site-cookbooks/ipfs/templates/default/ipfs.systemd.service.erb @@ -0,0 +1,11 @@ +[Unit] +Description=Start ipfs + +[Service] +ExecStart=/usr/local/bin/ipfs daemon +User=ipfs +Group=ipfs +Restart=always + +[Install] +WantedBy=multi-user.target