Merge branch 'master' into feature/5apps_xmpp_certs

This commit is contained in:
Greg Karékinian 2018-11-08 14:13:09 +01:00
commit 81c68a9609
67 changed files with 1267 additions and 942 deletions

View File

@ -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'

View File

@ -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: ec2cda08f617e7ea617c40e8d2df4e450d84f92e
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)

View File

@ -2,7 +2,7 @@ source 'https://rubygems.org'
gem 'chef', '~> 12.21.1'
gem 'berkshelf', '~> 6.3'
gem 'knife-solo'
gem 'knife-solo', '>= 0.7.0.pre3'
gem 'knife-solo_data_bag'
gem 'cookstyle'
gem 'test-kitchen'

View File

@ -94,10 +94,10 @@ GEM
iniparse (1.4.4)
ipaddress (0.8.3)
json (2.1.0)
knife-solo (0.6.0)
knife-solo (0.7.0.pre3)
chef (>= 10.20)
erubis (~> 2.7.0)
net-ssh (>= 2.7, < 4.0)
net-ssh (>= 2.7)
knife-solo_data_bag (2.1.0)
libyajl2 (1.2.0)
minitar (0.6.1)
@ -122,7 +122,7 @@ GEM
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (3.2.0)
net-ssh (4.2.0)
net-ssh-gateway (1.3.0)
net-ssh (>= 2.6.5)
net-ssh-multi (1.2.1)
@ -245,9 +245,9 @@ DEPENDENCIES
berkshelf (~> 6.3)
chef (~> 12.21.1)
cookstyle
knife-solo
knife-solo (>= 0.7.0.pre3)
knife-solo_data_bag
test-kitchen
BUNDLED WITH
1.16.1
1.17.1

View File

@ -0,0 +1 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml"

View File

@ -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:

View File

@ -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:

View File

@ -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

3
cookbooks/ipfs/Berksfile Normal file
View File

@ -0,0 +1,3 @@
source 'https://api.berkshelf.com'
metadata

View File

@ -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)

21
cookbooks/ipfs/LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 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.

93
cookbooks/ipfs/README.md Normal file
View File

