Golang Hosting From Jelastic PaaS
Golang Hosting From Jelastic PaaS
Jelastic is a great hosting solution for projects based in all kinds of popular web dev language. And now they support Go!
Join the DZone community and get the full member experience.Join For Free
Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.
Jelastic PaaS is a truly multilingual cloud platform, which currently provides Java, PHP, Python, Ruby, Node.js, .NET, and, from now on, Go environments for running projects of all sizes and various natures. In this article, you'll get acquainted with the distinctive features of the Go hosting platform and will be introduced to the Go-related possibilities within Jelastic PaaS.
Go Environment Hosting
In order to host your Go application, you need to create the appropriate environment using the Jelastic Topology Wizard.
Switch to the Go engine tab, add Golang as your application server and any other software stack required for your project (e.g. load balancers, databases, or shared storage). If needed, adjust your environment nodes count, cloudlet limits for RAM and CPU, attach Public IPs, etc.
Note: All instances at Jelastic are completely isolated containers, which are evenly distributed across the available hardware nodes (physical servers or VMs) using automatic anti-affinity rules. This eliminates the risk of application downtime, i.e. it ensures high availability.
For more information about setting up the environment, see the Create Environment documentation.
Currently, the following versions of the Golang stack template are supported by Jelastic:
- Golang 1.9.1
- Golang 1.9.2
- Golang 1.9.4
- Golang 1.10
You can choose the preferred version during environment creation and change it later through container redeploy. Herewith, all the custom data inside the node(s) will be saved, which, for example, allows you to easily upgrade your software version upon the new stack's template release.
Go Application Deployment
After environment creation, you can deploy your Go project from the Git repository (the deployment from application archive will be implemented in the upcoming platform release).
It is possible to customize the deployment process by providing or adjusting the following container variables:
- GO_RUN - sets a name of the executable binary file (if not specified, the deployment script will try to locate one based on the Git project name).
- GOPATH - defines the deployment folder (/home/jelastic/webapp, by default).
- GO_BUILD_OPTIONS - provides additional options for the build operation (-a , by default, to force rebuilding of packages that are already up-to-date).
- GO_RUN_OPTIONS - provides additional options for the run operation.
During deployment, Jelastic PaaS automatically performs the following steps:
- Parses the provided Git URL to get a link to the Go project.
- Downloads the package with all the dependencies using the go get command.
- Builds the project with the
go buildcommand (using the additional options specified in the
- Runs the binary defined by the
GO_RUNvariable with the
go runcommand (using the additional options specified in
After successful deployment, the Go project is located in the directory set with the
GOPATH variable. Herewith, the workspace hierarchy inside is based on the requirements in the official documentation.
You can learn more about Go applications deployment via the appropriate documents:
With Jelastic PaaS, you can easily bind an external (custom) domain name to your Go application to be used instead of the default environment domain. Depending on the entry point used, there are two options:
- CNAME redirect if using Shared Load Balancer; is recommended for dev and test environments.
- DNS A Record if using Public IP; can handle high traffic load and is suitable for production environments.
Additionally, you can easily swap domains to redirect traffic from one environment to another (e.g. to switch to the newer application version without downtime).
Automatic Vertical Scaling
Automatic vertical scaling is ensured by Jelastic ability to dynamically provide the resources (RAM and CPU) for a server within predefined limits according to its current demands, with no manual intervention required. This feature guarantees you never overpay for unused resources and saves your time due to eliminating the necessity of handling the load-related adjustments or architectural changes.
The scaling process is handled by the platform automatically, you just need to specify the lower and upper of cloudlets limit (each one equals to 128 MiB of RAM and 400 MHz of CPU) for your Go server through the topology Wizard:
Your application will work within these limits, reducing resource consumption when the load is down or increasing them when the load is up. Thus, you only pay for the resources that are actually consumed. For more information, please refer to the automatic vertical scaling documentation.
Manual Horizontal Scaling
Extra Golang servers can be easily added via the topology wizard during environment creation or adjustment. Just click the "+" button within the Horizontal Scaling section and add the required number of instances.
The maximum number of the same-type servers within a single environment layer depends on a particular hosting provider's settings (usually this limit stands for 16 nodes and can be enlarged by sending the appropriate request to support).
Also, you'll notice that upon the Golang server scaling, the load balancing node is automatically added to the environment topology (required for the proper requests distribution). Find more details about manual horizontal scaling in the documentation.
Automatic Horizontal Scaling
Automatic horizontal scaling is implemented through tunable triggers, which allow you to increase or decrease the number of nodes due to the application load. To configure automatic scaling, open the environment Settings > Monitoring > Auto Horizontal Scaling section and click the Add button.
Here, you can configure the triggers for specific stacks and resources (CPU, RAM, Network, Disk) by adjusting the conditions of scaling.
Learn more about automatic horizontal scaling in the corresponding document.
In addition, there is a set of other features and functionality provided by Jelastic Go hosting, among them:
- Custom or Jelastic SSL.
- Public IPv4 and IPv6.
- Wide choice of managed databases.
- Container firewalls, endpoints, and environment isolation.
- User-friendly UI and direct SSH access for management.
- Open API and Cloud Scripting for automation.
- Pay-as-you-use pricing model.
- Collaboration functionality for teamwork.
- Multi-cloud distribution.
The released Go cloud hosting is ready for running dev, test and production environments. The registration is available at Jelastic PaaS.
Published at DZone with permission of Tetiana Fydorenchyk , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.