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 nature.In this article, you’ll get acquainted with the distinctive features of the Go hosting 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 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.
For more information about setting up the environment, see the Create Environment document.
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 to easily upgrade your software version upon the new stack 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
- in case of error, performs download as for the common Git project and retries getting the Go dependencies
- builds the project with the go build command (using the additional options specified in the GO_BUILD_OPTIONS variable)
- runs the binary defined by the GO_RUN variable with the go run command (using the additional options specified in GO_RUN_OPTIONS)
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 used entry point, 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 platform automatically, you just need to specify the lower and upper 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 settings (usually this limit stands for 16 nodes and can be enlarged by sending the appropriate request to support).
Also, you can notice, that upon Golang server scaling, the load balancing node is automatically added to 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 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.