DEV Community

Michael Levan
Michael Levan

Posted on

Deploying Container Images With PaaS

There are a lot of tools, methods, and practices that you can use in today’s tech world to deploy a container. There are also several locations, whether it’s Kubernetes, Nomad, or a simple virtual machine where you may want to deploy the container.

The problem is that, although every solution may not be cumbersome, the amount of solutions that are available is cumbersome. It’s just too much for engineers. While engineers are trying to figure out how to get the best working environment, they’re bogged down with far too many options.

In this blog post, you’ll learn about one of the most straightforward options, PaaS.

What Is Platform-as-a-Service (PaaS)

Before diving into how PaaS can give you an idea on making containerization easier, let’s first talk about what PaaS is.

Platform-as-a-Service, or PaaS for short, is an environment that includes everything you need to run a full application stack. It can contain:

  • The full cloud environment for you to deploy to.
  • All of the needed underlying networking.
  • The configurations for operating systems.
  • Underlying security protocols.

And a lot more depending on which PaaS you use.

The long and short of it is PaaS gives you the ability to build, deploy, and run an application stack. It doesn’t even have to be just containers. It could be a simple binary or some code that you want to run.

Why PaaS Can Make Containerization Easier

Now that you know a little bit about PaaS, let’s ask an important question - How does PaaS make containerization easier?

The answer is that it makes your team's life easier.

Example - a startup that has a few developers. The developers may be great at writing application code, but they may not have knowledge about networking, operating systems, CICD, and security. They just want a method of taking some code or a container and deploying it with everything the application needs to run out of the box.

That’s the best way that a PaaS can come into play.

It gives you the ability to not have to worry about managing infrastructure, networking, scaling, and operating systems. The goal is to simply deploy an application and it works as expected.

How To Use Aptible

Now that you have the theory and full understanding of why you’d want to use a PaaS and how you can think about it from a containerization perspective, let’s get hands-on and dive into a PaaS solution.

There are several solutions out there ranging from startups to large organizations like cloud providers. One solution that stuck out was Aptible.

Aptible stuck out because it targets startups, which is where a PaaS is ideal to run.

In the sections to come, you’ll see how to set up Aptible from start to finish.

Setting Up Aptible

Aptible offers a free 30-day trial that you can use to check it out and ensure that it’s the right solution for you. First, go to the Aptible signup page: https://www.aptible.com/

Image description

Next, click the purple 30 Day Free Trial button and fill in your information.

Image description

Setting Up An Environment

Once you’re signed up, you’ll see an Environments tab. An Environment is where your application will be deployed to. There is one environment that’s available by default.

Image description

You can also create your own environment which consists of either:

  • Shared tenancy (shared with other customers. Think Multitenancy).
  • Dedicated tenancy (think Singletenancy).

Image description

You can then choose where you want the stack to be deployed to, as in, which region.

Image description

Creating An App

Now that the environment is created or you decided to use the default, you can create and deploy a new app. For the purposes of this app, you’ll deploy a container image.

Within the container, click the orange Create App button.

Image description

Give your app a name and click the orange Save App button.

Image description

Once you create the new app, you’ll see a ton of different options available. You can use Terraform, Docker, or even deploy a code base.

Image description

For the purposes of deploying a container, you’ll use Docker. To do that, you need to use the CLI.

Deploying A Container Image

First, install the Aptible CLI.

brew install --cask aptible
Enter fullscreen mode Exit fullscreen mode

Next, log into the CLI.

You will be prompted for you:

  • Email
  • Password
aptible login
Enter fullscreen mode Exit fullscreen mode

Once logged in, you should see an output similar to the below.

  ~  aptible login
Email:  
Password:
Token written to /Users/.aptible/tokens.json
This token will expire after 7 days (use --lifetime to customize)
Enter fullscreen mode Exit fullscreen mode

Now that you’re logged in, there’s a simple one-liner that you need to run. Specify the app name you created in the UI and the container image that you want to deploy.

aptible deploy --app "testcontainer" --docker-image "nginx:latest"
Enter fullscreen mode Exit fullscreen mode

You’ll see an output similar to the below.

INFO -- : Image app-60487/4abf11ac-c37b-402c-bcbe-15200d0d798d successfully pushed to registry.
INFO -- : STARTING: Register service cmd in API
INFO -- : COMPLETED (after 0.19s): Register service cmd in API
INFO -- : STARTING: Derive placement policy for service cmd
INFO -- : COMPLETED (after 0.06s): Derive placement policy for service cmd
INFO -- : STARTING: Create new release for service cmd
INFO -- : COMPLETED (after 0.13s): Create new release for service cmd
INFO -- : STARTING: Schedule service cmd
INFO -- : COMPLETED (after 4.91s): Schedule service cmd
INFO -- : STARTING: Stop old app containers for service cmd
INFO -- : COMPLETED (after 0.0s): Stop old app containers for service cmd
INFO -- : STARTING: Start app containers for service cmd
INFO -- : WAITING FOR: Start app containers for service cmd
INFO -- : COMPLETED (after 6.1s): Start app containers for service cmd
INFO -- : STARTING: Delete old containers for service cmd in API
INFO -- : COMPLETED (after 0.0s): Delete old containers for service cmd in API
INFO -- : STARTING: Commit app containers in API for service cmd
INFO -- : COMPLETED (after 0.16s): Commit app containers in API for service cmd
INFO -- : STARTING: Commit service cmd in API
INFO -- : COMPLETED (after 0.07s): Commit service cmd in API
INFO -- : STARTING: Cache maintenance page
INFO -- : COMPLETED (after 0.05s): Cache maintenance page
INFO -- : STARTING: Commit app in API
INFO -- : COMPLETED (after 0.14s): Commit app in API
INFO -- : App deploy successful.
Enter fullscreen mode Exit fullscreen mode

Go back into the Aptible UI and you’ll see that the app is now deployed.

Image description

Top comments (0)