24/7/365 Support

Installing Hackpad, a collaborative document editor

In this recipe, we will install a collaborative document editor, Hackpad. It is a document editor based on an open source editor, EtherPad. Hackpad was acquired by Dropbox, and in early 2015 they open sourced its code.

Getting ready

You will need a system with at least 2 GB of memory.

As always, you will need an account with super user privileges.

How to do it…

Hackpad is a web application based on Java. We will need to install the JDK; Scala, which is another programming language; and MySQL as a data store. We will start by installing dependencies and then cloning the Hackpad repository from GitHub.

Install JDK and Scala. The installation document mentions Sun JDK as a requirement but it works with Open JDK.

$ sudo apt-get update

$ sudo apt-get install openjdk-7-jdk scala -y

Install the MySQL server. You can get more details on MySQL installation in the article handling the database:

$ sudo apt-get install mysql-server-5.6

Next, clone the Hackpad repository. You can choose not to install Git and download the ZIP archive of Hackpad from GitHub:

$ git clone https://github.com/dropbox/hackpad.git

This will create a new directory, hackpad. Before we run the build script, we need to set some configuration parameters to match our environment. Change the directory to hackpad and edit the bin/exports.sh file as follows:

export SCALA_HOME="/usr/share/java"

export SCALA_LIBRARY_JAR="$SCALA_HOME/scala-library.jar"

export JAVA_HOME="/usr/share/java"

Next, create a configuration file as a copy of the default configuration, as follows:

$ cp etherpad/etc/etherpad.localdev-default.properties \ etherpad/etc/etherpad.local.properties

Edit the newly created configuration, get the admin email address, and search for the following line in etherpad/etc/etherpad.local.properties:

etherpad.superUserEmailAddresses = __email_addresses_with_admin_access__

Replace it with:

etherpad.superUserEmailAddresses = admin@yourdomain.tld

Optionally, you can set the project to production mode by setting isProduction to true:

devMode = false

verbose = true

etherpad.fakeProduction = false

etherpad.isProduction = true

If you are using a domain name other than localhost, then configure the same with the following option:

topdomains =yourdomain.tld,localhost

Set your email host settings. You will need an email address to receive your registration confirmation email. However, this is not a hard requirement for initial setup:

smtpServer = Your SMTP server

smtpUser = SMTP user

smtpPass = SMTP password

Next, run a build script from the bin directory:

$ ./bin/build.sh

Once the build completes, set up the MySQL database. The script will create a new database named hackpad and a MySQL user account. You will be asked to enter your MySQL root account password:

$ ./contrib/scripts/setup-mysql-db.sh

Finally, you can start the server by executing run.sh from the bin directory:

$ ./bin/run.sh

This will take a few seconds to start the application. Once you see the HTTP server is listening to the line, you can access Hackpad at http://yourdomain.tld:9000:

Access Hackpad and register with an email address that is used for an admin account. If you have set up an email server, you should receive a confirmation email containing a link to activate your account.

If you have not set up email server access to the MySQL database to get your authentication token, open the MySQL client and use the following queries to get your token. The MySQL password for the Hackpad account is taken from the configuration file:

$ mysql -h localhost -u hackpad -ppassword

mysql> use hackpad;

mysql> select * from email_signup;

Select your token from the row matching your email address and replace it in the following URL. In this case, the auth toke is PgEJoGAiL3E2ZDl2FqMc:

http://yourdomain.com:9000/ep/account/validate- email?email=user@youremail.com&token=your_auth_token_from_db

The full auth URL for my admin account will look like this:

http://localhost.local:9000/ep/account/validate-email?email=admin@localh... PgEJoGAiL3E2ZDl2FqMc

Open this URL in the browser and your account registration will be confirmed. You will be logged in to your Hackpad account.

Once you log in to your new account, Hackpad will start with a welcome screen listing all the default pads that looks something like the following:

You can click any of them and start editing or create a new document. When opened, you will get a full page to add contents, with basic text editing options in the top bar:

The document can be shared using the invite box or simply by sharing the URL.

How it works…

As mentioned before, Hackpad is a collaborative editor based on an open source project, EtherPad. It allows you to create online documents directly in your browser. In the same way as Google Docs, you can use Hackpad to create and store your documents in the cloud. Plus, you can access Hackpad from any device. All your documents will be rendered in a proper format suitable for your device.

When you log in for the first time, the home screen will greet you with stock pads. You can edit existing pads or start a new one from the top bar. An editor will give you a basic text editing setting, plus options to create lists and add comments. You can even add data in a tabular format. Click on the gear icon from the top bar and it will give you options to view document history, get an embedded link, or delete the document.

Every change in the document will be marked with your username, and if two or more people are working with the document at the same time, then the specific line being edited by each user is marked with the user's tag:

On the right-hand side of the document, you can see the options to invite your peers to collaborate on this document. You can invite people using their email address. Make sure that you have configured your email server before using this feature. Alternatively, the invites are also shown in a chat window with clickable links, as shown in the following screenshot:

At the bottom of the document, you can find all activity logs about the new initiation and the editing of this document. There is an option to chat with participating people directly from the same window. It is located at the bottom corner of the right-hand side; it's the small bar with a chat icon named after your domain. This provides one-to-one chat, as well as a group chat:

There's more

Hackpad is a collaborative document editor. You can add snippets of code in a given document but not entire code files. To edit your code, you can use an open source Cloud IDE named Cloud 9 IDE. Check out the GitHub repo at https://github.com/c9/core/ . Alternatively, you can get Docker images set up quickly and play around with the IDE.

Using Hackpad with Docker

The Hackpad setup contains a Docker file as well. If you have Docker installed, you can build a Docker image for Hackpad. Simply change your directory to Hackpad git repo and build a Docker image with the following command:

$ docker build -t hackpad

See also

Read more about Hackpad at the following links:

Hackpad with Docker at https://github.com/dropbox/hackpad/blob/master/DOCKER.md

Hackpad repo at https://github.com/dropbox/hackpad

Etherpad at http://etherpad.org/

Cloud 9 IDE at https://c9.io/

Help Category:

What Our Clients Say