Skip to content

mikehrom/positron

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Positron

Positron is Artsy Writer or the editorial tool for Artsy.

ArtsyWriter

Meta

Build Status codecov

Setup

Preparation

  • 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
  • Setup Hokusai

  • Copy .env.example to .env in the root of the project and edit all REPLACE values with sensitive configuration obtained from positron-staging. Use the following command:

hokusai staging env get | grep -E `cat .env.example | grep REPLACE | cut -f1 -d= | xargs | tr ' ' \|` | sed -e 's/:\ /=/g' | sed -e 's/ //g'

Installs (skip if you use hokusai dev, please see section below)

  • Install NVM
  • Install Node 12
nvm install 12
nvm alias default 12
  • 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-community
  • Start the MongoDB server
mongod
  • Install and run elasticsearch
brew install elasticsearch
brew services start elasticsearch

Prepare database

Using staging database

In order to write articles, you will need to be a member of a channel. If you are an Artsy dev, you can point MONGOHQ_URL env to the staging database. Connecting to staging database requires VPN, please see details on setting up a VPN connection here.

Using a local database

With MongoDB running locally, follow these steps to create a dummy channel:

  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>")]
}

If you are using Hokusai dev, start the stack as mentioned in subsequent section, edit the database as mentioned in this step, then restart the stack.

Start the server

Using Yarn

yarn start

Using Hokusai Dev

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.

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, 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

Using Yarn

yarn test

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

Using Hokusai

hokusai test

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 and data-sync.

About

Positron is Artsy Writer or the editorial tool for Artsy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 59.6%
  • CoffeeScript 20.6%
  • JavaScript 15.2%
  • Stylus 3.0%
  • Pug 1.2%
  • Shell 0.3%
  • Other 0.1%