Coder Social home page Coder Social logo

tentd's Introduction

Tentd - Protocol v0.3 Build Status

If you're looking to self-host, see tentd-omnibus.

tentd is an alpha implementation of a Tent Protocol server. It currently contains broken code, many bugs, and security flaws. The code should only be used to experiment with how Tent works. Under no circumstances should the code in its current form be used for data that is supposed to be private.

Setup

ENV Variables

name required description
TENT_ENTITY Required Entity URI (can be omitted if env['current_user'] is set to an instance of TentD::Model::User prior to TentD::API::UserLookup being called)
DATABASE_URL Required URL of postgres database (e.g. postgres://localhost/tentd)
REDIS_URL Required URL of redis server (e.g. redis://localhost:6379)
REDIS_NAMESPACE Optional Redis key namespace for sidekiq (defaults to not set)
RUN_SIDEKIQ Optional Set to 'true' if you want to boot sidekiq via config.ru
SIDEKIQ_LOG Optional Sidekiq log file (defaults to STDOUT and STDERR)
SOFT_DELETE Optional To perminently delete db records, set to false. Defaults to true (sets deleted_at timestamp instead of removing from db)
API_ROOT Optional Required if different from TENT_ENTITY
SERVER_PORT Optional Exposed server port (e.g. 443)

Attachment Storage Options

Precedence is in the same order as listed below.

name env description
Amazon S3 AWS_ACCESS_KEY_ID Access key identifier
       | AWS_SECRET_ACCESS_KEY            | Access key
       | S3_BUCKET                        | Bucket name

Google | GOOGLE_STORAGE_ACCESS_KEY_ID | Access key identifier | GOOGLE_STORAGE_SECRET_ACCESS_KEY | Access key | GOOGLE_BUCKET | Bucket name Rackspace | RACKSPACE_USERNAME | Username | RACKSPACE_API_KEY | Api key | RACKSPACE_AUTH_URL | Auth URL (European Rackspace) | RACKSPACE_CONTAINER | Container (bucket) name Filesystem | LOCAL_ATTACHMENTS_ROOT | Path to directory (e.g. ~/tent-attachments) Postgres | POSTGRES_ATTACHMENTS | Default. Set to true to override any of the other options.

Database Setup

createdb tentd
DATABASE_URL=postgres://localhost/tentd bundle exec rake db:migrate

Running Server

bundle exec unicorn

Running Sidekiq

bundle exec sidekiq -r ./sidekiq.rb

or

RUN_SIDEKIQ=true bundle exec unicorn

Heroku

heroku create --addons heroku-postgresql:dev,rediscloud:20
heroku pg:promote $(heroku pg | head -1 | cut -f2 -d" ")
heroku config:add TENT_ENTITY=$(heroku info -s | grep web_url | cut -f2 -d"=" | sed 's/http/https/' | sed 's/\/$//')
git push heroku master
heroku run rake db:migrate

Note: You will need to checkin Gemfile.lock after running bundle install to push to heroku

Testing

ENV Variables

name required description
TEST_DATABASE_URL Required URL of postgres database.
TEST_VALIDATOR_TEND_DATABASE_URL Required URL of postgres database.
REDIS_URL Optional Defaults to redis://localhost:6379/0. A redis server is required.

Running Tests

bundle exec rake

Advanced

Sidekiq Config

# sidekiq client (see `config.ru`)
require 'tentd/worker'

# pass redis options directly
TentD::Worker.configure_client(:namespace => 'tentd.worker')

# access sidekiq config directly
TentD::Worker.configure_client do |sidekiq_config|
  # do stuff
end
# sidekiq server (see `sidekiq.rb`)
require 'tentd/worker'

# pass redis options directly
TentD::Worker.configure_server(:namespace => 'tentd.worker')

# access sidekiq config directly
TentD::Worker.configure_server do |sidekiq_config|
  # do stuff
end
# run sidekiq server from current proccess
require 'tentd/worker'

sidekiq_pid = TentD::Worker.run_server(:namespace => 'tentd.worker')

at_exit do
  Process.kill("INT", sidekiq_pid)
end

Note that blocks are called after calling config.redis = options (see lib/tentd/worker.rb)

Contributing

  • Refactor. The current code was hacked together quickly and is pretty ugly.

tentd's People

Contributors

jvatic avatar titanous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.