Positron is Artsy Writer or the editorial tool for Artsy.
dleve123 Merge pull request #1813 from artsy/add-dd-tracing
PLATFORM-1080: Configure data dog tracing for positron
Latest commit 4be3eb5 Dec 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci hotfix - setup docker in deploy steps Dec 7, 2018
.vscode [VSCode] Update cSpell settings to be less intrusive Oct 12, 2018
conf move Nginx into Positron container until Hokusai does not patch ALL c… Dec 6, 2018
doc Update API docs to explain `gravity_id` Jul 16, 2018
hokusai Configure data dog tracing for positron Dec 11, 2018
scripts Configure data dog tracing for positron Dec 11, 2018
src Guard DataDog initialization on presence of DATADOG_AGENT_HOSTNAME Dec 11, 2018
.babelrc remove @babel/plugin-transform-runtime Oct 30, 2018
.dockerignore inject COMMIT_HASH before into build rather than copy git repo Nov 28, 2018
.env.example Configure data dog tracing for positron Dec 11, 2018
.env.test use uglifyjs-webpack-plugin Jun 27, 2018
.eslintrc minor linting updates Oct 18, 2018
.gitignore [Toolchain] Add vscode settings; Tslint; lint-staged Aug 22, 2018
Dockerfile move Nginx into Positron container until Hokusai does not patch ALL c… Dec 6, 2018
LICENSE.md Working developer setup with default partner ID. Apr 6, 2017
README.md Merge branch 'master' of github.com:artsy/positron into fea-hokusaize Dec 5, 2018
coffeelint.json Add coffeelint Aug 14, 2017
dangerfile.ts Rename dangerfile.js to dangerfile.ts Aug 21, 2017
jsconfig.json Remove client/public/assets in favor of public/client/assets Mar 22, 2018
package.json Remove new relic Dec 11, 2018
renovate.json Update to use default artsy config Nov 16, 2018
test.config.js merge changes Aug 29, 2018
tsconfig.json [Toolchain] Update to Typescript 3 Aug 22, 2018
tslint.json [Toolchain] Add vscode settings; Tslint; lint-staged Aug 22, 2018
webpack.config.js use positron class for failing button Jun 28, 2018
yarn.lock Remove new relic Dec 11, 2018

README.md

Positron

Positron is Artsy Writer or the editorial tool for Artsy.

ArtsyWriter

Meta

Build Status

Set-Up

  • Copy .env.example to .env in the root of the project and edit all REPLACE values with sensitive configuration obtained from positron-staging. This should help.
hokusai staging env get | grep -E `cat .env.example | grep REPLACE | cut -f1 -d= | xargs | tr ' ' \|` | sed -e 's/:\ /=/g' | sed -e 's/ //g'

Via Hokusai

  • Set up Hokusai
  • git clone git@github.com:<your username>/positron.git && cd positron
  • COMMIT_HASH=$(git rev-parse --short HEAD) hokusai dev start

This starts a new Docker Compose stack that boots MongoDB, ElasticSearch and Positron. Changes made to source-code are not automatically reloaded. To shut down, press ctrl+c or execute hokusai dev stop.

Manually

  • Install NVM
  • Install Node 10
nvm install 10
nvm alias default 10
  • Fork Positron to your Github account in the Github UI.
  • Clone your repo locally (substitute your Github username).
git clone git@github.com:craigspaeth/positron.git && cd positron
  • Install node modules
yarn install
  • Positron uses MongoDB as a database. To install MongoDB using homebrew do the following, if you would prefer to install manually check the documentation at MongoDB
brew install mongodb
  • Start the MongoDB database
mongod
  • Install and run elasticsearch
brew install elasticsearch
brew services start elasticsearch
  • Create a dummy channel In order to write articles, you will need to be a member of a channel. If you are an Artsy dev, it might be easier to point your MONGOHQ_URL to the staging database. Otherwise, here are the steps to backfill some required data:
  1. Create a collection called channels in a positron db in your mongo database (You can use the mongo shell or a simple UI like Robomongo.)
  2. Add a document with the following fields:
{
  name: "Test Channel",
  type: "team", // this can be either editorial, team, support, or partner
  user_ids: [ObjectId("<your_user_id>")]
}
  • Start the server
yarn start
  • Positron should now be running at http://localhost:3005/, open a browser and navigate to it. That will redirect you to staging, login as an Artsy administrator and it will redirect you to http://localhost:3005 logged into Writer. If you are an Artsy Admin pointed to the staging database, you should see the default partner gallery channel (David Zwirner).

If you aren't an artsy admin you'll possibly get an Unauthorized page. You need to do one more mongo operation: edit the users collection and set your user's channel_ids to [ ObjectId("<your_above_channel_id>") ]. Once that's done you should be able to see the main writer interface.

  • Run tests
yarn test
  • Make sure you have mongo running in the background or most tests will not work.

Debugging

Server side

Start the server using

yarn dev

This will start the server on port 3005 with inspect option.

  • In your Chrome go to: Chrome Inspect
  • Under Remote Target now you should see ./index.js, click on inspect link below it which will open a Chrome developer tools.

Now anywhere in your server side code you can put debugger and you should be able to debug.

Running tasks

Use the task command to run scripts written in ES6 or Coffeescript. This is helpful for running backfills.

yarn task scripts/backfill.js

Additional docs

You can find additional documentation about Positron in doc.