IBM Code Engine will not force you to learn a lot of new things. Buildpack is something you know from Heroku. Buildpacks are available for Go, Java, Node.js, PHP, and .NET Core. IBM Code Engine is currently available as a Beta but the production version will be available sooner. Most of us are fans of Kubernetes. Kubernetes is a powerful tool for managing containerized applications. Same goes for serverless platform like OpenWhisk. When we want to run a small application then Kubernetes and OpenWhisk on their server are too big and expensive, and also consumes significant effort to complete the setup. IBM’s Code Engine comes to the list of options when we are considering Kubernetes and OpenWhiz. As we do not need to pay for the idle infrastructure, our cost will be lower.
Apart from the requirement of having an IBM Cloud Account, you need to have IBM Cloud CLI installed and the Code Engine plugin installed. For GNU/Linux, run the following command:
1 | curl -sL https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/master/linux-installer/idt-installer | bash |
For Windows, run the following command in PowerShell (as admin):
---
1 | [Net.ServicePointManager]::SecurityProtocol = "Tls12, Tls11, Tls, Ssl3"; iex(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/master/windows-installer/idt-win-installer.ps1') |
Login to your account :
1 | ibmcloud login |
Install the Code Engine CLI by running the following command:
1 | ibmcloud plugin install code-engine |
This is an example command on how to use the plugin :
1 | ibmcloud ce project create --name myproject |
Here is the CLI help :
1 | ibmcloud ce proj -h |
It is very easy to work from the web UI, there are lot of official guides, such as this one. Here are some samples on GitHub which will help you to get started.
I ran Hello World example app to test, I got this on a public URL as output :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | Hello World from: ___ __ ____ ____ / __)/ \( \( __) ( (__( O )) D ( ) _) \___)\__/(____/(____) ____ __ _ ___ __ __ _ ____ ( __)( ( \ / __)( )( ( \( __) ) _) / /( (_ \ )( / / ) _) (____)\_)__) \___/(__)\_)__)(____) Some Env Vars: -------------- HOME=/root HOSTNAME=codeengine-app-31-00001-deployment-666cfb958c-52pph KUBERNETES_PORT=tcp://172.21.0.1:443 KUBERNETES_PORT_443_TCP=tcp://172.21.0.1:443 KUBERNETES_PORT_443_TCP_ADDR=172.21.0.1 KUBERNETES_PORT_443_TCP_PORT=443 KUBERNETES_PORT_443_TCP_PROTO=tcp KUBERNETES_SERVICE_HOST=172.21.0.1 KUBERNETES_SERVICE_PORT=443 KUBERNETES_SERVICE_PORT_HTTPS=443 K_CONFIGURATION=codeengine-app-31 K_REVISION=codeengine-app-31-00001 K_SERVICE=codeengine-app-31 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PORT=8080 PWD=/ SHLVL=1 |
This is the source code :
1 | https://github.com/IBM/CodeEngine/blob/main/helloworld/helloworld.go |
Honestly, I can see a lot of things are missing in documentation and examples – “Attention: This service is beta. “.
Tagged With engine basics