Endpoints – Simplicity of a Direct Connection to the Jelastic Cloud

| June 11, 2015

1 logoJust a few days ago, you still needed to have the Public IP address attached to your environment for linking it with any third-party tool or service, however our recent 3.3 Release removes this constraint! Meet the new Jelastic Endpoints feature - implemented to deal with this barrier, it brings you a bunch of other interesting and available solutions, that we’d like to help you to discover in today’s article.

Delving into the details, the “endpoints” term at Jelastic refers to the possibility of TCP/UDP ports mapping via the Shared Gateway, which is intended to simplify the instances’ collaboration with different external applications and resources. This is achieved through providing the ability to establish the direct connection (over either raw TCP or UDP protocol) to the corresponding node, without the mandatory Public IP address attached.

Such linking can be used to enable a great variety of different tasks to be run, and below we’ll show you some common ones, like:

  • accessing a database remotely
  • running multiple project copies on a single app server

Beside the increased convenience, with endpoints you can cut your spends for the External IP usage, which, otherwise, would be required for such operations. Obviously, endpoints can’t completely replace them, but may become useful in some elementary jobs, and being combined with other Jelastic features (like automatic vertical and horizontal scaling, discounts tiers, etc) such an approach can help you to significantly save your money.
So, let’s get started! Firstly, we’ll learn how to work with endpoints at Jelastic and cover the most important points in using this feature.

Managing Endpoints

As an example, we will use an environment with the Apache application server and MySQL database. So, in order to be able to follow the presented instructions, create a new environment with the abovementioned instances inside. It should look similar to the one below:2 envNow, hover over your environment and click the appeared Settings button.3 endpointsWithin the opened tab, switch to the Endpoints menu item. Here you can manage your mapping’s list, i.e add new endpoints or edit/remove the existing ones - we’ll consider all of these operations one by one.

Add Endpoints

To create a new endpoint, click the Add button from the top tools’ pane and fill in the appeared Add Endpoint form with the relevant data:4 add

  • Node - select the instance you’d like to set the endpoint for (here only the comprised in the chosen environment nodes are displayed, i.e. MySQL and Apache in our case)
  • Name - either type the title for a new endpoint or choose one of the preconfigured options (the corresponding list is provided within this article, just down the page)
  • Private port - specify the preferred local node’s port to be used for mapping (it’s substituted automatically in case the predefined Name was selected)
  • Protocol - select either TCP or UDP

The rest of fields, i.e. Public port and Access URL, will be configured by Jelastic automatically.

Select Add when ready.

For more convenience, we provide the embedded list of predefined endpoint configurations, based on the protocol or purpose implied:5 table*Optional values availability depends on the type of the chosen node:

  • database nodes are provided with the default endpoint, named after themselves and with the appropriate port stated
  • Windows-based containers have the additional RDP (3389) connection
  • IIS application server has the DEPLOY (8172) connection for the direct project deployment from IDE

After the confirmation, you’ll see the new endpoint appeared in the list.6 addedHere you’ll find the Public port and Access URL actual values already displayed. Now you can use these parameters to perform the required operations - just click on a particular string to get the opportunity to easily copy it.

Note that for linking functionality to work properly with the VPS and Docker® containers, the corresponding private ports (stated during the endpoint addition) at these nodes should be opened by the owner manually.

Edit/Remove Endpoint

Any existing endpoint can be easily edited or removed in case of further unnecessity. For that, just select the desired connection within the endpoints list and click the Edit (either use double-click on the required line) or Remove button, located at the tools’ pane above.7 edit-removeDepending on the option chosen, you’ll see the following:

  • Edit - in the appeared Edit Endpoint form (which is completely similar to the Add one) you can modify all the abovementioned settings except the Node choosing (as this makes no sense - you could just add a new similar endpoint to the required instance).

8 edit 2Once the required changes are made, just Apply them with the same-named button at the bottom of the frame.

  • Remove - the special pop-up frame will appear, where you need to confirm your decision:

9 removeJust after that, the corresponding endpoint will be removed from the list.

Endpoint Use-Cases

Now, let’s look through some examples of the practical endpoints’ usage (you can try them by yourself) for both of our servers.

Database Management

With endpoints, gaining remote access to your DB instance becomes pretty easy, as using this feature eliminates the necessity to acquire any additional options like a Public IP. To show this, we’ll consider two simple ways of performing this operation: through embedded OS terminal and third-party DB client.

Connection via Terminal

The most common approach is to use the embedded terminal of your local machine, as this does not require any additional installations or configurations and provides sufficient functionality for a simple connection establishment - just a single command is required:

