Move the ipfs cookbook to its own GitHub repository
This commit is contained in:
parent
de32a7c595
commit
741c4a5192
|
@ -23,7 +23,8 @@ cookbook 'application_git', '= 1.1.0' # 1.2.0 doesn't work with knife-sol
|
|||
cookbook 'poise', '~> 2.8.1'
|
||||
cookbook 'poise-languages', '~> 2.1.1'
|
||||
cookbook 'poise-ruby', '~> 2.4.0'
|
||||
cookbook 'poise-javascript', '~> 1.2.0'
|
||||
cookbook 'poise-javascript', git: 'https://github.com/poise/poise-javascript.git',
|
||||
ref: 'b349e7b7e04edf495398a5f9415a4f8bb4b1badb'
|
||||
cookbook 'poise-archive', '~> 1.5.0'
|
||||
cookbook 'poise-service', '~> 1.5.2'
|
||||
cookbook 'users', '~> 5.3.1'
|
||||
|
@ -61,3 +62,6 @@ cookbook 'windows', '= 3.1.1'
|
|||
cookbook 'iis', '= 6.7.1'
|
||||
cookbook 'mariadb', '= 0.3.1'
|
||||
cookbook 'mingw', '= 2.0.0'
|
||||
cookbook 'ipfs',
|
||||
git: 'https://github.com/67P/ipfs-cookbook.git',
|
||||
ref: 'master'
|
||||
|
|
|
@ -20,6 +20,10 @@ DEPENDENCIES
|
|||
hostname (= 0.4.2)
|
||||
hostsfile (= 2.4.5)
|
||||
iis (= 6.7.1)
|
||||
ipfs
|
||||
git: https://github.com/67P/ipfs-cookbook.git
|
||||
revision: 5578cada684fdab36c0b3c1e6e2acdde10f96947
|
||||
ref: master
|
||||
logrotate (= 2.2.0)
|
||||
mariadb (= 0.3.1)
|
||||
mediawiki
|
||||
|
@ -116,6 +120,8 @@ GRAPH
|
|||
hostsfile (2.4.5)
|
||||
iis (6.7.1)
|
||||
windows (>= 2.0)
|
||||
ipfs (0.1.0)
|
||||
ark (>= 0.0.0)
|
||||
logrotate (2.2.0)
|
||||
mariadb (0.3.1)
|
||||
apt (>= 0.0.0)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml"
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
driver:
|
||||
name: dokken
|
||||
privileged: true # because Docker and SystemD/Upstart
|
||||
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
|
||||
|
||||
transport:
|
||||
name: dokken
|
||||
|
||||
provisioner:
|
||||
name: dokken
|
||||
deprecations_as_errors: true
|
||||
|
||||
verifier:
|
||||
name: inspec
|
||||
|
||||
platforms:
|
||||
- name: ubuntu-16.04
|
||||
driver:
|
||||
image: dokken/ubuntu-16.04
|
||||
pid_one_command: /bin/systemd
|
||||
- name: ubuntu-18.04
|
||||
driver:
|
||||
image: dokken/ubuntu-18.04
|
||||
pid_one_command: /bin/systemd
|
||||
- name: debian-9
|
||||
driver:
|
||||
image: dokken/debian-9
|
||||
pid_one_command: /bin/systemd
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[ipfs::default]
|
||||
attributes:
|
||||
- name: cluster
|
||||
run_list:
|
||||
- recipe[ipfs::cluster]
|
||||
- recipe[ipfs::cluster_service]
|
||||
attributes:
|
|
@ -6,12 +6,17 @@ provisioner:
|
|||
name: chef_zero
|
||||
|
||||
platforms:
|
||||
- name: ubuntu-14.04
|
||||
- name: ubuntu-16.04
|
||||
- name: debian-8.7
|
||||
- name: ubuntu-18.04
|
||||
- name: debian-9
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[ipfs::default]
|
||||
attributes:
|
||||
- name: cluster
|
||||
run_list:
|
||||
- recipe[ipfs::cluster]
|
||||
- recipe[ipfs::cluster_service]
|
||||
attributes:
|
|
@ -0,0 +1,39 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- chef-current-trusty
|
||||
packages:
|
||||
- chefdk
|
||||
|
||||
# Don't `bundle install` which takes about 1.5 mins
|
||||
install: echo "skip bundle install"
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
services: docker
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- INSTANCE=default-debian-9
|
||||
- INSTANCE=default-ubuntu-1604
|
||||
- INSTANCE=default-ubuntu-1804
|
||||
|
||||
before_script:
|
||||
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
|
||||
- eval "$(chef shell-init bash)"
|
||||
- chef --version
|
||||
- cookstyle --version
|
||||
- foodcritic --version
|
||||
|
||||
script: KITCHEN_LOCAL_YAML=.kitchen.dokken.yml CHEF_VERSION=13.10.4 kitchen verify ${INSTANCE}
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- script:
|
||||
- chef exec delivery local all
|
||||
env: UNIT_AND_LINT=1
|
|
@ -0,0 +1,3 @@
|
|||
source 'https://api.berkshelf.com'
|
||||
|
||||
metadata
|
|
@ -4,21 +4,16 @@ DEPENDENCIES
|
|||
metadata: true
|
||||
|
||||
GRAPH
|
||||
ark (2.2.1)
|
||||
ark (4.0.0)
|
||||
build-essential (>= 0.0.0)
|
||||
seven_zip (>= 0.0.0)
|
||||
windows (>= 0.0.0)
|
||||
build-essential (8.0.0)
|
||||
build-essential (8.1.1)
|
||||
mingw (>= 1.1)
|
||||
seven_zip (>= 0.0.0)
|
||||
compat_resource (12.16.3)
|
||||
ipfs (0.1.0)
|
||||
ark (>= 0.0.0)
|
||||
mingw (1.2.5)
|
||||
compat_resource (>= 12.16.3)
|
||||
mingw (2.1.0)
|
||||
seven_zip (>= 0.0.0)
|
||||
ohai (5.0.0)
|
||||
seven_zip (2.0.2)
|
||||
windows (>= 1.2.2)
|
||||
windows (2.1.1)
|
||||
ohai (>= 4.0.0)
|
||||
seven_zip (3.0.0)
|
||||
windows (>= 0.0.0)
|
||||
windows (5.0.0)
|
|
@ -55,6 +55,15 @@ ipfs_config "Gateway.Writable" do
|
|||
end
|
||||
```
|
||||
|
||||
## Running the specs and integrations tests
|
||||
|
||||
Install the latest [Chef DK](https://downloads.chef.io/chefdk).
|
||||
|
||||
```
|
||||
chef exec delivery local all # Run the linting check, syntax check and unit tests
|
||||
kitchen verify # Run the integration tests for Ubuntu 16.04, 18.06 and Debian 9
|
||||
```
|
||||
|
||||
## License and Authors
|
||||
|
||||
Authors: Kosmos
|
|
@ -0,0 +1,7 @@
|
|||
node.default['ipfs']['version'] = '0.4.9'
|
||||
node.default['ipfs']['checksum'] = 'ae50c760f58548adc7c6dade4cf549059b6bc73ebc25ff4ea9fece06a15ac0a6'
|
||||
# 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'
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "ipfs",
|
||||
"description": "Installs/Configures ipfs",
|
||||
"long_description": "# ipfs Cookbook\n\nThis cookbook installs ipfs and starts it as a daemon\n\n## Requirements\n\n### Platforms\n\nThis cookbook is tested on Ubuntu 16.06, 14.04 and Debian 8 using Test Kitchen.\nIt currently only supports 64bit platforms\n\n### Chef\n\n- Chef 12.5 or later (we are providing a\n [https://docs.chef.io/custom_resources.html](Custom Resource) to configure\n IPFS\n\n### Cookbook dependencies\n\n- `ark` to download and uncompress the Go IPFS package\n\n## Usage\n\n### ipfs::default\n\nJust include `ipfs` in your node's `run_list`:\n\n```json\n{\n \"name\":\"my_node\",\n \"run_list\": [\n \"recipe[ipfs]\"\n ]\n}\n```\n\n## Attributes\n\n- `node.['ipfs']['version']` - the Go IPFS version to download from the official\nsite (64bit)\n- `node['ipfs']['checksum']` - the SHA256 checksum for the package\n- `node['ipfs']['config']['swarm']['addr_filter']` - the network ranges to not\nconnect to. This will stop platforms like Hetzner to block your server\n(https://github.com/ipfs/go-ipfs/issues/1226)\n\n## Resources\n\n`ipfs_config` sets the config. Supports hashes, arrays, booleans and strings.\nDoes not change anything if the config already has that value, and restarts\nthe server automatically\n\n```ruby\nipfs_config \"Gateway.Writable\" do\n value \"true\"\n end\n```\n\n## Running the specs and integrations tests\n\nInstall the latest [Chef DK](https://downloads.chef.io/chefdk).\n\n```\nchef exec delivery local all # Run the linting check, syntax check and unit tests\nkitchen verify # Run the integration tests for Ubuntu 16.04, 18.06 and Debian 9\n```\n\n## License and Authors\n\nAuthors: Kosmos\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"maintainer": "Kosmos",
|
||||
"maintainer_email": "mail@kosmos.org",
|
||||
"license": "Apache-2.0",
|
||||
"platforms": {
|
||||
"[\"ubuntu\", \"debian\"]": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ark": ">= 0.0.0"
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
},
|
||||
"version": "0.1.0",
|
||||
"source_url": "https://github.com/67P/ipfs-cookbook",
|
||||
"issues_url": "https://github.com/67P/ipfs-cookbook/issues",
|
||||
"privacy": false,
|
||||
"chef_versions": [
|
||||
[
|
||||
">= 12.14"
|
||||
]
|
||||
],
|
||||
"ohai_versions": [
|
||||
|
||||
],
|
||||
"gems": [
|
||||
|
||||
]
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: _user
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
group 'ipfs' do
|
||||
gid 4737
|
||||
end
|
||||
|
||||
user 'ipfs' do
|
||||
comment 'ipfs'
|
||||
uid 4737
|
||||
gid 4737
|
||||
home '/home/ipfs'
|
||||
manage_home true
|
||||
end
|
|
@ -0,0 +1,41 @@
|
|||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: cluster
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
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
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: cluster_bootstrap
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
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
|
|
@ -0,0 +1,57 @@
|
|||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: cluster_service
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
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
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2017-2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include_recipe 'ipfs::_user'
|
||||
|
||||
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
|
||||
|
||||
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 ||
|
||||
platform?('debian') && node['platform_version'].to_f < 8
|
||||
template 'ipfs.initd.service.erb' do
|
||||
path '/etc/init.d/ipfs'
|
||||
source 'ipfs.initd.service.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0750'
|
||||
notifies :restart, 'service[ipfs]', :delayed
|
||||
end
|
||||
|
||||
service 'ipfs' 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.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
|
||||
|
||||
service 'ipfs' do
|
||||
provider Chef::Provider::Service::Systemd
|
||||
action [:enable]
|
||||
end
|
||||
end
|
||||
|
||||
# Configure ipfs to not contact local network addresses
|
||||
ipfs_config 'Swarm.AddrFilters' do
|
||||
value node['ipfs']['config']['swarm']['addr_filter']
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
require 'json'
|
||||
require 'mixlib/shellout'
|
||||
|
||||
property :key, String, name_property: true
|
||||
property :value, [String, Hash, Array, TrueClass, FalseClass], required: true
|
||||
|
||||
action :create do
|
||||
include_recipe 'ipfs'
|
||||
|
||||
execute "ipfs config --json #{new_resource.key} '#{JSON.generate(new_resource.value)}'" do
|
||||
environment 'IPFS_PATH' => '/home/ipfs/.ipfs'
|
||||
user 'ipfs'
|
||||
not_if do
|
||||
cmd = Mixlib::ShellOut.new('ipfs', 'config', new_resource.key,
|
||||
user: 'ipfs',
|
||||
env: { 'IPFS_PATH' => '/home/ipfs/.ipfs' })
|
||||
cmd.run_command
|
||||
begin
|
||||
JSON.parse(cmd.stdout) == JSON.parse(JSON.generate(new_resource.value))
|
||||
rescue JSON::ParserError
|
||||
cmd.stdout.include?(new_resource.value.to_s)
|
||||
end
|
||||
end
|
||||
notifies :restart, 'service[ipfs]', :delayed
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
require 'chefspec'
|
||||
require 'chefspec/berkshelf'
|
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# Cookbook:: ipfs
|
||||
# Spec:: default
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
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
|
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# Cookbook:: ipfs
|
||||
# Spec:: default
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ipfs::default' 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 'converges successfully' do
|
||||
expect { chef_run }.to_not raise_error
|
||||
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 'converges successfully' do
|
||||
expect { chef_run }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
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
|
|
@ -0,0 +1,30 @@
|
|||
I, [2018-08-10T16:28:48.996619 #26331] INFO -- Kitchen: -----> Starting Kitchen (v1.15.0)
|
||||
E, [2018-08-10T16:28:48.997042 #26331] ERROR -- Kitchen: ------Exception-------
|
||||
E, [2018-08-10T16:28:48.997089 #26331] ERROR -- Kitchen: Class: Kitchen::UserError
|
||||
E, [2018-08-10T16:28:48.997122 #26331] ERROR -- Kitchen: Message: Kitchen YAML file /Users/kare/code/kosmos/cookbooks/ipfs/test/integration/data_bags/.kitchen.yml does not exist.
|
||||
E, [2018-08-10T16:28:48.997151 #26331] ERROR -- Kitchen: ----------------------
|
||||
E, [2018-08-10T16:28:48.997178 #26331] ERROR -- Kitchen: ------Backtrace-------
|
||||
E, [2018-08-10T16:28:48.997205 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/loader/yaml.rb:71:in `read'
|
||||
E, [2018-08-10T16:28:48.997239 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:152:in `data'
|
||||
E, [2018-08-10T16:28:48.997266 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:131:in `suites'
|
||||
E, [2018-08-10T16:28:48.997294 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:182:in `filter_instances'
|
||||
E, [2018-08-10T16:28:48.997321 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:141:in `build_instances'
|
||||
E, [2018-08-10T16:28:48.997347 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:117:in `instances'
|
||||
E, [2018-08-10T16:28:48.997374 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:112:in `filtered_instances'
|
||||
E, [2018-08-10T16:28:48.997402 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:142:in `parse_subcommand'
|
||||
E, [2018-08-10T16:28:48.997431 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/command/action.rb:35:in `block in call'
|
||||
E, [2018-08-10T16:28:48.997459 #26331] ERROR -- Kitchen: /Users/kare/.rubies/ruby-2.4.2/lib/ruby/2.4.0/benchmark.rb:293:in `measure'
|
||||
E, [2018-08-10T16:28:48.997515 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/command/action.rb:34:in `call'
|
||||
E, [2018-08-10T16:28:48.997566 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:53:in `perform'
|
||||
E, [2018-08-10T16:28:48.997600 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:187:in `block (2 levels) in <class:CLI>'
|
||||
E, [2018-08-10T16:28:48.997631 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
|
||||
E, [2018-08-10T16:28:48.997666 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
|
||||
E, [2018-08-10T16:28:48.997696 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:334:in `invoke_task'
|
||||
E, [2018-08-10T16:28:48.997726 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
|
||||
E, [2018-08-10T16:28:48.997766 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
|
||||
E, [2018-08-10T16:28:48.997796 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/bin/kitchen:13:in `block in <top (required)>'
|
||||
E, [2018-08-10T16:28:48.997826 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/lib/kitchen/errors.rb:171:in `with_friendly_errors'
|
||||
E, [2018-08-10T16:28:48.997855 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/gems/test-kitchen-1.15.0/bin/kitchen:13:in `<top (required)>'
|
||||
E, [2018-08-10T16:28:48.997882 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/bin/kitchen:23:in `load'
|
||||
E, [2018-08-10T16:28:48.997918 #26331] ERROR -- Kitchen: /Users/kare/.gem/ruby/2.4.2/bin/kitchen:23:in `<main>'
|
||||
E, [2018-08-10T16:28:48.997949 #26331] ERROR -- Kitchen: ----End Backtrace-----
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"id": "ipfs_cluster",
|
||||
"secret": "d9de2f31ca7e9989949010fed2e704f42b8e96fa1e8e60a0ad26611f0a01cf07"
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
require 'serverspec'
|
||||
|
||||
# Required by serverspec
|
||||
set :backend, :exec
|
||||
|
||||
describe 'IPFS' do
|
||||
# It is in the PATH
|
||||
describe command('which ipfs') do
|
||||
its(:exit_status) { should eq 0 }
|
||||
end
|
||||
|
||||
it 'is listening on port 4001' do
|
||||
expect(port(4001)).to be_listening
|
||||
end
|
||||
|
||||
it 'is listening on port 8080 (gateway)' do
|
||||
expect(port(8080)).to be_listening
|
||||
end
|
||||
|
||||
it 'has a running service of ipfs' do
|
||||
expect(service('ipfs')).to be_running
|
||||
expect(service('ipfs')).to be_enabled
|
||||
end
|
||||
end
|
|
@ -1,44 +0,0 @@
|
|||
me: dokken
|
||||
privileged: true # because Docker and SystemD/Upstart
|
||||
chef_image: chef/chef
|
||||
chef_version: current
|
||||
|
||||
transport:
|
||||
name: dokken
|
||||
|
||||
provisioner:
|
||||
name: dokken
|
||||
|
||||
platforms:
|
||||
- name: debian-7
|
||||
driver:
|
||||
image: debian:7
|
||||
pid_one_command: /sbin/init
|
||||
intermediate_instructions:
|
||||
- RUN /usr/bin/apt-get update
|
||||
|
||||
- name: debian-8
|
||||
driver:
|
||||
image: debian:8
|
||||
pid_one_command: /bin/systemd
|
||||
intermediate_instructions:
|
||||
- RUN /usr/bin/apt-get update
|
||||
|
||||
- name: ubuntu-14.04
|
||||
driver:
|
||||
image: ubuntu-upstart:14.04
|
||||
pid_one_command: /sbin/init
|
||||
intermediate_instructions:
|
||||
- RUN /usr/bin/apt-get update
|
||||
|
||||
- name: ubuntu-16.04
|
||||
driver:
|
||||
image: ubuntu:16.04
|
||||
pid_one_command: /bin/systemd
|
||||
intermediate_instructions:
|
||||
- RUN /usr/bin/apt-get update
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[ipfs]
|
|
@ -1,50 +0,0 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
# install the pre-release chef-dk. Use chef-stable-trusty to install the stable release
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- chef-stable-trusty
|
||||
packages:
|
||||
- chefdk
|
||||
|
||||
# Don't `bundle install` which takes about 1.5 mins
|
||||
install: echo "skip bundle install"
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
services: docker
|
||||
|
||||
env:
|
||||
matrix:
|
||||
# - INSTANCE=default-centos-5 times out for no reason
|
||||
- INSTANCE=default-centos-6
|
||||
- INSTANCE=default-centos-7
|
||||
- INSTANCE=default-debian-7
|
||||
- INSTANCE=default-debian-8
|
||||
- INSTANCE=default-fedora-latest
|
||||
- INSTANCE=default-opensuse-132
|
||||
- INSTANCE=default-opensuse-421
|
||||
- INSTANCE=default-ubuntu-1204
|
||||
- INSTANCE=default-ubuntu-1404
|
||||
- INSTANCE=default-ubuntu-1604
|
||||
|
||||
before_script:
|
||||
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
|
||||
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
|
||||
|
||||
script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- before_script:
|
||||
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
|
||||
- /opt/chefdk/embedded/bin/chef --version
|
||||
- /opt/chefdk/embedded/bin/cookstyle --version
|
||||
- /opt/chefdk/embedded/bin/foodcritic --version
|
||||
- script:
|
||||
- /opt/chefdk/bin/chef exec rake
|
||||
env: UNIT_AND_LINT=1
|
|
@ -1,3 +0,0 @@
|
|||
source "https://api.berkshelf.com"
|
||||
|
||||
metadata
|
|
@ -1,6 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
gem "rake"
|
||||
gem "test-kitchen"
|
||||
gem "kitchen-vagrant"
|
||||
gem "berkshelf"
|
|
@ -1,134 +0,0 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.5.0)
|
||||
public_suffix (~> 2.0, >= 2.0.2)
|
||||
artifactory (2.7.0)
|
||||
berkshelf (5.2.0)
|
||||
addressable (~> 2.3, >= 2.3.4)
|
||||
berkshelf-api-client (>= 2.0.2, < 4.0)
|
||||
buff-config (~> 2.0)
|
||||
buff-extensions (~> 2.0)
|
||||
buff-shell_out (~> 1.0)
|
||||
cleanroom (~> 1.0)
|
||||
faraday (~> 0.9)
|
||||
httpclient (~> 2.7)
|
||||
minitar (~> 0.5, >= 0.5.4)
|
||||
mixlib-archive (~> 0.1)
|
||||
octokit (~> 4.0)
|
||||
retryable (~> 2.0)
|
||||
ridley (~> 5.0)
|
||||
solve (> 2.0, < 4.0)
|
||||
thor (~> 0.19)
|
||||
berkshelf-api-client (3.0.0)
|
||||
faraday (~> 0.9)
|
||||
httpclient (~> 2.7)
|
||||
ridley (>= 4.5, < 6.0)
|
||||
buff-config (2.0.0)
|
||||
buff-extensions (~> 2.0)
|
||||
varia_model (~> 0.6)
|
||||
buff-extensions (2.0.0)
|
||||
buff-ignore (1.2.0)
|
||||
buff-ruby_engine (1.0.0)
|
||||
buff-shell_out (1.1.0)
|
||||
buff-ruby_engine (~> 1.0)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
celluloid-io (0.16.2)
|
||||
celluloid (>= 0.16.0)
|
||||
nio4r (>= 1.1.0)
|
||||
chef-config (12.19.36)
|
||||
addressable
|
||||
fuzzyurl
|
||||
mixlib-config (~> 2.0)
|
||||
mixlib-shellout (~> 2.0)
|
||||
cleanroom (1.0.0)
|
||||
erubis (2.7.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
fuzzyurl (0.9.0)
|
||||
hashie (3.5.5)
|
||||
hitimes (1.2.4)
|
||||
httpclient (2.8.3)
|
||||
json (2.0.3)
|
||||
kitchen-vagrant (1.0.2)
|
||||
test-kitchen (~> 1.4)
|
||||
minitar (0.6.1)
|
||||
mixlib-archive (0.4.1)
|
||||
mixlib-log
|
||||
mixlib-authentication (1.4.1)
|
||||
mixlib-log
|
||||
mixlib-config (2.2.4)
|
||||
mixlib-install (2.1.12)
|
||||
artifactory
|
||||
mixlib-shellout
|
||||
mixlib-versioning
|
||||
thor
|
||||
mixlib-log (1.7.1)
|
||||
mixlib-shellout (2.2.7)
|
||||
mixlib-versioning (1.1.0)
|
||||
molinillo (0.5.6)
|
||||
multipart-post (2.0.0)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (4.1.0)
|
||||
net-ssh-gateway (1.3.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
nio4r (2.0.0)
|
||||
octokit (4.6.2)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
public_suffix (2.0.5)
|
||||
rake (11.3.0)
|
||||
retryable (2.0.4)
|
||||
ridley (5.1.0)
|
||||
addressable
|
||||
buff-config (~> 2.0)
|
||||
buff-extensions (~> 2.0)
|
||||
buff-ignore (~> 1.2)
|
||||
buff-shell_out (~> 1.0)
|
||||
celluloid (~> 0.16.0)
|
||||
celluloid-io (~> 0.16.1)
|
||||
chef-config (>= 12.5.0)
|
||||
erubis
|
||||
faraday (~> 0.9.0)
|
||||
hashie (>= 2.0.2, < 4.0.0)
|
||||
httpclient (~> 2.7)
|
||||
json (>= 1.7.7)
|
||||
mixlib-authentication (>= 1.3.0)
|
||||
retryable (~> 2.0)
|
||||
semverse (~> 2.0)
|
||||
varia_model (~> 0.6)
|
||||
safe_yaml (1.0.4)
|
||||
sawyer (0.8.1)
|
||||
addressable (>= 2.3.5, < 2.6)
|
||||
faraday (~> 0.8, < 1.0)
|
||||
semverse (2.0.0)
|
||||
solve (3.1.0)
|
||||
molinillo (>= 0.5)
|
||||
semverse (>= 1.1, < 3.0)
|
||||
test-kitchen (1.15.0)
|
||||
mixlib-install (>= 1.2, < 3.0)
|
||||
mixlib-shellout (>= 1.2, < 3.0)
|
||||
net-scp (~> 1.1)
|
||||
net-ssh (>= 2.9, < 5.0)
|
||||
net-ssh-gateway (~> 1.2)
|
||||
safe_yaml (~> 1.0)
|
||||
thor (~> 0.18)
|
||||
thor (0.19.4)
|
||||
timers (4.0.4)
|
||||
hitimes
|
||||
varia_model (0.6.0)
|
||||
buff-extensions (~> 2.0)
|
||||
hashie (>= 2.0.2, < 4.0.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
berkshelf
|
||||
kitchen-vagrant
|
||||
rake
|
||||
test-kitchen
|
||||
|
||||
BUNDLED WITH
|
||||
1.14.3
|
|
@ -1,7 +0,0 @@
|
|||
node.default['ipfs']['version'] = "0.4.9"
|
||||
node.default['ipfs']['checksum'] = "ae50c760f58548adc7c6dade4cf549059b6bc73ebc25ff4ea9fece06a15ac0a6"
|
||||
# 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"
|
|
@ -1,11 +0,0 @@
|
|||
name 'ipfs'
|
||||
maintainer 'Kosmos'
|
||||
maintainer_email 'mail@kosmos.org'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures ipfs'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.1.0'
|
||||
|
||||
supports %w(ubuntu debian)
|
||||
|
||||
depends 'ark'
|
|
@ -1,68 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: ipfs
|
||||
# Recipe:: cluster
|
||||
#
|
||||
# Copyright 2018, Kosmos
|
||||
#
|
||||
# All rights reserved - Do Not Redistribute
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
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
|
|
@ -1,78 +0,0 @@
|
|||
#
|
||||
# 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 ||
|
||||
platform?('debian') && node['platform_version'].to_f < 8
|
||||
template "ipfs.initd.service.erb" do
|
||||
path "/etc/init.d/ipfs"
|
||||
source 'ipfs.initd.service.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0750'
|
||||
notifies :restart, "service[ipfs]", :delayed
|
||||
end
|
||||
|
||||
service "ipfs" 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.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
|
||||
|
||||
service "ipfs" do
|
||||
provider Chef::Provider::Service::Systemd
|
||||
action [:enable]
|
||||
end
|
||||
end
|
||||
|
||||
# Configure ipfs to not contact local network addresses
|
||||
ipfs_config "Swarm.AddrFilters" do
|
||||
value node['ipfs']['config']['swarm']['addr_filter']
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require 'json'
|
||||
require 'mixlib/shellout'
|
||||
|
||||
property :key, String, name_property: true
|
||||
property :value, [String, Hash, Array, TrueClass, FalseClass], required: true
|
||||
|
||||
action :create do
|
||||
include_recipe "ipfs"
|
||||
|
||||
execute "ipfs config --json #{key} '#{JSON.generate(value)}'" do
|
||||
environment "IPFS_PATH" => "/home/ipfs/.ipfs"
|
||||
user "ipfs"
|
||||
not_if do
|
||||
cmd = Mixlib::ShellOut.new("ipfs", "config", key,
|
||||
user: 'ipfs',
|
||||
env: { "IPFS_PATH" => "/home/ipfs/.ipfs" })
|
||||
cmd.run_command
|
||||
begin
|
||||
JSON.parse(cmd.stdout) == JSON.parse(JSON.generate(value))
|
||||
rescue JSON::ParserError
|
||||
cmd.stdout.include?("#{value}")
|
||||
end
|
||||
end
|
||||
notifies :restart, "service[ipfs]", :delayed
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'serverspec'
|
||||
|
||||
# Required by serverspec
|
||||
set :backend, :exec
|
||||
|
||||
describe "IPFS" do
|
||||
# It is in the PATH
|
||||
describe command("which ipfs") do
|
||||
its(:exit_status) { should eq 0 }
|
||||
end
|
||||
|
||||
it "is listening on port 4001" do
|
||||
expect(port(4001)).to be_listening
|
||||
end
|
||||
|
||||
it "is listening on port 8080 (gateway)" do
|
||||
expect(port(8080)).to be_listening
|
||||
end
|
||||
|
||||
it "has a running service of ipfs" do
|
||||
expect(service("ipfs")).to be_running
|
||||
expect(service("ipfs")).to be_enabled
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue