• This repository has been archived on 27/Oct/2018
  • Stars
    star
    195
  • Rank 192,414 (Top 4 %)
  • Language
    CoffeeScript
  • License
    MIT License
  • Created over 10 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

Node server that receives metric data over HTTP & forwards to your service of choice

Bucky Server

Bucky uses a Node server to forward the HTTP requests with your monitoring data to Statsd/Graphite, OpenTSDB, or whatever other service you'd like.

Also see the Bucky Client.

Hosting

Everything you need to run Bucky on Heroku or Nodejitsu is included, just update the config file and push to the service of your choice.

Heroku

heroku create
git push heroku master

Nodejitsu

jitsu deploy

The jitsu application will ask you for a subdomain to run the service on, and will increment the version of the application whenever you deploy.

EC2 / Bare Metal

If you'd rather host Bucky on EC2 directly or on raw hardware, you just need something which will run ./start.js in a reliable way.

You can use environment variables to control runtime options, or put them in your config file in the server section.

You'll need to have nodejs installed. Anything in the 0.8.x series or above should work fine. We recommend using nvm, as it gives you an extra dimension of flexibility, but using your system's package manager should work just as well.

# In the project directory:

npm install
PORT=3333 APP_ROOT=bucky/ ./start.js

The APP_ROOT (or config.server.appRoot) will prefix all endpoints.

Bucky will respond to all requests at /APP_ROOT/v1/health-check, if you need a health check url.

Bucky can be setup to receive data at multiple endpoints, but by default it listens to /APP_ROOT/v1/send on whichever port you specify.

Ubuntu (12.04)

# Install nodejs
# This assumes you're on a 64 bit machine
wget http://nodejs.org/dist/v0.10.19/node-v0.10.19-linux-x64.tar.gz
tar xvf node-v0.10.19-linux-x64.tar.gz 
sudo ln -s `pwd`/node-v0.10.19-linux-x64/bin/{node,npm} /usr/local/bin/

# Grab a Bucky release
# You should use the latest release available at https://github.com/HubSpot/BuckyServer/releases
wget https://github.com/HubSpot/BuckyServer/archive/v0.3.0.tar.gz -O BuckyServer.tar.gz
tar xvf BuckyServer.tar.gz
cd BuckyServer

# Install Bucky
sudo npm install -g

# Make any config changes by editing /usr/local/lib/node_modules/bucky-server/config/default.yaml

# You can start bucky by running bucky-server

# Add the upstart script so Bucky starts on startup and respawns
sudo cp init/bucky-server.conf /etc/init/

# Start Bucky with
sudo start bucky-server

# Log files will appear in /var/log/bucky.log by default

You can run bucky on a specific port (make sure to open that port in your security group if you're using EC2), or you can use a reverse proxy like Nginx or HAProxy to serve it on the same domain and port as your website, it's up to you.

Configuring

If you're not already running a stats collection service, you should take a look at our help doc.

Most people will only need to specify the config they're interested in and start up the server.

If you need more customization, you can write a module:

Modules

There are a few of types of modules:

  • Logger - Use to have Bucky log to something other than the console
  • Config - Use to have Bucky pull config from somewhere other than the default file
  • App - Use to do things when Bucky loads and/or on requests. Auth, monitoring initialization, etc.
  • Collectors - Use to send Bucky data to new and exciting places.

We can only have one logger and one config, but you can specify as many app and collector modules as you like.

All modules follow the same basic sketch. You export a method which is called when Bucky starts up. That method is provided with as much of {app, config, logger} as we have loaded so far, and is expected to call a callback when it's ready for the loading to continue.

Logger

Used to log output. Defaults to a wrapper around console.log/console.error.

Should export a function which will be called when the server is started:

module.exports = ({logger}, next) ->
  # logger is the previous logger (just the console)

  next myNewLogger

This function should call the callback with a logger object which implements log and error:

module.exports = ({logger}, next) ->
  myNewLogger = {
    log: ->
      console.log "Bucky message:", arguments...
    error: ->
      console.error "Bucky error:", arguments...
  }

  next myNewLogger

Config

By default config comes from the config files loaded using the node config module.

If specified, this module will replace that config. Please note that the list of modules comes from the config module, so the list of modules must always be specified there. All other config options can be moved to your config solution of choice using this extension point.

At HubSpot, we're believers in config which can be changed without restarting services. For this reason, the config api is a bit more complex than you might expect. A wrapper is provided in lib/configWrapper.coffee for you to use should you wish to use a simpler solution.

module.exports = ({config, logger}, next) ->
  # config is the old config which was being used
  # before this module was loaded

  # logger.log and logger.error should be used rather than
  # console

  next myConfigObject

A config value will be retrieved from the config object the callback is called with like this:

  config.get('some.config').get()

  config.get('some.config').on 'change', ->
    # The config changed!

You are free to implement the on method as a dud if live reloading doesn't make sense using your config system. Take a look at lib/configWrapper.coffee for an example of how a basic object can be converted (and feel free to use it).

App

App modules get loaded once, and can optionally provide a function to be ran with each request.

Simple app modules are a good place to put any server config, initialization code, etc.

We use app modules to make little tweaks to how express works and enable monitoring.

App modules are called at initialize-time with a hash including a reference to the express app:

module.exports = ({app, logger, config}, next) ->

If your app module calls the callback with a function, that function will be executed on all requests to /v1/send, which is the default endpoint.

If the callback is called with a hash, it is expected to be a mapping between endpoints and handler functions.

module.exports = ({app, logger, config}, next) ->
  next
    send: (req, res, _next) ->
      # Standard express request handling stuff in here

    someOtherEndpoint: (req, res, _next) ->
       # Will get requests which are sent to /v1/someOtherEndpoint

These functions work like middleware, they are called sequentially. You can use them to implement things like auth if you need it.

Collectors

It's not a standard type of module (the core of Bucky has no idea about it), but the default collectors app module looks to a fourth type of module to know where to send data.

Statsd and OpenTSDB collectors are included.

Collectors should export a function which is called on initialize, and call the callback with a hash mapping endpoints to handlers.

module.exports = ({app, logger, config}, next) ->
  next
    send: (data) ->
      # This collector will receive any requests to /v1/send (the default endpoint)

      logger.log "We got some data!"

Format

If you are interested in writing new clients, the format of metric data is the same as is used by statsd:

<metric name>:<metric value>|<unit>[@<sample rate>]

For example:

my.awesome.metric:35|ms
some.other.metric:3|[email protected]

All requests are sent with content-type text/plain.

More Repositories

1

youmightnotneedjquery

Astro
14,118
star
2

offline

Automatically display online/offline indication to your users
CSS
8,679
star
3

odometer

Smoothly transitions numbers with ease. #hubspot-open-source
CSS
7,259
star
4

vex

A modern dialog library which is highly configurable and easy to style. #hubspot-open-source
CSS
6,932
star
5

messenger

Growl-style alerts and messages for your app. #hubspot-open-source
JavaScript
4,035
star
6

drop

A library for creating dropdowns and other floating elements. #hubspot-open-source
CSS
2,360
star
7

BuckyClient

Collect performance data from the client
CoffeeScript
1,738
star
8

sortable

Drop-in script to make tables sortable
CSS
1,322
star
9

select

Styleable select elements built on Tether. #hubspot-open-source
JavaScript
1,197
star
10

humanize

A simple utility library for making the web more humane. #hubspot-open-source
JavaScript
907
star
11

Singularity

Scheduler (HTTP API and webapp) for running Mesos tasksโ€”long running processes, one-off tasks, and scheduled jobs. #hubspot-open-source
Java
816
star
12

tooltip

CSS Tooltips built on Tether. #hubspot-open-source
CSS
711
star
13

jinjava

Jinja template engine for Java
Java
653
star
14

signet

Display a unique seal in the developer console of your page
CoffeeScript
564
star
15

draft-convert

Extensibly serialize & deserialize Draft.js ContentState with HTML.
JavaScript
483
star
16

hubspot-php

HubSpot PHP API Client
PHP
342
star
17

cms-theme-boilerplate

A straight-forward starting point for building a great website on the HubSpot CMS
HTML
320
star
18

react-select-plus

Fork of https://github.com/JedWatson/react-select with option group support
JavaScript
281
star
19

hubspot-api-python

HubSpot API Python Client Libraries for V3 version of the API
Python
278
star
20

hubspot-api-nodejs

HubSpot API NodeJS Client Libraries for V3 version of the API
TypeScript
278
star
21

SlimFast

Slimming down jars since 2016
Java
270
star
22

dropwizard-guice

Adds support for Guice to Dropwizard
Java
268
star
23

gc_log_visualizer

Generate multiple gnuplot graphs from java gc log data
Python
200
star
24

hubspot-api-php

HubSpot API PHP Client Libraries for V3 version of the API
PHP
176
star
25

general-store

Simple, flexible store implementation for Flux. #hubspot-open-source
JavaScript
173
star
26

hubspot-cli

A CLI for HubSpot
JavaScript
142
star
27

facewall

Grid visualization of Gravatars for an organization
CoffeeScript
138
star
28

jackson-datatype-protobuf

Java
116
star
29

draft-extend

Build extensible Draft.js editors with configurable plugins and integrated serialization.
JavaScript
115
star
30

prettier-maven-plugin

Java
112
star
31

Rosetta

Java library that leverages Jackson to take the pain out of mapping objects to/from the DB, designed to integrate seamlessly with jDBI
Java
110
star
32

slack-client

An asynchronous HTTP client for Slack's web API
Java
110
star
33

hubspot-api-ruby

HubSpot API Ruby Client Libraries for V3 version of the API
Ruby
107
star
34

Baragon

Load balancer API
Java
105
star
35

mixen

Combine Javascript classes on the fly
CoffeeScript
85
star
36

jquery-zoomer

Zoom up your iFrames
JavaScript
81
star
37

hapipy

A Python wrapper for the HubSpot APIs #hubspot-open-source
Python
78
star
38

oauth-quickstart-nodejs

A Node JS app to get up and running with the HubSpot API using OAuth 2.0
JavaScript
74
star
39

oneforty-data

Open data on 4,000+ social media apps from oneforty.com #hubspot-open-source
Ruby
70
star
40

cms-react-boilerplate

JavaScript
65
star
41

Blazar-Archive

An out-of-this world build system!
Java
62
star
42

haPiHP

An updated PHP client for the HubSpot API
PHP
61
star
43

sanetime

A sane date/time python interface #hubspot-open-source
Python
60
star
44

sample-workflow-custom-code

Sample code snippets for the custom code workflow action.
60
star
45

hubspot-cms-vscode

A HubL language extension for the Visual Studio Code IDE, allowing for ๐Ÿš€ fast local HubSpot CMS Platform development.
TypeScript
56
star
46

ui-extensions-examples

This repository contains code examples of UI extensions built with HubSpot CRM development tools beta
TypeScript
56
star
47

BidHub-CloudCode

The Parse-based brains behind BidHub, our open-source silent auction app.
JavaScript
50
star
48

teeble

A tiny table plugin
JavaScript
49
star
49

hubspot.github.com

HubSpot Open Source projects.
JavaScript
46
star
50

BidHub-iOS

iOS client for BidHub, our open-source silent auction app.
Objective-C
44
star
51

calling-extensions-sdk

A JavaScript SDK for integrating calling apps into HubSpot.
JavaScript
43
star
52

dropwizard-guicier

Java
42
star
53

live-config

Live configuration for Java applications #hubspot-open-source
Java
37
star
54

hubspot-cms-deploy-action

GitHub Action to deploy HubSpot CMS projects
HTML
36
star
55

executr

Let your users execute the CoffeeScript in your documentation
JavaScript
35
star
56

transmute

kind of like lodash but works with Immutable
JavaScript
35
star
57

NioImapClient

High performance, async IMAP client implementation
Java
33
star
58

colorshare

Style up your social share buttons
CSS
32
star
59

cms-event-registration

JavaScript
32
star
60

ChromeDevToolsClient

A java websocket client for the Chrome DevTools Protocol
Java
31
star
61

integration-examples-php

PHP
31
star
62

recruiting-agency-graphql-theme

A theme based off of the HubSpot CMS Boilerplate. This theme includes modules and templates that demonstrate how to utilize GraphQL as part of a website built with HubSpot CMS and Custom CRM Objects.
HTML
30
star
63

canvas

HubSpot Canvas is the design system that we at HubSpot use to build our products.
JavaScript
29
star
64

vee

A personal proxy server for web developers
CoffeeScript
28
star
65

cms-js-building-block-examples

DEPRECATED, go to https://github.com/HubSpot/cms-react instead
JavaScript
28
star
66

integration-examples-nodejs

JavaScript
27
star
67

NioSmtpClient

Smtp Client based on Netty
Java
26
star
68

sample-apps-list

The list of Sample applications using HubSpot Public API
25
star
69

jackson-jaxrs-propertyfiltering

Java
25
star
70

local-cms-server-cli

Command line tools for local cms development
CSS
22
star
71

astack

Simple stacktrace analysis tool for the JVM
Python
22
star
72

prettier-plugin-hubl

JavaScript
20
star
73

Horizon

Java
20
star
74

rHAPI

Ruby wrapper for the HubSpot API (HAPI)
Ruby
20
star
75

integrate

Confirm that your application works.
CoffeeScript
20
star
76

moxie

A TCP proxy guaranteed to make you smile. #hubspot-open-source
Python
18
star
77

BidHub-WebAdmin

Keep an eye on BidHub while it's doing its thing.
HTML
18
star
78

hbase-support

Supporting configs and tools for HBase at HubSpot
Java
17
star
79

sprocket

A better REST API framework for django
Python
17
star
80

react-decorate

Build composable, stateful decorators for React.
JavaScript
16
star
81

cms-custom-objects-example

CSS
16
star
82

hubspot-immutables

Java
16
star
83

hubspot-academy-tutorials

JavaScript
16
star
84

cms-vue-boilerplate

Boilerplate Vue project for creating apps using modules on the HubSpot CMS
JavaScript
16
star
85

maven-snapshot-accelerator

System to speed up dependency resolution when using Maven snapshots #hubspot-open-source
Java
16
star
86

httpQL

A small library for converting URL query arguments into SQL queries.
Java
15
star
87

sample-apps-webhooks

Sample code and reference for processing HubSpot webhooks
JavaScript
13
star
88

algebra

Simple abstract data types (wrapping derive4j) in Java
Java
13
star
89

sample-apps-oauth

Sample application demonstrating OAuth 2.0 flow with HubSpot API
Ruby
13
star
90

cms-webpack-serverless-boilerplate

Boilerplate for bundling serverless functions with webpack locally, prior to uploading to the CMS.
JavaScript
13
star
91

cms-react

A repo to expose CMS react examples, React defaults modules, and more to CMS devs
TypeScript
13
star
92

sample-apps-manage-crm-objects

Sample application in PHP, Python, Ruby and JavaScript demonstrating HubSpot API to manage CRM Objects
JavaScript
12
star
93

HubspotEmailTemplate

How to convert a regular html coded email template into ones that use HubSpot jinja tags.
12
star
94

hubstar

CSS
12
star
95

virtualenvchdir

Easily chdir into different virtualenvs #hubspot-open-source
Shell
12
star
96

cos_uploader

A python script for syncing a file tree to the HubSpot COS
Python
11
star
97

chrome_extension_workshop

Chrome extension workshop
JavaScript
10
star
98

collectd-gcmetrics

Python
10
star
99

guice-transactional

Java
10
star
100

private-app-starter

Boilerplates apps using HubSpot API
PHP
10
star