Giter VIP home page Giter VIP logo

chef-storj's Introduction

Description

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.

Changes

v 0.1.1

  • Rename cookbooks to use underscores
  • Rename all instances of farmer to share
  • Move bridge, bridge-proxy and bridge-db recipes to this cookbook

v 0.1.0

Requirements

  • A computer or something that closely resembles one

Attributes

Default

default['storj']['user'] = 'storj'
default['storj']['group'] = 'storj'
default['storj']['home'] = '/opt/storj'

Bridge

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

Share

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'

Recipes

bridge

This recipe installs and configures the Storj Bridge API.

bridge_db

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

Config Server Replica Set

Initiate the Replica Set

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" }
    ]
  }
)

MongoD Replica Set

Increase the MongoDB Oplog Size

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

Initiate the Replia Set

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" }
      ]
  }
)

bridge_proxy

This recipe installs and configures the Bridge proxy which allows you to run multiple instances of the Bridge behind an Nginx proxy for scalability.

share

This recipe installs and configures the StorjShare farmer.

default

This recipe sets up the user and group used by all Storj services.

Resources/Providers

In the future we will likely move all install_X recipes to resource providers.

Usage

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.

Examples

Better usage examples coming soon...

License and Author

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.

chef-storj's People

Contributors

phutchins avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.