Skip to content
Ryan Pitts edited this page Nov 6, 2020 · 15 revisions

How OpenNews etherpad works

Overview: We run an etherpad-lite instance on Heroku, which is publicly available at https://etherpad.opennews.org. The instance uses a Postgres db and a Standard 1X dyno (512MB RAM, 1x CPU share). In testing via etherpad-load-test, these resources are more than enough to handle our normal traffic.

Deployment details: We use SSL for our etherpad-lite instance, which means that to run on Heroku, we need our own forked version of etherpad-lite that includes heroku-ssl-redirect. That means we also use a forked version of etherpad-lite-heroku, which pulls in our version of the etherpad software as a submodule.

The etherpad-lite-heroku wrapper is what actually gets deployed to Heroku, where it runs a launch script that does some config and starts the etherpad service.

How to update our etherpad installation

First, update our fork of etherpad-lite

We run an OpenNews fork of etherpad-lite so we can customize a couple things:

To update the OpenNews fork to a new release of etherpad-lite:

  1. in your local git directory for the project, run git fetch upstream
  2. run git merge upstream/master [ RELEASE ID ] (e.g. "git merge upstream/master 1.8.6")
  3. you should see merge conflicts in src/package.json and src/package-lock.json. Resolve them by first accepting all the upstream changes (steps 4 and 5 in this process), which will temporarily remove heroku-ssl-redirect:
  4. run git checkout --theirs src/package-lock.json
  5. run git checkout --theirs src/package.json
  6. edit src/package.json to add "heroku-ssl-redirect": "0.0.3", to the list of dependencies. (We pin to that version because later versions change from require to import syntax and this one works fine for our needs.)
  7. cd into the etherpad-lite/src directory, then run npm install --save (this will add a heroku-ssl-redirect listing to package-lock.json)
  8. cd back out to the etherpad-lite directory and commit changes with a message like "update local to upstream [ RELEASE ID]"
  9. push those changes to our fork of etherpad-lite on GitHub. (They have to be on GitHub for the build process to work later on.)

Then update our fork of etherpad-lite-heroku

This is a light wrapper around etherpad-lite that makes it easier to run on Heroku. We run an OpenNews fork of this project as well, to track our customized etherpad settings. It also references the OpenNews fork of etherpad-lite as a git submodule.

To update the submodule reference:

  1. copy the git commit ID for the update you just made to the OpenNews fork of etherpad-lite. (You can just click on the commit from the project's GitHub homepage, and then copy the commit ID from that page.)
  2. in your local git directory for etherpad-lite-heroku, cd into the etherpad-lite directory
  3. run git pull
  4. run git checkout [ COMMIT ID ] (You should then see a message that says "HEAD is now at [ COMMIT ID] [ COMMIT MESSAGE]")
  5. cd back out to the project root directory and run git add etherpad-lite/
  6. run npm install --save to make sure package-lock.json gets any updates
  7. commit changes with a message like "update etherpad-lite to [ RELEASE ID]"
  8. push those changes to our fork of etherpad-lite-heroku on GitHub

Now that both of the OpenNews project forks are updated, it's time for Heroku.

First, test the updated software on our staging installation

  1. open the opennews-staging-etherpad app dashboard on Heroku, and click the Papertrail resource to open real-time logging so you can monitor this next part
  2. in your local git directory for etherpad-lite-heroku, run git remote -v
  3. you should see two Heroku remotes: one called heroku (our production install), and one called heroku-staging (our staging install). If you don't see those remotes, or if this is the first time you're running through this process, you'll need to add them
  4. run git push heroku-staging master, which will trigger a new build
  5. watch the logging for any errors. If it happens to take too long to install the node modules, you may need to manually restart the Heroku dynos to trigger that process again
  6. once you see that the app is up and running, visit an etherpad at our staging installation on Heroku to test the new version of the software

When everything looks good on staging, update production

  1. open the opennews-etherpad app dashboard on Heroku, and click the Papertrail resource to open real-time logging so you can monitor this next part
  2. from your local git directory for etherpad-lite-heroku, run git push heroku master to trigger a new production build
  3. follow the same process as above for monitoring and testing

Release commits for reference

v1.8.6

etherpad-lite https://github.com/OpenNews/etherpad-lite/commit/1039ba6d8cc9097b2063c9b40a29b380b5a83850

etherpad-lite-heroku https://github.com/OpenNews/etherpad-lite-heroku/commit/9cba67e0a09d49117f6639f39c78c29740b5b915

v1.8.0

etherpad-lite https://github.com/OpenNews/etherpad-lite/commit/df18194a9394386061ecc9ec14da8b42a3177226

etherpad-lite-heroku https://github.com/OpenNews/etherpad-lite-heroku/commit/ee901df8b81da946a5d2567f8dc7a1cc55e8d371