@ -0,0 +1,93 @@
# ipfs Cookbook
This cookbook installs ipfs and starts it as a daemon
## Requirements
### Platforms
This cookbook is tested on Ubuntu 16.06, 14.04 and Debian 8 using Test Kitchen.
It currently only supports 64bit platforms
### Chef
- Chef 12.5 or later (we are providing a
[https://docs.chef.io/custom_resources.html](Custom Resource) to configure
IPFS
### Cookbook dependencies
- `ark` to download and uncompress the Go IPFS package
## Usage
### ipfs::default
Just include `ipfs` in your node's `run_list`:
```json
{
"name":"my_node",
"run_list": [
"recipe[ipfs]"
]
}
```
## Attributes
- `node.['ipfs']['version']` - the Go IPFS version to download from the official
site (64bit)
- `node['ipfs']['checksum']` - the SHA256 checksum for the package
- `node['ipfs']['config']['swarm']['addr_filter']` - the network ranges to not
connect to. This will stop platforms like Hetzner to block your server
(https://github.com/ipfs/go-ipfs/issues/1226)
## Resources
`ipfs_config` sets the config. Supports hashes, arrays, booleans and strings.
Does not change anything if the config already has that value, and restarts
the server automatically
```ruby
ipfs_config "Gateway.Writable" do
value "true"
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 Developers mail@kosmos.org
Copyright: 2018, [Kosmos Developers](https://kredits.kosmos.org/)
```
Unless otherwise noted, all files are released under the MIT license, possible
exceptions will contain licensing information in them.
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.
```

View File

@ -0,0 +1,7 @@
node.default['ipfs']['version'] = '0.4.17'
node.default['ipfs']['checksum'] = '1bb1050ebe74f9042ac721eb1b71f92e1b0e78e54c59dadfde13080facb2901c'
# 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'

View File

@ -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 Developers mail@kosmos.org\nCopyright: 2018, [Kosmos Developers](https://kredits.kosmos.org/)\n\n```\nUnless otherwise noted, all files are released under the MIT license, possible\nexceptions will contain licensing information in them.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n",
"maintainer": "Kosmos Developers",
"maintainer_email": "mail@kosmos.org",
"license": "MIT",
"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": [
]
}

View File

@ -0,0 +1,37 @@
#
# Cookbook Name:: ipfs
# 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
gid 4737
end
user 'ipfs' do
comment 'ipfs'
uid 4737
gid 4737
home '/home/ipfs'
manage_home true
end

View File

@ -0,0 +1,48 @@
#
# 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

View File

@ -0,0 +1,33 @@
#
# 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

View File

@ -0,0 +1,64 @@
#
# 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

View File

@ -0,0 +1,85 @@
#
# Cookbook Name:: ipfs
# 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'
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

View File

@ -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

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
require 'chefspec'
require 'chefspec/berkshelf'

View File

@ -0,0 +1,55 @@
#
# 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

View File

@ -0,0 +1,55 @@
#
# 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::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

View File

@ -0,0 +1,102 @@
#!/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"
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

View File

@ -0,0 +1,11 @@
[Unit]
Description=Start ipfs-cluster
[Service]
ExecStart=/usr/local/bin/ipfs-cluster-service daemon
User=ipfs
Group=ipfs
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -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

View File

@ -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-----

View File

@ -0,0 +1,4 @@
{
"id": "ipfs_cluster",
"secret": "d9de2f31ca7e9989949010fed2e704f42b8e96fa1e8e60a0ad26611f0a01cf07"
}

View File

@ -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

View File

@ -1,44 +1,50 @@
{
"id": "5apps_schlupp_xmpp",
"password": {
"encrypted_data": "vdpA+JHaQryqZcoFkEdny7+InZDz99xV8iu/LKU8YGFBYXdWXts4sfH4WyVg\nbTfM\n",
"iv": "WHfrC1kzs6/xKXwuwlwPqw==\n",
"encrypted_data": "PoT+Wn5X9/509Rt2XVHrvBk8khF9cbxluwQlgHI/PVSLWZ+JlcnvO1YF0xal\ng0hd\n",
"iv": "kJPRQDvdPT0V9bHQeV/lrA==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"webhook_token": {
"encrypted_data": "9Ir6EU4vbA49+L0zUxaEBxSCF7Wzx20/vg40YSM6hVrH2Mg7ZF5bprdni4mP\n1KmI\n",
"iv": "6g9kOLaeb1cmhp7wlC1XPg==\n",
"encrypted_data": "Gg4/3dSVtWmXq/Ce5fCDg+4AKPPjy90CI0Lp7DnPV4R+j+T467LEYYtgp038\nplyi\n",
"iv": "FEhVZWtxFt85DeJcp2E6jA==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"rs_logger_token": {
"encrypted_data": "KRwgLSHbfwiLMI4sV9ZWP5VnT/kWFe89WGbsYLYAPSseOYFrvH+YEH0A1sB/\nS6aafrCsK+q5WawLSmfTg8DOtw==\n",
"iv": "5asejj0oTTKWVgDdpBmbmg==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"rs_ops_token": {
"encrypted_data": "GkfRyCO6Ctj2Tls4HFOTHt/y+3a6rrd84+siDr6c8+1ydsOT7vA+hDP7fHvq\nU8JnDca/Pd7yRMLACV4fdY0dQQ==\n",
"iv": "ES0LLnsEaC2SgHr7Rv1wFw==\n",
"encrypted_data": "5S6I1cenYT2qTvjtuXlgIestyI6tHcPzKw6Hvwe9b7tZ3tHF2j8gsCfqCPQR\nx3xhRJnH4PyhVkbCzr6dApNNZA==\n",
"iv": "GWtGG5jqapw65Oes4zG4Xw==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"deploy_key": {
"encrypted_data": "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\nNirK6cK/bWZzRjN/W6nJ9PrO\n",
"iv": "JSVBvNn1cvdCQYAAFv1f4g==\n",
"encrypted_data": "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\n8Ajg3k1paLzi09ypwLVWOzq+\n",
"iv": "//Oik8zYVxlYLCJ/5zk2Jw==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"airtable_api_key": {
"encrypted_data": "WOQ/IJwVSiu5cUumLZcBE5dyKCxojHpBVFEVFcWax9jHvcLgIz2d7U/X1XeI\nZJ6W\n",
"iv": "67fXeOD2OTRhWeG5YsqdRg==\n",
"encrypted_data": "qDEztKIUYN6qU6dAbXi7leapA/+fK0beTZpEvFxvP9+0IrfSQ0mjagIU33ne\nkM/Y\n",
"iv": "MdfLft5aSoC/yzZe7BRCyg==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"github_token": {
"encrypted_data": "KDZ3TzVjX05aeL9dyCeIuEa3XpItIduovEpEu+eDRA+eyCW1Yg5mdBARLoqO\n8elA0sO9EYrxJAo/o6tE+rLmFw==\n",
"iv": "BXflyLpEh5eZtiU1pEJPzA==\n",
"encrypted_data": "Rp1icQX6fbE8WImrY3NxkLcq10+CcCOG0nSED3ALtVaiY9gXtLb4mEPhgz6B\nqepZ5bG35W08ORxjBskpPudKMQ==\n",
"iv": "9JTZWHikvB9+dfyht5UYmQ==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"aws_access_key_id": {
"encrypted_data": "J7sNPOtA+lzj+7FjZlneadNcLZxBGz2x1JNeX0j0Rl/pSU7QZCaPFy8KCGj+\nIh8v\n",
"iv": "K29ZdZdSAd+yJS8yNxkjpg==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"aws_secret_access_key": {
"encrypted_data": "UFLVmj81LAMZheItVvEioQhecPYXLU9tzQVRFLOO1NKZLRK6oDNDPbvey5vO\ndzw1UiGD6LcrAFRPDYuwsQrteg==\n",
"iv": "RCSCMBxVC8oF02R3l2ASxg==\n",
"version": 1,
"cipher": "aes-256-cbc"
}

View File

@ -0,0 +1,10 @@
{
"id": "ipfs_cluster",
"secret": {
"encrypted_data": "oyy8QVRPvMx4YpHVqHr0WxX0D4WQMwZ43A1N+ZFa2jBlB/tzwzIz2gQv05L2\nf/2q4t4yXk6zTJRqPJ9kzcBddJCfuQPr8IzwdOZRz1UdXfE/iYY=\n",
"iv": "8+l2J0qmn6cKmGdf\n",
"auth_tag": "mgzeYpKJk6PSXjdcOP4CEg==\n",
"version": 3,
"cipher": "aes-256-gcm"
}
}

17
doc/ejabberd.md Normal file
View File

@ -0,0 +1,17 @@
# ejabberd
The kosmos.org XMPP server is running on Andromeda
[ejabberdctl reference](https://docs.ejabberd.im/admin/guide/managing/#ejabberdctl-commands)
## Create a user account
sudo /opt/ejabberd-18.06/bin/ejabberdctl register username kosmos.org password
## Change a user's password
sudo /opt/ejabberd-18.06/bin/ejabberdctl change_password username kosmos.org new_password
## List users
sudo /opt/ejabberd-18.06/bin/ejabberdctl registered_users kosmos.org

View File

@ -2,7 +2,7 @@
"run_list": [
"kosmos-base",
"kosmos-base::andromeda_firewall",
"kosmos-ipfs"
"role[ipfs_cluster_with_tls]"
],
"automatic": {
"ipaddress": "andromeda.kosmos.org"

View File

@ -9,9 +9,9 @@
"5apps-xmpp_server",
"5apps-hubot::xmpp_schlupp",
"5apps-hubot::xmpp_botka",
"kosmos-ipfs",
"kosmos-mastodon",
"kosmos-mastodon::nginx"
"kosmos-mastodon::nginx",
"kosmos-ipfs::cluster"
],
"normal": {
"postgresql": {

View File

@ -0,0 +1,15 @@
name "ipfs_cluster_with_tls"
run_list %w(
kosmos-ipfs
kosmos-ipfs::cluster
kosmos-ipfs::letsencrypt
)
override_attributes(
'kosmos-ipfs' => {
'nginx' => {
'api_port' => 9095
}
}
)

View File

@ -94,10 +94,11 @@ application schlupp_xmpp_path do
"HUBOT_RSS_HEADER" => "Update:",
"HUBOT_AUTH_ADMIN" => "basti,garret,greg",
"REDIS_URL" => "redis://localhost:6379/5apps_schlupp_xmpp",
"RS_OPS_TOKEN" => schlupp_xmpp_data_bag_item['rs_ops_token'],
"WEBHOOK_TOKEN" => schlupp_xmpp_data_bag_item['webhook_token'],
"AIRTABLE_API_KEY" => schlupp_xmpp_data_bag_item['airtable_api_key'],
"GITHUB_TOKEN" => schlupp_xmpp_data_bag_item['github_token'] }
"GITHUB_TOKEN" => schlupp_xmpp_data_bag_item['github_token'],
"AWS_ACCESS_KEY_ID" => schlupp_xmpp_data_bag_item['aws_access_key_id'],
"AWS_SECRET_ACCESS_KEY" => schlupp_xmpp_data_bag_item['aws_secret_access_key'] }
)
notifies :run, "execute[systemctl daemon-reload]", :delayed

View File

@ -26,6 +26,11 @@ set_unless["backup"]["mysql"]["databases"] = []
set_unless["backup"]["mysql"]["username"] = "root"
set_unless["backup"]["mysql"]["host"] = "localhost"
# PostgreSQL default settings
set_unless["backup"]["postgresql"]["databases"] = []
set_unless["backup"]["postgresql"]["host"] = "localhost"
set_unless["backup"]["postgresql"]["port"] = 5432
# Redis default settings
set_unless["backup"]["redis"]["databases"] = []
set_unless["backup"]["redis"]["host"] = "localhost"

View File

@ -17,7 +17,11 @@ KosmosBackup.new(:default, 'default backup') do
<%- end -%>
<%- if node["backup"]["postgresql"] -%>
database PostgreSQL
<%- node["backup"]["postgresql"]["databases"].each do |db_name| -%>
database PostgreSQL, :"<%= db_name.to_sym %>" do |db|
db.name = "<%= db_name %>"
end
<%- end -%>
<%- end -%>
<%- if node["mongodb"] -%>

View File

@ -45,15 +45,7 @@ Database::MySQL.defaults do |db|
end
<%- end -%>
<%- if node["backup"]["mysql"] -%>
Database::MySQL.defaults do |db|
db.host = "<%= node["backup"]["mysql"]["host"] %>"
db.username = "<%= node["backup"]["mysql"]["username"] %>"
db.password = "<%= node["backup"]["mysql"]["password"] %>"
db.additional_options = ['--quick', '--single-transaction']
end
<%- end -%>
<%- if node["backup"]["redis"] -%>
Database::Redis.defaults do |db|
db.host = "<%= node["backup"]["redis"]["host"] %>"
db.port = 6379
@ -61,13 +53,14 @@ Database::Redis.defaults do |db|
<%# db.password = "my_password"%>
<%# db.socket = "/tmp/redis.sock"%>
end
<%- end -%>
<%- if node["backup"]["postgresql"] -%>
Database::PostgreSQL.defaults do |db|
db.username = "<%= node["backup"]["postgresql"]["username"] %>"
db.password = "<%= node["backup"]["postgresql"]["password"] %>"
db.host = "<%= node["backup"]["postgresql"]["host"] %>"
db.port = 5432
db.port = "<%= node["backup"]["postgresql"]["port"] %>"
# db.socket = "/var/run/postgresql/.s.PGSQL.5432"
# When dumping all databases, `skip_tables` and `only_tables` are ignored.
db.skip_tables = []

View File

@ -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]

View File

@ -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

View File

@ -1,3 +0,0 @@
source "https://api.berkshelf.com"
metadata

View File

@ -1,6 +0,0 @@
source "https://rubygems.org"
gem "rake"
gem "test-kitchen"
gem "kitchen-vagrant"
gem "berkshelf"

View File

@ -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

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 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.

View File

@ -1,74 +0,0 @@
# ipfs Cookbook
This cookbook installs ipfs and starts it as a daemon
## Requirements
### Platforms
This cookbook is tested on Ubuntu 16.06, 14.04 and Debian 8 using Test Kitchen.
It currently only supports 64bit platforms
### Chef
- Chef 12.5 or later (we are providing a
[https://docs.chef.io/custom_resources.html](Custom Resource) to configure
IPFS
### Cookbook dependencies
- `ark` to download and uncompress the Go IPFS package
## Usage
### ipfs::default
Just include `ipfs` in your node's `run_list`:
```json
{
"name":"my_node",
"run_list": [
"recipe[ipfs]"
]
}
```
## Attributes
- `node.['ipfs']['version']` - the Go IPFS version to download from the official
site (64bit)
- `node['ipfs']['checksum']` - the SHA256 checksum for the package
- `node['ipfs']['config']['swarm']['addr_filter']` - the network ranges to not
connect to. This will stop platforms like Hetzner to block your server
(https://github.com/ipfs/go-ipfs/issues/1226)
## Resources
`ipfs_config` sets the config. Supports hashes, arrays, booleans and strings.
Does not change anything if the config already has that value, and restarts
the server automatically
```ruby
ipfs_config "Gateway.Writable" do
value "true"
end
```
## License and Authors
Authors: 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.
```

View File

@ -1,5 +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"]

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,8 +1,8 @@
name 'kosmos-hubot'
maintainer 'Kosmos'
maintainer_email 'mail@kosmos.org'
license 'All rights reserved'
description 'Installs/Configures kosmos-hubot'
license 'MIT'
description 'Configures Kosmos chat bots'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
@ -10,3 +10,4 @@ depends 'kosmos-nodejs'
depends 'kosmos-redis'
depends 'firewall'
depends 'application_javascript'
depends 'ipfs'

View File

@ -0,0 +1,129 @@
#
# Cookbook Name:: kosmos-hubot
# Recipe:: botka_freenode
#
# Copyright 2017-2018, Kosmos
#
include_recipe "kosmos-nodejs"
include_recipe "kosmos-redis"
botka_freenode_data_bag_item = Chef::EncryptedDataBagItem.load('credentials', 'botka_freenode')
botka_freenode_path = "/opt/botka_freenode"
application botka_freenode_path do
owner "hubot"
group "hubot"
git do
user "hubot"
group "hubot"
repository "https://github.com/67P/botka.git"
revision "master"
end
file "#{name}/external-scripts.json" do
mode "0640"
owner "hubot"
group "hubot"
content [
"hubot-help",
"hubot-redis-brain",
"hubot-remotestorage-logger",
"hubot-web-push-notifications",
].to_json
end
npm_install do
user "hubot"
end
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
template "/lib/systemd/system/botka_freenode_nodejs.service" do
source 'nodejs.systemd.service.erb'
owner 'root'
group 'root'
mode '0644'
variables(
user: "hubot",
group: "hubot",
app_dir: botka_freenode_path,
entry: "#{botka_freenode_path}/bin/hubot -a irc",
environment: {
"HUBOT_IRC_SERVER" => "irc.freenode.net",
"HUBOT_IRC_ROOMS" => "#5apps,#kosmos,#kosmos-dev,#kosmos-random,#remotestorage,#hackerbeach,#unhosted,#sockethub,#opensourcedesign,#openknot,#emberjs,#mastodon,#indieweb,#lnd",
"HUBOT_IRC_NICK" => "botka",
"HUBOT_IRC_NICKSERV_USERNAME" => "botka",
"HUBOT_IRC_NICKSERV_PASSWORD" => botka_freenode_data_bag_item['nickserv_password'],
"HUBOT_IRC_UNFLOOD" => "100",
"HUBOT_RSS_PRINTSUMMARY" => "false",
"HUBOT_RSS_PRINTERROR" => "false",
"HUBOT_RSS_IRCCOLORS" => "true",
# "HUBOT_LOG_LEVEL" => "error",
"EXPRESS_PORT" => "8081",
"HUBOT_AUTH_ADMIN" => "bkero,derbumi,galfert,gregkare,jaaan,slvrbckt,raucao",
"RS_LOGGER_USER" => "kosmos@5apps.com",
"RS_LOGGER_TOKEN" => botka_freenode_data_bag_item['rs_logger_token'],
"RS_LOGGER_SERVER_NAME" => "freenode",
"RS_LOGGER_PUBLIC" => "true",
"GCM_API_KEY" => botka_freenode_data_bag_item['gcm_api_key'],
"VAPID_SUBJECT" => "https://kosmos.org",
"VAPID_PUBLIC_KEY" => botka_freenode_data_bag_item['vapid_public_key'],
"VAPID_PRIVATE_KEY" => botka_freenode_data_bag_item['vapid_private_key']
}
)
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[botka_freenode_nodejs]", :delayed
end
service "botka_freenode_nodejs" do
action [:enable, :start]
end
end
#
# Nginx reverse proxy
#
unless node.chef_environment == "development"
express_port = 8081
express_domain = "freenode.botka.kosmos.org"
include_recipe "kosmos-base::letsencrypt"
include_recipe 'kosmos-nginx'
directory "/var/www/#{express_domain}/.well-known/acme-challenge" do
owner node["nginx"]["user"]
group node["nginx"]["group"]
recursive true
action :create
end
template "#{node['nginx']['dir']}/sites-available/#{express_domain}" do
source 'nginx_conf_hubot.erb'
owner node["nginx"]["user"]
mode 0640
variables express_port: express_port,
server_name: express_domain,
ssl_cert: "/etc/letsencrypt/live/#{express_domain}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{express_domain}/privkey.pem"
notifies :reload, 'service[nginx]', :delayed
end
nginx_site express_domain do
enable true
end
# FIXME This doesn't actually work on the first run. Apparently nginx is not
# reloaded after adding the vhost or sth, because it does work on the second
# run.
execute "letsencrypt cert for #{express_domain}" do
command "./certbot-auto certonly --webroot --agree-tos --email ops@5apps.com --webroot-path /var/www/#{express_domain} -d #{express_domain} -n"
cwd "/usr/local/certbot"
not_if { File.exist? "/etc/letsencrypt/live/#{express_domain}/fullchain.pem" }
notifies :create, "template[#{node['nginx']['dir']}/sites-available/#{express_domain}]", :immediately
end
end

View File

@ -2,9 +2,7 @@
# Cookbook Name:: kosmos-hubot
# Recipe:: default
#
# Copyright 2017, Kosmos
#
# All rights reserved - Do Not Redistribute
# Copyright 2017-2018, Kosmos
#
unless node.chef_environment == "development"
@ -14,11 +12,6 @@ unless node.chef_environment == "development"
protocol :tcp
command :allow
end
firewall_rule 'ipfs_swarm_p2p' do
port 4001
protocol :tcp
command :allow
end
end
include_recipe "kosmos-nodejs"
@ -35,220 +28,5 @@ user "hubot" do
shell "/bin/bash"
end
hal8000_freenode_data_bag_item = Chef::EncryptedDataBagItem.load('credentials', 'hal8000_freenode')
hal8000_path = "/opt/hal8000"
application hal8000_path do
owner "hubot"
group "hubot"
git do
user "hubot"
group "hubot"
repository "https://github.com/67P/hal8000.git"
revision "master"
end
file "#{name}/external-scripts.json" do
mode "0640"
owner "hubot"
group "hubot"
content [
"hubot-help",
"hubot-read-tweet",
"hubot-redis-brain",
"hubot-rules",
"hubot-shipit",
"hubot-plusplus",
"hubot-tell",
"hubot-seen",
"hubot-rss-reader",
"hubot-incoming-webhook",
"hubot-auth",
"hubot-kredits",
].to_json
end
npm_install do
user "hubot"
end
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
template "/lib/systemd/system/hal8000_nodejs.service" do
source 'nodejs.systemd.service.erb'
owner 'root'
group 'root'
mode '0644'
variables(
user: "hubot",
group: "hubot",
app_dir: hal8000_path,
entry: "#{hal8000_path}/bin/hubot -a irc",
environment: {
# "HUBOT_LOG_LEVEL" => "error",
"HUBOT_IRC_SERVER" => "irc.freenode.net",
"HUBOT_IRC_ROOMS" => "#5apps,#kosmos,#kosmos-dev,#kosmos-random,#remotestorage,#hackerbeach,#unhosted,#sockethub",
"HUBOT_IRC_NICK" => "hal8000",
"HUBOT_IRC_NICKSERV_USERNAME" => "hal8000",
"HUBOT_IRC_NICKSERV_PASSWORD" => hal8000_freenode_data_bag_item['nickserv_password'],
"HUBOT_IRC_UNFLOOD" => "100",
"HUBOT_RSS_PRINTSUMMARY" => "false",
"HUBOT_RSS_PRINTERROR" => "false",
"HUBOT_RSS_IRCCOLORS" => "true",
"HUBOT_PLUSPLUS_POINTS_TERM" => "karma,karma",
"EXPRESS_PORT" => "8080",
"HUBOT_RSS_HEADER" => "Update:",
"HUBOT_AUTH_ADMIN" => "bkero,derbumi,galfert,gregkare,slvrbckt,raucao",
"WEBHOOK_TOKEN" => hal8000_freenode_data_bag_item['webhook_token'],
"IPFS_API_HOST" => node['hal8000']['kredits']['ipfs_host'],
"IPFS_API_PORT" => node['hal8000']['kredits']['ipfs_port'],
"IPFS_API_PROTOCOL" => node['hal8000']['kredits']['ipfs_protocol'],
"KREDITS_ROOM" => node['hal8000']['kredits']['room'],
"KREDITS_WEBHOOK_TOKEN" => hal8000_freenode_data_bag_item['kredits_webhook_token'],
"KREDITS_PROVIDER_URL" => node['hal8000']['kredits']['provider_url'],
"KREDITS_NETWORK_ID" => node['hal8000']['kredits']['network_id'],
"KREDITS_WALLET_PATH" => node['hal8000']['kredits']['wallet_path'],
"KREDITS_WALLET_PASSWORD" => hal8000_freenode_data_bag_item['kredits_wallet_password'],
"KREDITS_MEDIAWIKI_URL" => node['hal8000']['kredits']['mediawiki_url'],
"KREDITS_GITHUB_REPO_BLACKLIST" => node['hal8000']['kredits']['github_repo_blacklist']
}
)
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[hal8000_nodejs]", :delayed
end
cookbook_file "#{name}/wallet.json" do
source "wallet.json"
end
service "hal8000_nodejs" do
action [:enable, :start]
end
end
botka_freenode_data_bag_item = Chef::EncryptedDataBagItem.load('credentials', 'botka_freenode')
botka_freenode_path = "/opt/botka_freenode"
application botka_freenode_path do
owner "hubot"
group "hubot"
git do
user "hubot"
group "hubot"
repository "https://github.com/67P/botka.git"
revision "master"
end
file "#{name}/external-scripts.json" do
mode "0640"
owner "hubot"
group "hubot"
content [
"hubot-help",
"hubot-redis-brain",
"hubot-remotestorage-logger",
"hubot-web-push-notifications",
].to_json
end
npm_install do
user "hubot"
end
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
template "/lib/systemd/system/botka_freenode_nodejs.service" do
source 'nodejs.systemd.service.erb'
owner 'root'
group 'root'
mode '0644'
variables(
user: "hubot",
group: "hubot",
app_dir: botka_freenode_path,
entry: "#{botka_freenode_path}/bin/hubot -a irc",
environment: {
"HUBOT_IRC_SERVER" => "irc.freenode.net",
"HUBOT_IRC_ROOMS" => "#5apps,#kosmos,#kosmos-dev,#kosmos-random,#remotestorage,#hackerbeach,#unhosted,#sockethub,#opensourcedesign,#openknot,#emberjs,#mastodon,#indieweb,#lnd",
"HUBOT_IRC_NICK" => "botka",
"HUBOT_IRC_NICKSERV_USERNAME" => "botka",
"HUBOT_IRC_NICKSERV_PASSWORD" => botka_freenode_data_bag_item['nickserv_password'],
"HUBOT_IRC_UNFLOOD" => "100",
"HUBOT_RSS_PRINTSUMMARY" => "false",
"HUBOT_RSS_PRINTERROR" => "false",
"HUBOT_RSS_IRCCOLORS" => "true",
# "HUBOT_LOG_LEVEL" => "error",
"EXPRESS_PORT" => "8081",
"HUBOT_AUTH_ADMIN" => "bkero,derbumi,galfert,gregkare,jaaan,slvrbckt,raucao",
"RS_LOGGER_USER" => "kosmos@5apps.com",
"RS_LOGGER_TOKEN" => botka_freenode_data_bag_item['rs_logger_token'],
"RS_LOGGER_SERVER_NAME" => "freenode",
"RS_LOGGER_PUBLIC" => "true",
"GCM_API_KEY" => botka_freenode_data_bag_item['gcm_api_key'],
"VAPID_SUBJECT" => "https://kosmos.org",
"VAPID_PUBLIC_KEY" => botka_freenode_data_bag_item['vapid_public_key'],
"VAPID_PRIVATE_KEY" => botka_freenode_data_bag_item['vapid_private_key']
}
)
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[botka_freenode_nodejs]", :delayed
end
service "botka_freenode_nodejs" do
action [:enable, :start]
end
end
#
# Nginx reverse proxy
#
express_port = 8081
express_domain = "freenode.botka.kosmos.org"
unless node.chef_environment == "development"
include_recipe "kosmos-base::letsencrypt"
end
include_recipe 'kosmos-nginx'
directory "/var/www/#{express_domain}/.well-known/acme-challenge" do
owner node["nginx"]["user"]
group node["nginx"]["group"]
recursive true
action :create
end
template "#{node['nginx']['dir']}/sites-available/#{express_domain}" do
source 'nginx_conf_hubot.erb'
owner node["nginx"]["user"]
mode 0640
variables express_port: express_port,
server_name: express_domain,
ssl_cert: "/etc/letsencrypt/live/#{express_domain}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{express_domain}/privkey.pem"
notifies :reload, 'service[nginx]', :delayed
end
nginx_site express_domain do
enable true
end
# FIXME This doesn't actually work on the first run. Apparently nginx is not
# reloaded after adding the vhost or sth, because it does work on the second
# run.
unless node.chef_environment == "development"
execute "letsencrypt cert for #{express_domain}" do
command "./certbot-auto certonly --webroot --agree-tos --email ops@5apps.com --webroot-path /var/www/#{express_domain} -d #{express_domain} -n"
cwd "/usr/local/certbot"
not_if { File.exist? "/etc/letsencrypt/live/#{express_domain}/fullchain.pem" }
notifies :create, "template[#{node['nginx']['dir']}/sites-available/#{express_domain}]", :immediately
end
end
include_recipe "kosmos-hubot::hal8000"
include_recipe "kosmos-hubot::botka_freenode"

View File

@ -0,0 +1,121 @@
#
# Cookbook Name:: kosmos-hubot
# Recipe:: hal8000
#
# Copyright 2017-2018, Kosmos
#
include_recipe "kosmos-nodejs"
include_recipe "kosmos-redis"
# Needed for hubot-kredits
include_recipe "kosmos-ipfs"
unless node.chef_environment == "development"
include_recipe 'firewall'
firewall_rule 'hubot_express_hal8000_freenode' do
port 8080
protocol :tcp
command :allow
end
firewall_rule 'ipfs_swarm_p2p' do
port 4001
protocol :tcp
command :allow
end
end
hal8000_freenode_data_bag_item = Chef::EncryptedDataBagItem.load('credentials', 'hal8000_freenode')
hal8000_path = "/opt/hal8000"
application hal8000_path do
owner "hubot"
group "hubot"
git do
user "hubot"
group "hubot"
repository "https://github.com/67P/hal8000.git"
revision "master"
end
file "#{name}/external-scripts.json" do
mode "0640"
owner "hubot"
group "hubot"
content [
"hubot-help",
"hubot-read-tweet",
"hubot-redis-brain",
"hubot-rules",
"hubot-shipit",
"hubot-plusplus",
"hubot-tell",
"hubot-seen",
"hubot-rss-reader",
"hubot-incoming-webhook",
"hubot-auth",
"hubot-kredits",
].to_json
end
npm_install do
user "hubot"
end
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
template "/lib/systemd/system/hal8000_nodejs.service" do
source 'nodejs.systemd.service.erb'
owner 'root'
group 'root'
mode '0644'
variables(
user: "hubot",
group: "hubot",
app_dir: hal8000_path,
entry: "#{hal8000_path}/bin/hubot -a irc",
environment: {
# "HUBOT_LOG_LEVEL" => "error",
"HUBOT_IRC_SERVER" => "irc.freenode.net",
"HUBOT_IRC_ROOMS" => "#5apps,#kosmos,#kosmos-dev,#kosmos-random,#remotestorage,#hackerbeach,#unhosted,#sockethub",
"HUBOT_IRC_NICK" => "hal8000",
"HUBOT_IRC_NICKSERV_USERNAME" => "hal8000",
"HUBOT_IRC_NICKSERV_PASSWORD" => hal8000_freenode_data_bag_item['nickserv_password'],
"HUBOT_IRC_UNFLOOD" => "100",
"HUBOT_RSS_PRINTSUMMARY" => "false",
"HUBOT_RSS_PRINTERROR" => "false",
"HUBOT_RSS_IRCCOLORS" => "true",
"HUBOT_PLUSPLUS_POINTS_TERM" => "karma,karma",
"EXPRESS_PORT" => "8080",
"HUBOT_RSS_HEADER" => "Update:",
"HUBOT_AUTH_ADMIN" => "bkero,derbumi,galfert,gregkare,slvrbckt,raucao",
"WEBHOOK_TOKEN" => hal8000_freenode_data_bag_item['webhook_token'],
"IPFS_API_HOST" => node['hal8000']['kredits']['ipfs_host'],
"IPFS_API_PORT" => node['hal8000']['kredits']['ipfs_port'],
"IPFS_API_PROTOCOL" => node['hal8000']['kredits']['ipfs_protocol'],
"KREDITS_ROOM" => node['hal8000']['kredits']['room'],
"KREDITS_WEBHOOK_TOKEN" => hal8000_freenode_data_bag_item['kredits_webhook_token'],
"KREDITS_PROVIDER_URL" => node['hal8000']['kredits']['provider_url'],
"KREDITS_NETWORK_ID" => node['hal8000']['kredits']['network_id'],
"KREDITS_WALLET_PATH" => node['hal8000']['kredits']['wallet_path'],
"KREDITS_WALLET_PASSWORD" => hal8000_freenode_data_bag_item['kredits_wallet_password'],
"KREDITS_MEDIAWIKI_URL" => node['hal8000']['kredits']['mediawiki_url'],
"KREDITS_GITHUB_REPO_BLACKLIST" => node['hal8000']['kredits']['github_repo_blacklist']
}
)
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[hal8000_nodejs]", :delayed
end
cookbook_file "#{name}/wallet.json" do
source "wallet.json"
end
service "hal8000_nodejs" do
action [:enable, :start]
end
end

View File

@ -0,0 +1,3 @@
# Override to connect to the IPFS cluster proxy on port 9095
# (https://cluster.ipfs.io/documentation/composite-clusters/)
node.default['kosmos-ipfs']['nginx']['api_port'] = 5001

View File

@ -9,3 +9,4 @@ version '0.1.0'
depends 'ipfs'
depends 'kosmos-base'
depends 'kosmos-nginx'
depends 'firewall'

View File

@ -0,0 +1,20 @@
#
# Cookbook Name:: kosmos-ipfs
# Recipe:: cluster
#
# Copyright 2018, Kosmos
#
# All rights reserved - Do Not Redistribute
#
include_recipe "ipfs::cluster"
include_recipe "ipfs::cluster_service"
unless node.chef_environment == "development"
include_recipe "firewall"
firewall_rule 'ipfs_cluster' do
port 9096
protocol :tcp
command :allow
end
end

View File

@ -7,7 +7,6 @@
# All rights reserved - Do Not Redistribute
#
require 'json'
include_recipe "ipfs"
# Configure ipfs
@ -33,4 +32,11 @@ ipfs_config "API.HTTPHeaders.Access-Control-Allow-Origin" do
value ["*"]
end
include_recipe "kosmos-ipfs::letsencrypt"
unless node.chef_environment == "development"
include_recipe 'firewall'
firewall_rule 'ipfs_swarm_p2p' do
port 4001
protocol :tcp
command :allow
end
end

View File

@ -31,7 +31,7 @@ template "#{node['nginx']['dir']}/sites-available/ipfs.kosmos.org" do
root_directory: root_directory,
ssl_cert: "/etc/letsencrypt/live/ipfs.kosmos.org/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/ipfs.kosmos.org/privkey.pem",
ipfs_api_port: 5001,
ipfs_api_port: node['kosmos-ipfs']['nginx']['api_port'],
ipfs_external_api_port: 5444
notifies :reload, 'service[nginx]', :delayed

View File

@ -48,7 +48,7 @@ npm_package "yarn" do
version "1.6.0"
end
ruby_version = "2.5.1"
ruby_version = "2.5.3"
application mastodon_path do
owner "mastodon"
@ -180,10 +180,18 @@ application mastodon_path do
end
end
#
# Backup
#
unless node.chef_environment == "development"
# Backup the database to S3
node.override["backup"]["postgresql"]["host"] = "localhost"
node.override["backup"]["postgresql"]["username"] = "postgres"
node.override["backup"]["postgresql"]["password"] = node['postgresql']['password']['postgres']
unless node["backup"]["postgresql"]["databases"].include? 'mastodon'
node.override["backup"]["postgresql"]["databases"] =
node["backup"]["postgresql"]["databases"].to_a << "mastodon"
end
include_recipe "backup"
end