This cookbook deploys and configures the various Storj services. It is intended to be as open minded as possible such that you can build a local dev cluster using chef-zero or deploy production infrastructure.
- Rename cookbooks to use underscores
- Rename all instances of farmer to share
- Move bridge, bridge-proxy and bridge-db recipes to this cookbook
- A computer or something that closely resembles one
default['storj']['user'] = 'storj'
default['storj']['group'] = 'storj'
default['storj']['home'] = '/opt/storj'
default['storj']['bridge']['repo'] = 'https://github.com/Storj/bridge.git'
default['storj']['bridge']['revision'] = 'v0.7.3'
default['storj']['bridge']['version'] = 'v0.7.3'
default['storj']['bridge']['home'] = node['storj']['home']
default['storj']['bridge']['config-dir'] = '.storj-bridge'
default['storj']['bridge']['node-env'] = 'production'
default['storj']['bridge']['app-dir'] = "#{node['storj']['bridge']['home']}/bridge"
default['storj']['bridge']['user'] = 'storj'
default['storj']['bridge']['group'] = 'storj'
default['storj']['bridge']['log-dir'] = '/var/log/storj'
# This is overrideen per environment
default['storj']['bridge']['url'] = 'api.storj.io'
# These are the defaults for creating a Bridge API node
default['storj']['bridge']['server-host'] = node['storj']['bridge']['url']
default['storj']['bridge']['server-port'] = 8080,
default['storj']['bridge']['server-ssl-cert'] = true
default['storj']['bridge']['storage']['db1'] = {
"name" => "bridge",
"host" => "localhost",
"port" => 27017,
"ssl" => false,
"user" => nil,
"pass" => nil,
"mongos" => {
"checkServerIdentity" => false,
"ssl" => false,
"sslValidate" => false
}
}
default['storj']['bridge']['network']['minions']['minion1'] = {
"bridge" => false,
"address" => "127.0.0.1",
"port" => 8443,
"tunport" => 8444,
"datadir" => File.join(node['storj']['bridge']['home'], node['storj']['bridge']['config-dir'], 'data'),
"tunnels" => 32,
"gateways" => {
"min" => 8500,
"max" => 8532
},
"privkey" => nil
}
default['storj']['bridge']['mailer']['host'] = 'localhost'
default['storj']['bridge']['mailer']['port'] = 465
default['storj']['bridge']['mailer']['auth']['user'] = nil
default['storj']['bridge']['mailer']['auth']['pass'] = nil
default['storj']['bridge']['mailer']['secure'] = true
default['storj']['bridge']['mailer']['from'] = '[email protected]'
default['storj']['share']['user'] = 'storj'
default['storj']['share']['group'] = 'storj'
default['storj']['share']['home'] = node['storj']['home']
default['storj']['share']['version'] = 'v0.7.3'
default['storj']['share']['app_dir'] = "#{node['storj']['share']['home']}/share"
default['storj']['share']['log_dir'] = '/var/log/storj'
default['storj']['share']['log_file'] = 'share.log'
default['storj']['share']['repo'] = 'https://github.com/Storj/storjshare-cli.git'
default['storj']['share']['node_env'] = 'production'
default['storj']['share']['revision'] = 'HEAD'
default['storj']['share']['node_index'] = 'bin/farmer.js'
default['storj']['share']['password'] = 'thisshouldbeasupersecurepasswordforyourfarmer'
default['storj']['share']['data_dir'] = '.storjshare'
default['storj']['share']['key_file'] = 'id_ecdsa'
default['storj']['share']['payment_address'] = '12sudHQtCt8Wp9X7V9U69CjzG6SFCKvgEZ'
default['storj']['share']['storage']['size'] = 10
default['storj']['share']['storage']['unit'] = 'GB'
default['storj']['share']['network']['port'] = 4000
default['storj']['share']['network']['seeds'] = [ "storj://api.storj.io:8443/593844dc7f0076a1aeda9a6b9788af17e67c1052" ]
default['storj']['share']['network']['forward'] = 'true'
default['storj']['share']['network']['tunnels'] = 10
default['storj']['share']['network']['tunnelport'] = 8444
default['storj']['share']['network']['gateways']['min'] = 8500
default['storj']['share']['network']['gateways']['max'] = 8520
default['storj']['share']['telemetry']['service'] = 'http://status.storj.io'
default['storj']['share']['telemetry']['enabled'] = 'true'
This recipe installs and configures the Storj Bridge API.
This recipe installs and configures the Bridge api's DB.
Curently, this recipe does not set up the cluster. In the future I will be implementing the mongodb chef cookbook to manage the cluster. Details on that cookbook can be found here: https://github.com/phutchins/chef-mongodb
rs.initiate(
{
_id: "config",
configsvr: true,
members: [
{ _id : 0, host : "bridge-db-g3e3:27019" },
{ _id : 1, host : "bridge-db-ru97:27019" },
{ _id : 2, host : "bridge-db-aokr:27019" }
]
}
)
For an existing cluster, refer to the MongoDB docs (here)[https://docs.mongodb.com/manual/tutorial/change-oplog-size/]...
From a fresh cluster first delete the current oplog.rs db. The instance must not be configured as a replicaset so it must be reconfigured and restarted if it is.
Then create the new capped colleciton setting the size. The following command will create a 10GB oplog. The larger the oplog, the longer you can go with a node down before having to do a full resync to that node. The time frame is dictated by the number and size of transactions that happen per minute on your database.
db.runCommand( { create: "oplog.rs", capped: true, size: (10 * 1024 * 1024 * 1024) } )
rs.initiate(
{
_id : "storj-bridge",
members: [
{ _id : 0, host : "bridge-db-g3e3:27017" },
{ _id : 1, host : "bridge-db-ru97:27017" },
{ _id : 2, host : "bridge-db-aokr:27017" }
]
}
)
This recipe installs and configures the Bridge proxy which allows you to run multiple instances of the Bridge behind an Nginx proxy for scalability.
This recipe installs and configures the StorjShare farmer.
This recipe sets up the user and group used by all Storj services.
In the future we will likely move all install_X recipes to resource providers.
To install a Storj service, simply include the recipe for the service that you desire to install in a runlist, role or wrapper cookbook recipe and override any attributes as needed.
Better usage examples coming soon...
Author:: Philip Hutchins
Copyright:: 2016, Storj Labs
Licensed under the AGPL License, Version 3.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.gnu.org/licenses/agpl-3.0.en.html
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.