How to Install Keystone into Jelastic PaaS

Keystone is the easiest way to build database-driven websites, applications and APIs in Node.js.

This application provides multiple awesome features. It is used for creation of dynamic web sites or applications with well-structured routes, templates and models. Keystone auto-creates a beautiful Admin UI, based on the database models you define, and enhances models with additional field types and functionality. And integration with different services provides even more features:

  • Integration with Cloudinary for image uploading, storage and resizing
  • Integration with Mandrill for sending emails easily
  • Integration with Google Places for clever location fields
  • Integration with Embedly for powerful video and rich media embedding tools

In this tutorial we’ll describe how to easily host your Keystone project with Jelastic.

Create Environment

1. Log in to the Jelastic Platform and click the Create environment button in the upper left corner of the dashboard.

create environment

2. In the opened frame switch to the Node.js tab and choose NodeJS as your application server and MongoDB as a NoSQL database. Use the cloudlet sliders to allocate the required amount of resources for these nodes. Then type your environment name (e.g. keystone) and click the Create button.

environment wizard

3. Your environment will be created in a few minutes.

environment for Keystone created

Create Database

Next, create a new database for your Keystone application.

1. Click the Open in Browser icon next to the MongoDB instance.

open database in browser

2. Log into the RockMongo admin panel within the opened browser tab (use the credentials you received via email).

database log in

3. Once entered, navigate to the Databases tab and click the Create new Database link.

create new database

4. In the opened frame, specify the name for your new database (keystonedb in our example) and click Create.

keystone DB new db name

Now you have an empty DB for your Keystone application.

Run Keystone

1. To start the application you need to access your environment via SSH protocol.

Tip: In the case you haven’t performed similar operations before, you need to:

2. As soon as a connection is established, select your keystone environment.

SSH select environment

3. Then, enter the Nodejs container.

SSH select node

4. The easiest way to get started with Keystone is to use the Yeoman generator. Type the following commands in your terminal in order to install it:

sudo npm install -g yo  
sudo npm install -g generator-keystone

It will take some time for these operations to be completed, so please be patient.

SSH install Keystone

5. Once installation is finished, let’s create a new directory for your project (named, for example, keystone-project) in the ROOT folder and navigate inside it.

mkdir keystone-project  
cd keystone-project

create Keystone project folder

6. Now it’s time to create a new project with the help of the embedded wizard. Type the next command:

yo keystone

Answer the appeared questions in order to include the preferred modules to your site and configure it:

create Keystone project

Wait until all the necessary packages are installed and your project is ready.

7. Before you can run your application, you need to connect the previously created database to it.

Therefore, open the editor for .env file in keystone-project folder using the next command:

vi .env

Add the following line to it (Insert to edit, Esc :wq to save changes and exit):


Here {database_URL} should be substituted with the link to your DB server (without http:// part) and {database_name} - with the name of database you’ve created earlier.

Note: If you’ve added some modules to your site (like image gallery, etc) .env file can contain some additional connection strings. DO NOT delete these settings, just add the specified line below them.

It looks like the following in our case:

Keystone database connection

8. After that, let’s stop the default Node.js application in order to let our project start instead.

sudo service cartridge stop

stop default NodeJS application

9. Finally, run your Keystone app by means of executing the following command inside your keystone-project folder:

node keystone

run Keystone

Note: DO NOT terminate this process as it’s required for this project to work properly on your site (however, you still can close your terminal or just its tab).

10. Switch back to the Jelastic dashboard and run your project by means of clicking Open in Browser next to your keystone environment.

open Keystone in browser

Note: If you restart your application server, you’ll need to run the application through the console again with sudo service cartridge stop and node keystone commands (ensure you’ve entered the appropriate project folder).

Congrats! Now you have a complete and ready-to-work site, with numerous awesome features available.


Enjoy the power of the Cloud with Jelastic PaaS!

What’s next?