Go back to top
Arthur HALET
31 years old (born 06/19/91) - Driving license
P: 06-79-21-39-53

E: arthurh.halet@gmail.com
fr.png uk.png

Install etherpad lite with cloudfoundry

07/09/2014 01:30:05

Just have a little explanation about what is etherpad-lite before starting:

Etherpad is a really-real time collaborative editor maintained by the Etherpad Community.

Etherpad is written in Javascript(99.9%) on both the server and client so it's easy for developers to maintain and add new features. Because of this Etherpad has tons of customizations that you can leverage.

The context

Well, i'm my team in Orange we use a lot the old etherpad to take notes, to logs our standup or our meeting and it was pretty obvious that we need to move cause this old etherpad is not maintained anymore.

The other point is that we have a new fresh PaaS (cloudfoundry) so our old server with old etherpad are useless and so i wanted to create an etherpad-lite app on our CloudFoundry instance.

And the latest point is that etherpad-lite can have a lot of plugins which are so cool, take a look in their plugin list: https://github.com/ether/etherpad-lite/wiki/Plugin,-a-list

First try

I tried to install a new etherpad-lite by downloading the latest release from their github: https://github.com/ether/etherpad-lite/releases

I had just extracted the downloaded file, run bin/install.sh, make a Procfile to start the server (it just copy the content of run.sh from etherpad-lite and put web: in front), make my manifest.ymland run cf push but i had a big fail....

Cloudfoundry said that the application was not started cause he doesn't see that application was giving response on the port gave by CloudFoundry.

So i took a look in the settings.json from etherpad-lite and a port was set in hard way ... Sure it couldn't not work cause it's CloudFoundry which gave the port to use.

I was not sure that etherpad-lite could handle the port from environment variable, hopefully in the code of this file: https://github.com/ether/etherpad-lite/blob/develop/src/node/utils/Settings.js#L55 (weel yeah it was hard to found X) )

you can see that it use by default port from environment variable so i had just to remove from settings.json the variable port

Second try (with success)

i was happy everything should work correctly so i re-run cf push from my super console and again it didn't work... This time it's cause that etherpad-lite couldn't found is requirement normally resolved by npm (node package manager), it's work like maven for java developper or composer for php developper.

You put a file named package.json in your root folder app with all your required package inside and normally with nodejs-buildpack it will download them by using http://npmjs.org repository.

In fact etherpad-lite doesn't work like all nodejs application there is no package.json in the root folder, you can found it in src folder. I think that etherpad-lite team try to handle how should work nodejs and their package management which is really W.T.F. npm resolve dependence by putting package dependencies in folder node_modules, you could say well that's ok but in fact he will go inside each module read the package.json inside and create again a node_modules folder inside with dependencies...

Go back to the main problem, i had just to copy the package.json from src folder and put it in the root folder and this time it was working.

Create an etherpad-lite for cloudfoundry

After all this work i thought why doesn't give it to cloudfoundry-community ? I was already saw an old app which should work with cloudfoundry but it was obsolete for cloudfoundry and it was an old version of etherpad-lite.

So i forked my own etherpad-lite-cf which should work with cloudfoundry.

I had a main point before do this, i didn't want to maintain all the time this application, i just wanted to have to sync with etherpad-lite to be up-to-date with the upstream and doesn't have absolutely no hard merge to do.

I thought about travis-ci to release my own app working with cloudfoundry. I put all my process to make etherpad-lite working with cloudfoundry inside a .travis.yml, remove the port variable from settings.json.template and the job was done, now i just need to create a new release on github to have a etherpad-lite cloudfoundry compliant.

Take a look of the content of my .travis.yml:

#first i do the same things that etherpad-lite do in their continuous integration
language: node_js
- '0.10'
- bin/installDeps.sh 
- export GIT_HASH=$(git rev-parse --verify --short HEAD)
# now i don't :)
- 'echo "web: node node_modules/ep_etherpad-lite/node/server.js" > Procfile' #create the procfile
- cp src/package.json ./ #put the package.json inside root folder
- npm install # install dependencies to make it offline
- zip -r etherpad-lite-cf ./* # create a zip file to send to github
  provider: releases
    secure: GDExihYPG0uY9ZmrA1uGYXwQiQ39Y5qbrP472b7DJ6lWrGPI1+CN1l+aFDs9dn6yQbmHt+0z/epBOCCMIAQ/LUofULzSPhAWaoi0sEOzX/xF2jAYULdOJq9cpEjfQkEI+D1xsfkxY8HMe05Wxaj/S0Wd9X+zAQbMiPfFktkUv00=
  file: etherpad-lite-cf.zip # send the file to github when you have a new release created on it
    tags: true
    all_branches: true