Topics:

Welcome to the first edition of One Framework a Day keeps the Boredom Away. In this series I will show you how to deploy a particular framework on Clever Cloud.

This post 0 is a little different as its goal is to explain you how Clever Cloud works and to help you get setup. If you already know Clever Cloud and have the CLI installed, wait for the next post tomorrow :)

What is Clever Cloud?

Clever Cloud is a Platform as a Service. We like to say we provide IT Automation and Application Sustainability. That and additional sleeping hours and serenity for our users.

IT Automation

What we mean by IT Automation is that we automate things. Beyond this obvious statement, what is important is that we do it, so you don't have to. You should be able to focus on writing code because it is what brings value to your organization. Anything else than code is infrastructure. It's a cost. We'll manage it.

To make it work you just have to agree with a couple of loose rules (well, 12 actually) and everything will be fine. If you use a build tool, just add a json file telling us which build tool goal we have to run, push your code and we do the rest.

From now on your application is up and running on Clever Cloud. That's where Application Sustainability kicks in.

Application Sustainability

What we mean by Application Sustainability is making sure your application stays in production. To do so we provide hardware monitoring out of the box. Even better, since you are usually using a build tool we know what runtime you are using so we know how to monitor it. We automatically integrate with Java's JMX or Haskell's EKG for instance.

This monitoring allow* us to give you additional features like self-healing: If your application crashes or does not answer we restart it automatically. We also bring automatic scalability both vertically and horizontally. And everything happens without downtime because we do blue/green deployment. Meaning, when we need to update a VM (say for an OS update or a security fix), we don't update it per se. We restart the same cycle on a brand new, updated VM. Once it's up, our reverse proxy simply redirects traffic to the new one(s). In that way, we decorelate service uptime from server uptime.

We can do all that because we embraced Immutable Infrastructure. This concept appeared somewhere around 2010 and is a full paradigm shift. Basically, not a single part of your infrastructure will ever be updated in place. It will either be created or removed, never modified. Modifying something creates uncertainty and possibly an inability to be reproduced. Immutable Infrastructure ensures reproducibility.

Applications or add-ons?

To support this, we manage two different concepts: Application and Add-on. Applications are stateless. They are represented by a runtime and sometimes a build tool. For example a Wordpress website does not need a build tool, just a runtime: a web server. As developers, application is where we spend the most time on. This is where we create value. All applications instances (VMs) are immutable. So you need to make sure your deployments are stateless. You have to store state in a database, object store or filesystem.

Which is where add-ons come in handy. They are not yet managed as Immutable Infrastructure (it is however part of our plan). They all our DBaaS (which all have automatic and on-demand backups), our shared filesystem, object storage like S3 etc… It also includes stuff like Jenkins, Artifactory, GitHub Enteprise, Gitlab and more.

Hopefuly this gave you a much better idea of what is Clever Cloud. We could go on longer but I will assume you are bored already. So moving on to practical things :D

Deploy your first Application

To create an account, simply go to our website and click on 'Sign UP and Try'. If you do not have a GitHub account you can signup manually here. Once you have an account you can start playing around with your free credits. Take a look at some of the videos we made on our YouTube channel.

Setup the CLI

After you have setup your accout you can install our CLI. It will be heavily used on most posts of the One Framework a Day series. There are a couple of ways you can install it. First you can checkout the GitHub project and build it from source. It's Node.js app so you will need npm, node and a couple of other dependencies described in the Readme.

You can also use a package manager or installer. Head over to our documentation to get the details for MacOS and homebrew, Windows and chocolatey or Linux and its prebuilt binaries.

Test the CLI

If you have an account and installed the CLI, you should be able to test your first application. First thing to do is to link your account to the CLI. Simply type clever login. This will get you through a login prompt to retrieve your newly created identification tokens.

Create a new directory called hello-world-app and inside create an index.html file containing the string Hello World. Then initiate a new git repository and commit the html file. Here are the steps you need to follow if you have a Unix system:

mkdir hello-world-app
cd hello-world-app
touch index.html
echo 'Hello World' > index.html
git init
git add index.html
git commit -m "my new website"

You now have a static website ready to be deployed to Clever Cloud. First you need to create an application of type static, then deploy the content of your site to the newly created application. Once it's done, open the website in your default browser:

clever create --type static-apache hello
clever deploy
clever open

Conclusion

Now you should know more about Clever Cloud and you have deployed your first application. Please note that if you don't like command line, you can also do all of this from our web console or our API. Actually, both the CLI and the console use our API :) This also means you can script whatever you want! And now remember that all the next posts will be dedicated to deploying a particular framework on Clever Cloud. See you soon :)


Profile picture of Laurent Doguin
By Laurent Doguin

Head of Developer Relation @clever_cloud. Devoxx Champion. I am also a nerdy metal head living in Paris.