DNS Hostnames for Direct Connection to Containers

Note: This document is based on Jelastic version 5.1

Being able to easily connect to Cloud services is a criteria of great importance for all of the developers. In Jelastic, each newly created node is assigned a number of automatically generated hostnames, pointed to the appropriate server internal/external IP address.

Depending on a type of the created node, the set of hostnames for it could differ. Thus, below we’ll consider the possible ways to refer to a particular node, hosted at Jelastic Cloud, either from inside (i.e. when managing it via Jelastic SSH Gate) or outside of the Cloud:

Common Hostnames

Each container at the Platform can be accessed by its internal IP address with an URL of one of the following formats:
  • node${nodeId}-${envName}.${platformDomain}
  • node${nodeId}.${envName}.${platformDomain}

Herewith, the highlighted placeholders should be replaced with the next values:
  • ${nodeId} - an automatically generated unique digit identifier, assigned to every container within a Platform

  • ${envName} - environment name (not an alias), specified during its creation
  • ${platformDomain} - domain name of a hosting service provider's Jelastic installation you use

Both of these domain formats can be used for refering to nodes from either inside or outside of a Platform (i.e. allowing to establish both internal and external connections).

Note:

  • The latter reference string - with a period (“.”) as separator - is supported for Docker containers starting from 4.8 Jelastic version and for the rest of certified templates - since 5.1 release.
  • Custom domain (if any is attached) resolves environment entry point and can not be used to establish connection to a particular container.

Supplementary Hostnames for Particular Node Types

Some of Jelastic certified stacks are provisioned with additional hostname prefixes (i.e. where the appropriate stack name is used instead of the node string) to make their management more convenient.

Note: Such supplementary prefixes are valid only within domains with a hyphen as a separator.

Node TypeStackAdditional Hostname
Custom Docker Сontainersdocker${nodeId}-${envName}.${platformDomain}
DatabaseCassandra 1/2cassandra${nodeId}-${envName}.${platformDomain}
CouchDBcouchdb${nodeId}-${envName}.${platformDomain}
MariaDB 5/10mariadb${nodeId}-${envName}.${platformDomain}
Memcachedmemcached${nodeId}-${envName}.${platformDomain}
MongoDB 2/3mongodb${nodeId}-${envName}.${platformDomain}
MSSQLmssql${nodeId}-${envName}.${platformDomain}
MySQL 5.6/5.7mysql${nodeId}-${envName}.${platformDomain}
Neo4j 1/2neo4j${nodeId}-${envName}.${platformDomain}
OrientDBorientdb${nodeId}-${envName}.${platformDomain}
PostgreSQL 8/9postgres${nodeId}-${envName}.${platformDomain}
Redisredis${nodeId}-${envName}.${platformDomain}
VPSvps${nodeId}-${envName}.${platformDomain}
Note: Currently, the converted dockerized stack templates (the process of transition to which has started from Jelastic 5.0.5 version) do not support the mentioned additional hostnames’ usage.

All alternative domain strings, shown in the table above, can be utilized just as common hostnames.

Short Hostnames

All the newly created Docker containers (since 4.8 version) and dockerized Jelastic-managed stacks (since 5.1 release) are provisioned with a specific DNS rule, which allows usage of the additional simplified hostname:

  • node${nodeId} - alias to refer to a container in confines of a single environment

Utilizing such short domains in server configuration files, application source code and SSH console (within often used commands like ping, host, dig, etc) makes operating with Dockerized stacks via Platform internal network much more convenient. Additionally, such approach enables painless environment migration to another hardware region through eliminating the necessity to adjust your application code due to the changed server location.

Hostnames for Linked Containers

Upon linking two Docker-based environment layers, a set of dedicated DNS records are automatically added to the global Jelastic database. This allows to refer to the nodes within a target layer from the source ones (but not vice versa) when working in confines of these two layers using the following hostname aliases:
  • ${linkAlias} - to connect to a random node within target layer; an exact node to respond is chosen by means of the Round-Robin algorithm to ensure even load distribution
  • ${linkAlias}_${N} - to access a particular container within a target layer

Here, the appropriate placeholders are to be substituted with:
  • ${linkAlias} - link name you’ve specified during its setting (e.g. tomcat in the image below)

  • ${N} - nominal index number (in a 1...N range) of a particular container within the target linking layer (e.g. tomcat_1, tomcat_2), etc; herewith, master container is always considered the 1st instance, whilst the rest of nodes within a layer are assigned numbers according to their nodeID values, sorted in the ascending order (starting with the _2 index respectively)

For example, if there are three containers on a layer - with the 123, 124 (master) and 125 IDs. According to the above-described implementation, the aliases will be assigned as follows:
  • alias_1 - link to the 124 container as a master node
  • alias_2 - will point to the 123 instance since it has the lowest ID among the remaining containers
  • alias_3 - for referring to the 125 container as the one with the next lowest nodeID

Tip: By appending an environment domain (i.e. .${envName}.${platformDomain}) to any of these aliases, the corresponding containers can be accessed externally, i.e. from anywhere over the Internet.

Now, you know all the specifics and shortcuts that can be used to refer to your nodes, which will help to quickly and efficiently organize connections between your application instances.