Cuber is an automation tool that makes it easy to publish your applications on Kubernetes. Cuber is a gem written in Ruby, but you can deploy apps in any language and framework.
TL;DR Define a
cuber deploy and you will have your application running on Kubernetes (which is much cheaper than Heroku).
Deploy your apps on Kubernetes easily. Get the simplicity of a platform (PaaS) at the cost of infrastructure (IaaS).
Deploy your apps on Kubernetes easily.
First you need to install the prerequisites:
Then install Cuber:
$ gem install cuber
Open your application folder and create a
Cuberfile, for example:
# Give a name to your app app 'myapp' # Get the code from this Git repository repo '.' # Build the Docker image automatically (or provide a Dockerfile) buildpacks 'heroku/buildpacks:20' # Publish the Docker image in a registry image 'username/myapp' # Connect to this Kubernetes cluster kubeconfig 'path/to/kubeconfig.yml' # Run and scale any command on Kubernetes proc :web, 'your web server command'
You can also see a more complete example.
Then in your terminal:
$ cuber deploy
Finally you can also monitor the status of your application:
$ cuber info
There are already many platforms and tools to publish and run your applications in the cloud:
- Heroku is simple, but you get lock-in and high costs when you scale.
- Capistrano works very well, but when you scale on multiple machines you need to manage each of them (and can become a pain when you start having 10+ servers).
- Dokku and other projects are great projects, but they don't have horizontal scalability (you are constrained on a single server).
- Managing servers and infrastructure directly (e.g. use droplets directly on DigitalOcean) is complex and time consuming and it doesn't scale well to tens or hundreds of servers.
- Jenkins, Argo CD, Helm, kustomize and other devops tools for Kubernetes require deep knowledge of Kubernetes and they basically add complexity over complexity.
... And that's why, after using many of the above solutions, I built Cuber.
Cuber has the simplicity of a PaaS, like Heroku, while you get the cost of bare infrastructure (i.e. by using Kubernetes, instead of Heroku, you get a 80% cost reduction!).
Also, you don't have provider lock-in, since you can easily move to any Kubernetes provider (e.g. DigitalOcean, Vultr, Google Cloud, AWS, or any other).
You just need to create a Cuberfile for your application (it is somewhat similar to a Procfile for Heroku or a Capfile for Capistrano).
A Cuberfile is made only of a few lines of code.
Here's an example for a Rails application:
app 'myapp' repo '.' buildpacks 'heroku/buildpacks:20' image 'username/myapp' kubeconfig 'kubeconfig.yml' proc :web, 'bundle exec puma', scale: 3 env 'RAILS_ENV', 'production' env 'RAILS_LOG_TO_STDOUT', 'enabled' env 'RAILS_SERVE_STATIC_FILES', 'enabled' env 'RAILS_MASTER_KEY', File.read('config/credentials/production.key').strip, secret: true
As you can see we define:
- the name of our application
- the Git repo (i.e. the location of the Git repo, where to get the source code)
- how to build the application (i.e. in the above example we use automatic builds with Heroku Buildpacks, but we can also provide a Dockerfile if we prefer)
- where the store the Docker image of our application (i.e. the Docker repository)
- the Kubernetes cluster (i.e. where to deploy our application)
- the process to run (i.e. in this case we define the web server process, but we can also add background workers and other custom processes)
- the environment variables and secrets that we want to make available to our running application.
This is only a basic example, but you can also add more configurations (e.g. database migrations, ssl, etc.)
After defining your Cuberfile, you can deploy your application to Kubernetes with a single command:
$ cuber deploy
This command will run a CI/CD pipeline:
- Checkout the code from the Git repository
- Build the app using Buildpacks or Docker
- Publish the Docker image in the Docker registry
- Run your app on Kubernetes
Finally you can see the status of your running application:
$ cuber info
Using Cuber, it's not only simple to deploy an application, but it's simple to maintain it over time.
When you need to change a configuration, simply edit the
Cuberfile and then type
cuber deploy again.
You can also run maintenance task directly on your cluster:
$ cuber run [yourcommand]
For example with a Rails application you can run:
$ cuber run rails db:migrate $ cuber restart
Or you can run interactive shells, for example:
$ cuber run bash $ cuber run rails console
You can even see your application logs with a simple command:
$ cuber logs
Cuber is a new project, but it uses the best practices and it is a solid tool meant for production.
Give it a try ;)