Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
c1c08b1ced | |||
8f3b79d7f0 | |||
ee0c6f7de0 | |||
d7c25b6ce5 | |||
9f430fa6d2 | |||
05a04ac832 | |||
2dfbc073ed | |||
e2c00c2afb | |||
|
b3b03a9744 | ||
|
d845e3443a | ||
|
ae5a27d100 | ||
|
200552d1b7 | ||
|
856b48d015 | ||
|
9fd88a7da3 | ||
|
2552847d7e | ||
|
b6028ffff8 | ||
|
f25802a6ce | ||
5c31191ff8 | |||
|
7dc20eea12 | ||
|
1d09c15108 | ||
|
79a12165a2 | ||
0c6416f9c7 | |||
|
7b524204c8 | ||
|
f118a954fa | ||
|
468b6d9a9d | ||
|
679f78d248 | ||
|
9cdbf6d947 | ||
|
0e6ac38434 | ||
|
d54e962926 | ||
|
95e92a0703 | ||
3d4e9cceea | |||
|
cfa3435c40 | ||
|
01c2246454 | ||
|
b2c7416087 | ||
|
6d31746a87 | ||
|
18d04d68fd | ||
|
ddad121924 | ||
|
ae97c0d739 | ||
|
553ec510eb | ||
c6a0159e82 | |||
|
5aa50ecc7e | ||
|
f22b7d9b1f | ||
|
5303612854 | ||
|
76d60b87dd | ||
|
c6853c4d09 | ||
|
78d3edfd78 |
@ -13,12 +13,10 @@ provisioner:
|
|||||||
|
|
||||||
verifier:
|
verifier:
|
||||||
name: inspec
|
name: inspec
|
||||||
|
root_path: '/opt/verifier' # Needed for the specs to be detected in Docker
|
||||||
|
chef_license: accept
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: ubuntu-16.04
|
|
||||||
driver:
|
|
||||||
image: dokken/ubuntu-16.04
|
|
||||||
pid_one_command: /bin/systemd
|
|
||||||
- name: ubuntu-18.04
|
- name: ubuntu-18.04
|
||||||
driver:
|
driver:
|
||||||
image: dokken/ubuntu-18.04
|
image: dokken/ubuntu-18.04
|
||||||
@ -33,8 +31,3 @@ suites:
|
|||||||
run_list:
|
run_list:
|
||||||
- recipe[ipfs::default]
|
- recipe[ipfs::default]
|
||||||
attributes:
|
attributes:
|
||||||
- name: cluster
|
|
||||||
run_list:
|
|
||||||
- recipe[ipfs::cluster]
|
|
||||||
- recipe[ipfs::cluster_service]
|
|
||||||
attributes:
|
|
||||||
|
@ -6,17 +6,14 @@ provisioner:
|
|||||||
name: chef_zero
|
name: chef_zero
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: ubuntu-16.04
|
|
||||||
- name: ubuntu-18.04
|
- name: ubuntu-18.04
|
||||||
- name: debian-9
|
- name: debian-9
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
chef_license: accept
|
||||||
|
|
||||||
suites:
|
suites:
|
||||||
- name: default
|
- name: default
|
||||||
run_list:
|
run_list:
|
||||||
- recipe[ipfs::default]
|
- recipe[ipfs::default]
|
||||||
attributes:
|
attributes:
|
||||||
- name: cluster
|
|
||||||
run_list:
|
|
||||||
- recipe[ipfs::cluster]
|
|
||||||
- recipe[ipfs::cluster_service]
|
|
||||||
attributes:
|
|
||||||
|
@ -20,20 +20,19 @@ services: docker
|
|||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- INSTANCE=default-debian-9
|
- INSTANCE=default-debian-9
|
||||||
- INSTANCE=default-ubuntu-1604
|
|
||||||
- INSTANCE=default-ubuntu-1804
|
- INSTANCE=default-ubuntu-1804
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
|
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
|
||||||
- eval "$(chef shell-init bash)"
|
- eval "$(chef shell-init bash)"
|
||||||
- chef --version
|
- CHEF_LICENSE=accept-no-persist chef --version
|
||||||
- cookstyle --version
|
- cookstyle --version
|
||||||
- foodcritic --version
|
- foodcritic --version
|
||||||
|
|
||||||
script: KITCHEN_LOCAL_YAML=.kitchen.dokken.yml CHEF_VERSION=13.10.4 kitchen verify ${INSTANCE}
|
script: CHEF_LICENSE=accept-no-persist KITCHEN_LOCAL_YAML=.kitchen.dokken.yml kitchen test ${INSTANCE}
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- script:
|
- script:
|
||||||
- chef exec delivery local all
|
- CHEF_LICENSE=accept-no-persist chef exec delivery local all
|
||||||
env: UNIT_AND_LINT=1
|
env: UNIT_AND_LINT=1
|
||||||
|
@ -10,7 +10,7 @@ GRAPH
|
|||||||
build-essential (8.1.1)
|
build-essential (8.1.1)
|
||||||
mingw (>= 1.1)
|
mingw (>= 1.1)
|
||||||
seven_zip (>= 0.0.0)
|
seven_zip (>= 0.0.0)
|
||||||
ipfs (0.1.0)
|
ipfs (0.4.2)
|
||||||
ark (>= 0.0.0)
|
ark (>= 0.0.0)
|
||||||
mingw (2.1.0)
|
mingw (2.1.0)
|
||||||
seven_zip (>= 0.0.0)
|
seven_zip (>= 0.0.0)
|
||||||
|
20
README.md
20
README.md
@ -1,23 +1,23 @@
|
|||||||
# ipfs Cookbook
|
# IPFS Cookbook
|
||||||
|
|
||||||
This cookbook installs ipfs and starts it as a daemon
|
This cookbook installs go-ipfs and starts it as a daemon
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
### Platforms
|
### Platforms
|
||||||
|
|
||||||
This cookbook is tested on Ubuntu 16.06, 14.04 and Debian 8 using Test Kitchen.
|
This cookbook is tested on Ubuntu 18.06, 16.04 and Debian 9 using Test Kitchen.
|
||||||
It currently only supports 64bit platforms
|
It currently only supports 64bit platforms
|
||||||
|
|
||||||
### Chef
|
### Chef
|
||||||
|
|
||||||
- Chef 12.5 or later (we are providing a
|
- Chef 12.5 or later (the cookbook provides a
|
||||||
[Custom Resource](https://docs.chef.io/custom_resources.html) to configure
|
[Custom Resource](https://docs.chef.io/custom_resources.html) to configure
|
||||||
IPFS)
|
go-ipfs)
|
||||||
|
|
||||||
### Cookbook dependencies
|
### Cookbook dependencies
|
||||||
|
|
||||||
- `ark` to download and uncompress the Go IPFS package
|
- `ark` to download and uncompress the go-ipfs package
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -36,12 +36,10 @@ Just include `ipfs` in your node's `run_list`:
|
|||||||
|
|
||||||
## Attributes
|
## Attributes
|
||||||
|
|
||||||
- `node.['ipfs']['version']` - the Go IPFS version to download from the official
|
- `node['ipfs']['version']` - the go-ipfs version to download from the official
|
||||||
site (64bit)
|
site (64bit)
|
||||||
- `node['ipfs']['checksum']` - the SHA256 checksum for the package
|
- `node['ipfs']['checksum']` - the SHA256 checksum for the package
|
||||||
- `node['ipfs']['config']['swarm']['addr_filter']` - the network ranges to not
|
- `node['ipfs']['config']` - a hash of config options
|
||||||
connect to. This will stop platforms like Hetzner to block your server
|
|
||||||
(https://github.com/ipfs/go-ipfs/issues/1226)
|
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
@ -67,7 +65,7 @@ kitchen verify # Run the integration tests for Ubuntu 16.04, 18.06 and Debian 9
|
|||||||
## License and Authors
|
## License and Authors
|
||||||
|
|
||||||
Authors: Kosmos Developers mail@kosmos.org
|
Authors: Kosmos Developers mail@kosmos.org
|
||||||
Copyright: 2018, [Kosmos Developers](https://kredits.kosmos.org/)
|
Copyright: 2018-2019, [Kosmos Developers](https://kredits.kosmos.org/)
|
||||||
|
|
||||||
```
|
```
|
||||||
Unless otherwise noted, all files are released under the MIT license, possible
|
Unless otherwise noted, all files are released under the MIT license, possible
|
||||||
|
@ -1,7 +1,31 @@
|
|||||||
node.default['ipfs']['version'] = '0.4.17'
|
node.default['ipfs']['version'] = '0.12.2'
|
||||||
node.default['ipfs']['checksum'] = '1bb1050ebe74f9042ac721eb1b71f92e1b0e78e54c59dadfde13080facb2901c'
|
node.default['ipfs']['checksum'] = 'd1b376fe1fb081631af773ea05632090dd79ae5a0057f8b8a0202c28b64a966d14bbfde768ce5a993745761ce56ceed6323a6bd1714f9ae71fa4d68fcbeb1dbb'
|
||||||
# Do not contact local network addresses. This will stop platforms like Hetzner
|
|
||||||
# to block your server (https://github.com/ipfs/go-ipfs/issues/1226)
|
|
||||||
node.default['ipfs']['config']['swarm']['addr_filter'] = ['/ip4/10.0.0.0/ipcidr/8', '/ip4/100.64.0.0/ipcidr/10', '/ip4/169.254.0.0/ipcidr/16', '/ip4/172.16.0.0/ipcidr/12', '/ip4/192.0.0.0/ipcidr/24', '/ip4/192.0.0.0/ipcidr/29', '/ip4/192.0.0.8/ipcidr/32', '/ip4/192.0.0.170/ipcidr/32', '/ip4/192.0.0.171/ipcidr/32', '/ip4/192.0.2.0/ipcidr/24', '/ip4/192.168.0.0/ipcidr/16', '/ip4/198.18.0.0/ipcidr/15', '/ip4/198.51.100.0/ipcidr/24', '/ip4/203.0.113.0/ipcidr/24', '/ip4/240.0.0.0/ipcidr/4']
|
|
||||||
|
|
||||||
node.default['ipfs']['cluster']['version'] = '0.4.0'
|
node.default['ipfs']['ulimit'] = 64000
|
||||||
|
node.default['ipfs']['memory_max'] = '512M'
|
||||||
|
node.default['ipfs']['config'] = {
|
||||||
|
# Do not contact local network addresses. This will stop platforms like Hetzner
|
||||||
|
# to block your server (https://github.com/ipfs/go-ipfs/issues/1226)
|
||||||
|
'Swarm.AddrFilters' => ['/ip4/10.0.0.0/ipcidr/8',
|
||||||
|
'/ip4/100.64.0.0/ipcidr/10',
|
||||||
|
'/ip4/169.254.0.0/ipcidr/16',
|
||||||
|
'/ip4/172.16.0.0/ipcidr/12',
|
||||||
|
'/ip4/192.0.0.0/ipcidr/24',
|
||||||
|
'/ip4/192.0.0.0/ipcidr/29',
|
||||||
|
'/ip4/192.0.0.8/ipcidr/32',
|
||||||
|
'/ip4/192.0.0.170/ipcidr/32',
|
||||||
|
'/ip4/192.0.0.171/ipcidr/32',
|
||||||
|
'/ip4/192.0.2.0/ipcidr/24',
|
||||||
|
'/ip4/192.168.0.0/ipcidr/16',
|
||||||
|
'/ip4/198.18.0.0/ipcidr/15',
|
||||||
|
'/ip4/198.51.100.0/ipcidr/24',
|
||||||
|
'/ip4/203.0.113.0/ipcidr/24',
|
||||||
|
'/ip4/240.0.0.0/ipcidr/4'],
|
||||||
|
# Set up the Gateway to be writable
|
||||||
|
'Gateway.Writable' => true,
|
||||||
|
|
||||||
|
# Set up CORS headers
|
||||||
|
'API.HTTPHeaders.Access-Control-Allow-Credentials' => ['true'],
|
||||||
|
'API.HTTPHeaders.Access-Control-Allow-Methods' => %w(PUT GET POST),
|
||||||
|
'API.HTTPHeaders.Access-Control-Allow-Origin' => ['*'],
|
||||||
|
}
|
||||||
|
@ -2,9 +2,9 @@ name 'ipfs'
|
|||||||
maintainer 'Kosmos Developers'
|
maintainer 'Kosmos Developers'
|
||||||
maintainer_email 'mail@kosmos.org'
|
maintainer_email 'mail@kosmos.org'
|
||||||
license 'MIT'
|
license 'MIT'
|
||||||
description 'Installs/Configures ipfs'
|
description 'Installs/Configures go-ipfs'
|
||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version '0.1.1'
|
version '0.8.0'
|
||||||
|
|
||||||
supports %w(ubuntu debian)
|
supports %w(ubuntu debian)
|
||||||
|
|
||||||
|
@ -2,27 +2,6 @@
|
|||||||
# Cookbook Name:: ipfs
|
# Cookbook Name:: ipfs
|
||||||
# Recipe:: _user
|
# Recipe:: _user
|
||||||
#
|
#
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright:: 2018, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
group 'ipfs' do
|
group 'ipfs' do
|
||||||
gid 4737
|
gid 4737
|
||||||
@ -33,5 +12,6 @@ user 'ipfs' do
|
|||||||
uid 4737
|
uid 4737
|
||||||
gid 4737
|
gid 4737
|
||||||
home '/home/ipfs'
|
home '/home/ipfs'
|
||||||
|
shell '/bin/bash'
|
||||||
manage_home true
|
manage_home true
|
||||||
end
|
end
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
#
|
|
||||||
# Cookbook Name:: ipfs
|
|
||||||
# Recipe:: cluster
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright:: 2018, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
include_recipe 'ipfs::_user'
|
|
||||||
|
|
||||||
version = node['ipfs']['cluster']['version']
|
|
||||||
|
|
||||||
ark 'ipfs-cluster-service' do
|
|
||||||
url "https://dist.ipfs.io/ipfs-cluster-service/v#{version}/ipfs-cluster-service_v#{version}_linux-amd64.tar.gz"
|
|
||||||
has_binaries ['ipfs-cluster-service']
|
|
||||||
end
|
|
||||||
|
|
||||||
ark 'ipfs-cluster-ctl' do
|
|
||||||
url "https://dist.ipfs.io/ipfs-cluster-ctl/v#{version}/ipfs-cluster-ctl_v#{version}_linux-amd64.tar.gz"
|
|
||||||
has_binaries ['ipfs-cluster-ctl']
|
|
||||||
end
|
|
||||||
|
|
||||||
credentials = data_bag_item('credentials', 'ipfs_cluster')
|
|
||||||
|
|
||||||
execute 'ipfs-cluster-service init' do
|
|
||||||
user 'ipfs'
|
|
||||||
environment 'CLUSTER_SECRET' => credentials['secret'],
|
|
||||||
'IPFS_CLUSTER_PATH' => '/home/ipfs/.ipfs-cluster'
|
|
||||||
not_if { File.exist? '/home/ipfs/.ipfs-cluster/service.json' }
|
|
||||||
end
|
|
@ -1,33 +0,0 @@
|
|||||||
#
|
|
||||||
# Cookbook Name:: ipfs
|
|
||||||
# Recipe:: cluster_bootstrap
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright:: 2018, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
include_recipe 'ipfs::_user'
|
|
||||||
|
|
||||||
execute "ipfs-cluster-service daemon --bootstrap #{peer}" do
|
|
||||||
user 'ipfs'
|
|
||||||
environment 'IPFS_CLUSTER_PATH' => '/home/ipfs/.ipfs-cluster'
|
|
||||||
not_if { File.exist? '/home/ipfs/.ipfs-cluster/service.json' }
|
|
||||||
end
|
|
@ -1,64 +0,0 @@
|
|||||||
#
|
|
||||||
# Cookbook Name:: ipfs
|
|
||||||
# Recipe:: cluster_service
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright:: 2018, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
if platform?('ubuntu') && node['platform_version'].to_f < 15.04 ||
|
|
||||||
platform?('debian') && node['platform_version'].to_f < 8
|
|
||||||
template 'ipfs.initd-cluster.service.erb' do
|
|
||||||
path '/etc/init.d/ipfs-cluster'
|
|
||||||
source 'ipfs-cluster.initd.service.erb'
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0750'
|
|
||||||
notifies :restart, 'service[ipfs-cluster]', :delayed
|
|
||||||
end
|
|
||||||
|
|
||||||
service 'ipfs-cluster' do
|
|
||||||
provider Chef::Provider::Service::Init::Debian
|
|
||||||
action [:enable]
|
|
||||||
supports start: true, stop: true, restart: true, reload: false, status: true
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
execute 'systemctl daemon-reload' do
|
|
||||||
command 'systemctl daemon-reload'
|
|
||||||
action :nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
template 'ipfs-cluster.systemd.service.erb' do
|
|
||||||
path '/lib/systemd/system/ipfs-cluster.service'
|
|
||||||
source 'ipfs-cluster.systemd.service.erb'
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0644'
|
|
||||||
notifies :run, 'execute[systemctl daemon-reload]', :delayed
|
|
||||||
notifies :restart, 'service[ipfs-cluster]', :delayed
|
|
||||||
end
|
|
||||||
|
|
||||||
service 'ipfs-cluster' do
|
|
||||||
provider Chef::Provider::Service::Systemd
|
|
||||||
action [:enable]
|
|
||||||
end
|
|
||||||
end
|
|
@ -2,27 +2,6 @@
|
|||||||
# Cookbook Name:: ipfs
|
# Cookbook Name:: ipfs
|
||||||
# Recipe:: default
|
# Recipe:: default
|
||||||
#
|
#
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright:: 2018, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
include_recipe 'ipfs::_user'
|
include_recipe 'ipfs::_user'
|
||||||
|
|
||||||
@ -32,6 +11,7 @@ ark 'ipfs' do
|
|||||||
url "https://dist.ipfs.io/go-ipfs/v#{version}/go-ipfs_v#{version}_linux-amd64.tar.gz"
|
url "https://dist.ipfs.io/go-ipfs/v#{version}/go-ipfs_v#{version}_linux-amd64.tar.gz"
|
||||||
checksum node['ipfs']['checksum']
|
checksum node['ipfs']['checksum']
|
||||||
has_binaries ['ipfs']
|
has_binaries ['ipfs']
|
||||||
|
notifies :restart, 'service[ipfs]', :delayed
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'ipfs init --empty-repo' do
|
execute 'ipfs init --empty-repo' do
|
||||||
@ -79,7 +59,8 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Configure ipfs to not contact local network addresses
|
node['ipfs']['config'].each do |k, v|
|
||||||
ipfs_config 'Swarm.AddrFilters' do
|
ipfs_config k do
|
||||||
value node['ipfs']['config']['swarm']['addr_filter']
|
value v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,7 @@ require 'json'
|
|||||||
require 'mixlib/shellout'
|
require 'mixlib/shellout'
|
||||||
|
|
||||||
property :key, String, name_property: true
|
property :key, String, name_property: true
|
||||||
property :value, [String, Hash, Array, TrueClass, FalseClass], required: true
|
property :value, [String, Hash, Array, TrueClass, FalseClass, Integer], required: true
|
||||||
|
|
||||||
action :create do
|
action :create do
|
||||||
include_recipe 'ipfs'
|
include_recipe 'ipfs'
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
#
|
|
||||||
# Cookbook:: ipfs
|
|
||||||
# Spec:: default
|
|
||||||
#
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright:: 2018, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe 'ipfs::cluster_service' do
|
|
||||||
context 'When all attributes are default, on Ubuntu 16.04' do
|
|
||||||
let(:chef_run) do
|
|
||||||
# for a complete list of available platforms and versions see:
|
|
||||||
# https://github.com/customink/fauxhai/blob/master/PLATFORMS.md
|
|
||||||
runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04')
|
|
||||||
runner.converge(described_recipe)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'enables the service' do
|
|
||||||
expect(chef_run).to enable_service('ipfs-cluster')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'When all attributes are default, on Ubuntu 18.04' do
|
|
||||||
let(:chef_run) do
|
|
||||||
# for a complete list of available platforms and versions see:
|
|
||||||
# https://github.com/customink/fauxhai/blob/master/PLATFORMS.md
|
|
||||||
runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04')
|
|
||||||
runner.converge(described_recipe)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'enables the service' do
|
|
||||||
expect(chef_run).to enable_service('ipfs-cluster')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,102 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: ipfs-cluster daemon
|
|
||||||
# Required-Start: $local_fs $remote_fs $network $syslog $named
|
|
||||||
# Required-Stop: $local_fs $remote_fs $network $syslog $named
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: Starts the ipfs-cluster daemon
|
|
||||||
# Description: Starts the ipfs-cluster daemon using the start-stop-daemon
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
# Author: Dylan Powers <dylan.kyle.powers@gmail.com
|
|
||||||
|
|
||||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
|
||||||
DESC="ipfs-cluster daemon"
|
|
||||||
NAME=ipfs-cluster
|
|
||||||
DAEMON=/usr/local/bin/ipfs-cluster-service
|
|
||||||
DAEMON_ARGS="daemon --upgrade"
|
|
||||||
PIDFILE=/var/run/$NAME.pid
|
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
|
||||||
|
|
||||||
IPFS_PATH=/home/ipfs/.ipfs
|
|
||||||
IPFS_USER=ipfs
|
|
||||||
|
|
||||||
# Exit if the package is not installed
|
|
||||||
[ -x "$DAEMON" ] || exit 0
|
|
||||||
|
|
||||||
# Read configuration variable file if it is present
|
|
||||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
|
||||||
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
|
||||||
. /lib/init/vars.sh
|
|
||||||
|
|
||||||
# Define LSB log_* functions.
|
|
||||||
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
|
||||||
# and status_of_proc is working.
|
|
||||||
. /lib/lsb/init-functions
|
|
||||||
|
|
||||||
#
|
|
||||||
# Function that starts the daemon/service
|
|
||||||
#
|
|
||||||
do_start() {
|
|
||||||
# Return
|
|
||||||
# 0 if daemon has been started
|
|
||||||
# 1 if daemon was already running
|
|
||||||
# 2 if daemon could not be started
|
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test >/dev/null \
|
|
||||||
|| return 1
|
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \
|
|
||||||
--background --chuid $IPFS_USER --no-close \
|
|
||||||
--exec /usr/bin/env IPFS_PATH="$IPFS_PATH" $DAEMON 2>>$IPFS_PATH/daemon.log 1>/dev/null \
|
|
||||||
-- $DAEMON_ARGS \
|
|
||||||
|| return 2
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Function that stops the daemon/service
|
|
||||||
#
|
|
||||||
do_stop() {
|
|
||||||
# Return
|
|
||||||
# 0 if daemon has been stopped
|
|
||||||
# 1 if daemon was already stopped
|
|
||||||
# 2 if daemon could not be stopped
|
|
||||||
# other if a failure occurred
|
|
||||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
|
||||||
RETVAL="$?"
|
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
|
||||||
|
|
||||||
# Delete the pid
|
|
||||||
rm -f $PIDFILE
|
|
||||||
return "$RETVAL"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
|
||||||
do_start
|
|
||||||
case "$?" in
|
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
|
||||||
do_stop
|
|
||||||
case "$?" in
|
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
do_stop
|
|
||||||
do_start
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
|
|
||||||
exit 3
|
|
||||||
;;
|
|
||||||
esac
|
|
@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Start ipfs-cluster
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/local/bin/ipfs-cluster-service daemon --upgrade
|
|
||||||
User=ipfs
|
|
||||||
Group=ipfs
|
|
||||||
Restart=always
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -2,10 +2,14 @@
|
|||||||
Description=Start ipfs
|
Description=Start ipfs
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/local/bin/ipfs daemon --migrate
|
ExecStart=/usr/local/bin/ipfs daemon --migrate --routing=dhtclient
|
||||||
User=ipfs
|
User=ipfs
|
||||||
Group=ipfs
|
Group=ipfs
|
||||||
Restart=always
|
Restart=always
|
||||||
|
# Raise the ulimit (max number of open files)
|
||||||
|
LimitNOFILE=<%= node['ipfs']['ulimit'] %>
|
||||||
|
# Limit the memory usage
|
||||||
|
MemoryMax=<%= node['ipfs']['memory_max'] %>
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
require 'serverspec'
|
|
||||||
|
|
||||||
# Required by serverspec
|
|
||||||
set :backend, :exec
|
|
||||||
|
|
||||||
describe 'ipfs-cluster-ctl' do
|
|
||||||
# It is in the PATH
|
|
||||||
describe command('which ipfs-cluster-ctl') do
|
|
||||||
its(:exit_status) { should eq 0 }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'ipfs-cluster-service' do
|
|
||||||
# It is in the PATH
|
|
||||||
describe command('which ipfs-cluster-service') do
|
|
||||||
its(:exit_status) { should eq 0 }
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'is listening on port 9096' do
|
|
||||||
expect(port(9096)).to be_listening
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'runs the ipfs-cluster-service' do
|
|
||||||
expect(service('ipfs-cluster')).to be_running
|
|
||||||
expect(service('ipfs-cluster')).to be_enabled
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "ipfs_cluster",
|
|
||||||
"secret": "d9de2f31ca7e9989949010fed2e704f42b8e96fa1e8e60a0ad26611f0a01cf07"
|
|
||||||
}
|
|
@ -1,4 +1,5 @@
|
|||||||
require 'serverspec'
|
require 'serverspec'
|
||||||
|
require 'json'
|
||||||
|
|
||||||
# Required by serverspec
|
# Required by serverspec
|
||||||
set :backend, :exec
|
set :backend, :exec
|
||||||
@ -21,4 +22,34 @@ describe 'IPFS' do
|
|||||||
expect(service('ipfs')).to be_running
|
expect(service('ipfs')).to be_running
|
||||||
expect(service('ipfs')).to be_enabled
|
expect(service('ipfs')).to be_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
addr_filters = <<-EOF
|
||||||
|
[
|
||||||
|
"/ip4/10.0.0.0/ipcidr/8",
|
||||||
|
"/ip4/100.64.0.0/ipcidr/10",
|
||||||
|
"/ip4/169.254.0.0/ipcidr/16",
|
||||||
|
"/ip4/172.16.0.0/ipcidr/12",
|
||||||
|
"/ip4/192.0.0.0/ipcidr/24",
|
||||||
|
"/ip4/192.0.0.0/ipcidr/29",
|
||||||
|
"/ip4/192.0.0.8/ipcidr/32",
|
||||||
|
"/ip4/192.0.0.170/ipcidr/32",
|
||||||
|
"/ip4/192.0.0.171/ipcidr/32",
|
||||||
|
"/ip4/192.0.2.0/ipcidr/24",
|
||||||
|
"/ip4/192.168.0.0/ipcidr/16",
|
||||||
|
"/ip4/198.18.0.0/ipcidr/15",
|
||||||
|
"/ip4/198.51.100.0/ipcidr/24",
|
||||||
|
"/ip4/203.0.113.0/ipcidr/24",
|
||||||
|
"/ip4/240.0.0.0/ipcidr/4"
|
||||||
|
]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
{
|
||||||
|
'Swarm.AddrFilters' => addr_filters.rstrip,
|
||||||
|
'Gateway.Writable' => true,
|
||||||
|
}.each do |k, v|
|
||||||
|
describe command("IPFS_PATH=/home/ipfs/.ipfs ipfs config '#{k}'") do
|
||||||
|
let(:sudo_options) { '-u ipfs -i' }
|
||||||
|
its(:stdout) { should eq "#{v}\n" }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user