Bitmana PaaS is a truly multilingual cloud platform, which currently provides Java, PHP, Python, Ruby, Node.js, Go environments for running projects of all sizes and various nature.
In this document, you’ll get acquainted with the distinctive features of the Go hosting and will be introduced to the Go-related possibilities within Bitmana PaaS.
Go Environment Hosting
In order to host your Go application, you need to create the appropriate environment using Bitmana 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 Bitmana are completely isolated containers, which are evenly distributed across the available hardware nodes (physical servers or VMs) using automatic anti-affinity rules. This eliminates a risk of your application downtime, i.e. ensure high availability.
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 Bitmana:
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 Bitmana 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:
- Deployment Manager
- Deployment Guide
- Auto-Deploy Overview
- Deployment Hooks
With Bitmana 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).
Tip: For the access via Public IP, the traffic can be redirected to another environment with the help of the SwapExtIps API method (also, available via CLI).
Automatic Vertical Scaling
Automatic vertical scaling is ensured by Bitmana 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.
In addition, hosting at Bitmana PaaS allows using other built-in tools and features, for example:
- Built-in or Custom SSL
- Public IPv4
- A wide range of complementary software stacks, including SQL and NoSQL databases
- Container firewalls, endpoints and environment network isolation
- User-friendly UI and SSH access
- Open API and Cloud Scripting for automation
- Pay-per-use pricing model
- Collaboration for teamwork
- Multi-cloud distribution