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.
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.
3. Your environment will be created in a few minutes.
Create Database
Next, create a new database for your Keystone application.
1. Click the Open in Browser icon next to the MongoDB instance.
2. Log into the RockMongo admin panel within the opened browser tab (use the credentials you received via email).
3. Once entered, navigate to the Databases tab and click the Create new Database link.
4. In the opened frame, specify the name for your new database (keystonedb in our example) and click Create.
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:
- generate an SSH keypair
- add your public SSH key to the dashboard
- access your account via SSH
2. As soon as a connection is established, select your keystone environment.
3. Then, enter the Nodejs container.
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:
|
|
It will take some time for these operations to be completed, so please be patient.
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.
|
|
6. Now it’s time to create a new project with the help of the embedded wizard. Type the next command:
|
|
Answer the appeared questions in order to include the preferred modules to your site and configure it:
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:
|
|
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.
It looks like the following in our case:
8. After that, let’s stop the default Node.js application in order to let our project start instead.
|
|
9. Finally, run your Keystone app by means of executing the following command inside your keystone-project folder:
|
|
10. Switch back to the Jelastic dashboard and run your project by means of clicking Open in Browser next to your keystone environment.
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!