Positron is Artsy Writer or the editorial tool for Artsy.
- State: production
- Production: https://writer.artsy.net/ | Kubernetes
- Staging: http://stagingwriter.artsy.net/ | Kubernetes
- Logs:
- Monitoring:
- MongoDB: Atlas
- Github: https://github.com/artsy/positron/
- CI: CircleCI; merged PRs to artsy/positron#master are automatically deployed to staging. PRs from
stagingtoreleaseare automatically deployed to production. Start a deploy... - Point Person: @eessex
-
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.exampleto.envin the root of the project and edit allREPLACEvalues with sensitive configuration obtained frompositron-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'
- 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
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.
With MongoDB running locally, follow these steps to create a dummy channel:
- Create a collection called
channelsin apositrondb in your mongo database (You can use the mongo shell or a simple UI like Robomongo.) - 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.
yarn start
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.
yarn test
Make sure you have mongo running in the background or most tests will not work.
hokusai test
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 oninspectlink 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.
Use the task command to run scripts written in ES6 or Coffeescript. This is helpful for running backfills.
yarn task scripts/backfill.js
You can find additional documentation about Positron in doc and data-sync.
