DEV Community

Rémy Apfelbacher
Rémy Apfelbacher

Posted on • Updated on

Hello world: Zerops Edition

One of the most famous examples in programming is the iconic "Hello world". To follow this tradition, we use this very example to show all the steps needed for turning existing or new code into a working application powered by the new cloud application platform called Zerops.

First things first: What is Zerops?

Zerops is a recently introduced PaaS such as Heroku or Render. Like them, it aims to be a universal platform that builds, deploys, runs, and manages your apps for you, be it a tiny project in development or a large one in production.

With Zerops, you have a wide array of options when it comes to what you can run. You can opt for anything from a simple static web server to several runtimes for different programming languages backed up by various database management systems and other storage systems.

Getting back to our “Hello world” example

To simplify matters we are omitting any extra steps such as connecting to GitHub and only focusing on the first steps. However, to increase the level a bit, we will take a look at two possible scenarios:

  • Using a static web server
  • Using a Node.js runtime

In both cases we assume that you already have a Zerops account and an installed zCLI (Zerops command line tool) with proper authentication set up. Please note that you could use any other runtime like for Golang or PHP.

"Hello world" – the simplest way

  • Create your index.html file with the following content:
<!DOCTYPE html>
<html>
<body>
  <h1>Hello world from Zerops!</h1>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode
  • Login to Zerops GUI, create a new Hello world project and add the Static server service with the chosen hostname staticserver0.

  • Then simply deploy your file using the zCLI command:

zcli deploy "Hello world" staticserver0 index.html
Enter fullscreen mode Exit fullscreen mode
  • Enable Zerops subdomain access via Public access & internal ports on the staticserver0 service and invoke the pre-generated URL in your browser.

Et voilà.

"Hello world" – still a simple way using Node.js

  • Create your index.js file with the following content:
const http = require('http')

const requestHandler = (request, response) => {
  response.end('Hello world from Zerops!')
}

const server = http.createServer(requestHandler)
server.listen(3000);
Enter fullscreen mode Exit fullscreen mode
  • For Zerops to know how to start the application, please create a zerops.yml configuration file next to it:
nodejs0:
  build:
    build: []

  run:
    start: node index.js
Enter fullscreen mode Exit fullscreen mode
  • Login to Zerops GUI and create a new Hello world (js) project and add the Node.js service with the chosen hostname nodejs0.

  • Then simply deploy your file using the zCLI command:

zcli deploy "Hello world (js)" nodejs0 index.js
Enter fullscreen mode Exit fullscreen mode
  • Enable Zerops subdomain access via Public access & internal ports on the nodejs0 service and invoke the pre-generated URL in your browser.

All done! Congrats.

Summing things up

We went through the basic steps of deploying an application to Zerops. You could see how simple it was. As you may have noticed from the sample zerops.yml files, on Zerops, you can take complete control of the building, deploying, and running of your code.

Coming up: more in-depth articles on how to make the most of Zerops.

Top comments (0)