• This repository has been archived on 16/Feb/2018
  • Stars
    star
    504
  • Rank 87,509 (Top 2 %)
  • Language
    Ruby
  • License
    BSD 3-Clause "New...
  • Created about 12 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reference implementation of a Tent server in Ruby

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.

More Repositories

1

tent.io

The website for Tent — the protocol for evented data storage and decentralized communication
HTML
798
star
2

sigil

Identicon generator
Go
337
star
3

rdb

Redis RDB parser for Go
Go
174
star
4

mannersagain

Drop-in graceful hot restarting of net/http servers
Go
98
star
5

tent-status

Microblogging powered by Tent
CoffeeScript
88
star
6

hawk-go

Hawk authentication implementation in Go
Go
76
star
7

tentd-admin

JavaScript
75
star
8

gokiq

Sidekiq-style background jobs in Go
Go
61
star
9

setdb

The Redis protocol on top of LevelDB, written in Go (WIP)
Go
58
star
10

tentd-omnibus

tentd + tent-status + tent-admin in an integrated bundle
Ruby
51
star
11

react-modal

Modal component for React
JavaScript
30
star
12

hawk-ruby

Ruby implementation of Hawk HTTP authentication scheme
Ruby
24
star
13

react-scroll-pagination

Infinite scroll component for React
JavaScript
22
star
14

tent-schemas

JSON schemas for Tent
Ruby
20
star
15

tent-client-ruby

Ruby Tent protocol client
Ruby
20
star
16

hawk-objc

Hawk authentication implementation in Objective-C
Objective-C
19
star
17

sparklemotion

Appcasting from dawn 'til dusk
Go
14
star
18

tent-client-go

Go Tent protocol client
Go
12
star
19

jsonschema

Go
11
star
20

http-link-go

HTTP Link parsing in Go
Go
11
star
21

tent-admin

Admin app for Tent
CoffeeScript
10
star
22

messenger-ios

Tent group messaging on iOS
Objective-C
9
star
23

tent-validator

Ruby
8
star
24

tent-client-objc

Tent protocol client for Objective-C
Objective-C
8
star
25

json-pointer-ruby

Ruby
7
star
26

omniauth-tent

Ruby
5
star
27

tent-markdown-js

Tent dialect for markdown-js
JavaScript
5
star
28

pkcs10

PKCS#10 (Certificate Signing Request) implementation in Go
Go
4
star
29

sequel-json

Sequel ORM Plugin for serializing columns as JSON
Ruby
4
star
30

marbles-tent-client-js

Javascript Tent client built on the HTTP component of Marbles.js for the browser
JavaScript
4
star
31

tent-migrate

Ruby
3
star
32

tent-apidoc

Ruby
3
star
33

files-web

JavaScript
3
star
34

messenger-web

Tent private messaging app
JavaScript
3
star
35

antechamber

A HTTP proxy that solves image mixed-content warnings
Go
3
star
36

goamz

Fork of https://launchpad.net/goamz
Go
3
star
37

snowdrift

Yet another URL shortener
Go
2
star
38

apns

Yet another APNS library in Go
Go
2
star
39

sfilter

Recursive struct -> map conversion with field filtering
Go
2
star
40

text-entities-go

URL and Hashtag extraction
Go
2
star
41

tent-examples-go

Go
2
star
42

rack-putty

Simple web framework built on rack for mapping sinatra-like routes to middleware stacks
Ruby
2
star
43

canonical-json-go

Canonical JSON marshaling in Go
Go
2
star
44

tent-canonical-json-ruby

Ruby
2
star
45

libattic

C++
1
star
46

icing

Custom Bootstrap CSS
CSS
1
star
47

nike

Project management that isn't awful
JavaScript
1
star
48

apps-bar

CSS
1
star
49

boiler-web

Ruby
1
star
50

stripe

Stripe client in Go
Go
1
star
51

api-validator

Ruby
1
star