Initial ipfs cookbook
Supports Ubuntu >= 15.04 * Installs ipfs * Runs the daemon as a systemd service
This commit is contained in:
		
							parent
							
								
									af1718e44a
								
							
						
					
					
						commit
						f4e288645d
					
				
							
								
								
									
										11
									
								
								site-cookbooks/ipfs/CHANGELOG.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								site-cookbooks/ipfs/CHANGELOG.md
									
									
									
									
									
										Normal file
									
								
							| @ -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. | ||||
							
								
								
									
										80
									
								
								site-cookbooks/ipfs/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								site-cookbooks/ipfs/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
| 
 | ||||
| <table> | ||||
|   <tr> | ||||
|     <th>Key</th> | ||||
|     <th>Type</th> | ||||
|     <th>Description</th> | ||||
|     <th>Default</th> | ||||
|   </tr> | ||||
|   <tr> | ||||
|     <td><tt>['ipfs']['bacon']</tt></td> | ||||
|     <td>Boolean</td> | ||||
|     <td>whether to include bacon</td> | ||||
|     <td><tt>true</tt></td> | ||||
|   </tr> | ||||
| </table> | ||||
| 
 | ||||
| ## 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 | ||||
| 
 | ||||
							
								
								
									
										2
									
								
								site-cookbooks/ipfs/attributes/default.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								site-cookbooks/ipfs/attributes/default.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| node.default['ipfs']['version'] = "0.4.5" | ||||
| node.default['ipfs']['checksum'] = "2d3b937596eeea98230adf9f60b2f55fdb8701a0ad50936185fe8855ba96fd46" | ||||
							
								
								
									
										11
									
								
								site-cookbooks/ipfs/metadata.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								site-cookbooks/ipfs/metadata.rb
									
									
									
									
									
										Normal file
									
								
							| @ -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' | ||||
							
								
								
									
										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 | ||||
| @ -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 | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user