Installing StackEdit

I recently brought on a new team member for one of my many projects. We had an immediate need for documentation collaboration. My first idea was to use Hackpad or Etherpad, but we were going to be working a lot with Markdown, so I Google'd around a bit and came across StackEdit!

As with most of our tools we use, I prefer self-hosted solutions more often then not. Thankfully StackEdit fit that bill.

My StackEdit system is a 4 virtual-core, 6GBs of RAM with CentOS 6.x VPS.

Install Prerequisites

yum -y install nano gcc gcc-c++ git

Install Node, Gulp & Bower

StackEdit runs off Node so we'll need to get that installed along with a few other npm packages.

cd /usr/src wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz tar zxvf node-v0.10.30.tar.gz cd node-v0.10.30 ./configure make make install

Next Gulp:

npm install --global gulp

And finally Bower:

npm install -g bower

The StackEdit Source Code

This one is pretty quick and easy!

cd /opt/ git clone https://github.com/benweet/stackedit.git

Now we need to install some of it's dependencies.

npm install bower install --allow-root

Of note, if you're not running these commands as root you may omit the --allow-root from the Bower command.

CouchDB - For Lazy Couch Potatoes!

Alright! So StackEdit will work now, however if you want to allow the synchronizing and sharing of files between people, you'll want to either setup Google Drive, Dropbox or CouchDB. I didn't have the time to setup Google Drive or Dropbox so I went to CouchDB. In fact anyone who uses StackEdit or your StackEdit instance can setup CouchDB to use with StackEdit.

I really recommend reading this documentation on how to setup CouchDB, but I'll give a brief overview here.

First go to SmileUpps. They offer free CouchDB hosting. Sign yourself up for an account. Then you'll want to setup a domain for your project.

Next you'll want to go into the CouchDB configuration to set a few items up.

Click on the Configuration option from the right sidebar. You should see a new page with a table of configuration options. Scroll to the bottom and click on the 'Add a New Section' link and a little dialog box pops up. Enter in 'httpd' to the first field, 'enable_cors' to the second field and 'true' to the third field. Don't use the quotes of course though. Hit the Create button.

Again, go to 'Add a New Section' and enter in 'cors' for the first field, 'origins' for the second field and 'http://localhost, https://yourdomain.com' for the third field.

Now back on your server you'll want to run the following commands:

curl -X PUT https://yourinstance.smileupps.com/documents curl -O https://raw.githubusercontent.com/benweet/stackedit/master/couchdb/setup.js node setup.js https://yourinstance.smileupps.com/documents

That should be all you need to get CouchDB going. I also recommend going to your StackEdit instance and update the CouchDB URL. Go to Menu > Settings > Advanced -- and set the CouchDB URL.

Finish Up!

Your StackEdit instance should be ready to roll. You can configure other items in the `` file.

One thing I had an issue was when sharing documents was that it kept using the stacked.io domain which would likely cause some confusion. So in order to remedy this I had to edit the ./public/res-min/main.js file in 2 places. The first is line 13692 :

var l = "http://mydomain.com/" + "editor#!" + e.param(a);

and line 13703 :

var l = "http://mydomain.com/" + "viewer#!" + e.param(a);

I restarted the application and all was well!

Notes

My instance currently is not connected with any of the third party apps like Dropbox, Google Drive or Google Analysts. I do not believe it would be terribly difficult to set these items up but I just didn't have a time or a real need. This is one of the first self hosted apps which I haven't had to proxy with Nginx. That's nice! I am not sure if the app should be running as root or a less privileged account. I also removed the donation links and alert boxes since I had no real use for them on my internal site. I also removed the link to Classeur since I had no real use for that being there. I also noticed it looks like you can deploy your StackEdit instance to Heroku or Docker, but didn't give those a shot. Maybe someday!

Resources

Please enable JavaScript to view the comments powered by Disqus.