mysql -h {host} -P {port} -u {user} -p10 sshwhere

  • {host} - endpoint Access URL without the port suffix specified (node30292-env-with-endpoints.jelastic.com in our case)
  • {port} - public port number assigned (10011 in this example)
  • {user} - database user name (Jelastic has sent it to you via email during the environment creation - by default it stands for root for all the new MySQL servers)

After the connection validation, you’ll be requested for the appropriate DB user’s password (it can also be found in the abovementioned email) in order to access your database.

That’s all! Now you can start working with your database through executing the required SQL queries.

Connection via Local Client

In the case you require advanced functionality or if you are used to managing the data stored within your database with more convenience, a type of database desktop client may come in handy here. It will provide you with a user-friendly graphic interface and the variety of included features to accelerate your work.

For an example of such a client, that will help to establish the remote connection to our database through the created endpoint, we’ll use one of the most popular DB management tools - MySQL Workbench.

  1. Run the abovementioned application and click the New Connection button.

11 wb 1

  1. In the appeared Setup New Connection frame, fill in the following fields at the top:
  • Connection Name - set an appellation for your connection (e.g. jelastic-db)
  • Connection Method - choose the Standard (TCP/IP) method

12 wb 2

Then, specify the required DB data inside the Parameters tab beneath:

  • Hostname - endpoint URL without the port number specified at the end (node30292-endpoints.jelastic.com in our case)
  • Port - the endpoint’s public port (we got port 10011 assigned during its addition)
  • Username - name of the admin DB user (Jelastic has sent it to you via email during the environment creation - by default it stands for root for all the new MySQL servers)
  • Password - either click Store in Keychain to enter and save your pass (which can be found within the same email) or skip this field to specify it during each connection attempt
  • Default Schema - the database schema to be used by default (can be also left blank)

Click OK to complete.

  1. Double-click on the newly appeared connection record to initiate its establishment and specify your password in the appeared frame (if you haven’t saved it before).

13 wb 3

You can also tick Save password in keychain if you don’t want to enter it manually each time you need to access your database. Click the OK button to proceed.

  1. In a minute, you’ll be connected to your DB.

14 wb 4
Great! Now you can start organizing your data using all the provided benefits of the full-featured management client.

Just in the same way you can connect to any other database server within Jelastic or, for example, backup and restore your data within dump files.

Multiple Development Stages at a Single App Server

Beside the elementary operations of DB management, endpoints also give the ability to implement a variety of useful and interesting solutions for other servers, like direct apps deployment from IDE (for IIS) or accessing the admin panel (e.g. for Smartfox) with no external address bound.

Below we’ll consider one of such beneficial possibilities this feature ensures - how to use a single application server as your production and development environment simultaneously (with the Apache instance from our environment as an example).

  1. So, map the endpoint to your Apache server with the preferred unused private port opened.

16 ap 2

Note: Do not choose the 80th private port for this task, as Apache uses it by default for the incoming HTTP-requests handling. Otherwise, the whole process, described below, will become pointless.
  1. Now, deploy your application twice to different contexts (e.g. prod and dev).

15 ap 1

  1. The next step is configuring Apache itself - thus, click the Config button next to this server and open its main configuration file (the conf > httpd.conf one).

17 ap 3

  1. Scroll down approximately to the 135th line and add the following string to the registry of listened ports:

Listen{port}18 ap 4

Here, the {port} parameter should be substituted with the private port number you’ve stated during the addition of the endpoint (we’ve chosen the 81st one).

  1. After that, move to the end of the file and duplicate the VirtualHost section, specifying the corresponding port number (the same as in the step above - 81st in our case) within its heading.

19 ap 5Then adjust the appropriate DocumentRoot locations for both virtual hosts with the corresponding projects (prod - for the default one and dev - for the custom section beneath).

  1. Save the performed changes and Restart the Apache server to apply them.

20 ap 6

  1. Now you can connect to your prod project as usual, e.g. using the Open in browser button (or entering the external custom domain if one was additionally bound to your app), while for accessing its dev version, you just need to specify the used endpoint’s Access URL.

21 ap 7

As a result, you’ve got two connection points to your two projects, which allow you to perform any desired testing or development tasks at one of the copies, with zero influence on the another one, and, moreover, they can be swapped in a few clicks if necessary.

That's all! Don’t miss the opportunity to get instant access to the above described opportunities and stacks of other Jelastic features for free, by signing up for a two-week trial period.

As always, we are eager to hear your opinion and suggestions on the newly implemented functionality, so feel free to share your experience with the endpoints usage or ask any questions within the comments below.