diff --git a/README.md b/README.md index e6f344d..a89ecf9 100644 --- a/README.md +++ b/README.md @@ -9,38 +9,30 @@ It has been through many iterations, but in its current incarnation Hostr uses [ ### Dependencies -Everything is taken care of by an `npm install`. +Everything is taken care of by an `make build`. ### Enviroment Variable Configuration -See [`.env.example`](.env.example). Copy it to `.env`, modify and `source .env` for development. [autoenv](https://github.com/kennethreitz/autoenv) is pretty nice for doing this automatically when you `cd` into your work directory. - -### Deploying to Heroku - -You'll need to add Heroku Redis and a MongoDB addon. +See [`.envrc.example`](.envrc.example). Copy it to `.envrc`, modify and `source .envrc` for development. [direnv](https://github.com/direnv/direnv) is pretty nice for doing this automatically when you `cd` into your work directory. ## Usage ### Start the app ``` -$ npm start +$ make docker-compose-up ``` -This will install and build the frontend too. - -Alternatively +### Initialise the environment ``` -$ npm run watch +$ make init migrate ``` -Will watch your JS and CSS for changes, rebuild them, and reload the server. - ### Run the tests ``` -$ npm test +$ make test ``` Running the tests will also set the indexes required for Mongo. diff --git a/api/app.js b/api/app.js index c392914..d3d92b4 100644 --- a/api/app.js +++ b/api/app.js @@ -49,8 +49,8 @@ router.use(async (ctx, next) => { }; } else if (!err.status) { debug(err); - if (ctx.raven) { - ctx.raven.captureError(err); + if (ctx.Raven) { + ctx.Raven.captureException(err); } throw err; } else { diff --git a/api/routes/user.js b/api/routes/user.js index 1ac0771..8274493 100644 --- a/api/routes/user.js +++ b/api/routes/user.js @@ -77,7 +77,7 @@ export async function events(ctx) { } catch (err) { debug('Invalid JSON for socket auth'); ctx.websocket.send('Invalid authentication message. Bad JSON?'); - ctx.raven.captureError(err); + ctx.Raven.captureException(err); } try { const reply = await ctx.redis.get(json.authorization); @@ -90,7 +90,7 @@ export async function events(ctx) { } } catch (err) { debug(err); - ctx.raven.captureError(err); + ctx.Raven.captureException(err); } })); }); diff --git a/app.js b/app.js index dc35e45..f707f71 100644 --- a/app.js +++ b/app.js @@ -8,7 +8,7 @@ import bodyparser from 'koa-bodyparser'; import websockify from 'koa-websocket'; import helmet from 'koa-helmet'; import session from 'koa-session'; -import raven from 'raven'; +import Raven from 'raven'; import debugname from 'debug'; import * as redis from './lib/redis'; import api, { ws } from './api/app'; @@ -20,14 +20,14 @@ const app = websockify(new Koa()); app.keys = [process.env.COOKIE_KEY]; if (process.env.SENTRY_DSN) { - const ravenClient = new raven.Client(process.env.SENTRY_DSN); - ravenClient.patchGlobal(); + Raven.config(process.env.SENTRY_DSN); + Raven.install(); app.use(async (ctx, next) => { - this.raven = ravenClient; + this.Raven = Raven; await next(); }); app.ws.use(async (ctx, next) => { - this.raven = ravenClient; + this.Raven = Raven; await next(); }); } @@ -43,8 +43,8 @@ app.use(async (ctx, next) => { try { await next(); } catch (err) { - if (!err.statusCode && ctx.raven) { - ctx.raven.captureError(err); + if (!err.statusCode && process.env.SENTRY_DSN) { + Raven.captureException(err); } throw err; }