What are you looking for?

Deploy a Camunda BPM Docker Image with Amazon Web Services

By
  • Blog
  • >
  • Deploy a Camunda BPM Docker Image with Amazon Web Services
No one could argue that deploying the Camunda BPM platform to a web server is unmatched in its adrenaline-inducing excitement, but we should spare a thought for those people whose aversion to scripts and consoles has meant that they have never had the opportunity to enjoy Camunda BPM deployments to their fullest. Until now…

 

In this post I’m going to explain in detail how you can deploy Camunda BPM to a server using docker and Amazon Web Services (AWS) and interestingly enough – it doesn’t require so much as a glance at a console cursor.

To achieve this we’re going to be using two Amazon services:

  • RDS – to setup the process engine’s database
  • EC2 Container Service – as a container for the deployment.
The docker image will be used in conjunction with the EC2 container service to make the deployment even easier.

 

Note: you’ll need to sign up for an AWS account to follow this post, you can do that here

 

Creating a Database

At this point I should let you know that you need to change your region to “EU West (Ireland)” (on the top right of the screen). This is because currently the EC2 Container Service is only available at that location (in Europe), for ease of communication we’re going to create both containers in the same region.
 
To start creating a database first log into the AWS Services menu and select RDS from the arguably over populated dropdown.
RDS encircled in the AWS Services menu
Now you just need to click the “Launch a DB Instance” button to start the wizard.

 

launch DB instance screenshot

For this instance we would suggest creating a PostgreSQL database. This was decided after a short debate with my colleagues, in which it was agreed (unanimously I might add) that elephants are better than dolphins.

PostgreSQL database selected

We’re not planning on doing too much production with this database so on the next screen select No.

confirmation screen asking if database is used for production purposes

 
So now we need to add the DB details – which I’ve kindly added in the screen shot below.

DB details screen

 
 
 
 
 
Final step now, where we’ll be configuring the advanced settings, which should come as no surprise if you’ve looked at the name of this particular step. Once again the settings are available in the screen shots below

advanced db settings screen

backup and maintenance settings

Now click the launch button and in no time at all you’ll see a helpful little message saying that your DB instance is being created. Click on the “View Your DB Instance” button to watch the magic, and by “magic” I of course mean “a little blue rotating circle”. You might need to wait a short while, but eventually the status will turn green and read as “available” and by expanding it, you should see the following:

endpoint encircled in db configuration details
Our sharper-eyed readers will have noticed that I circled the Endpoint url for the database. Which in my case is “processenginedemo.chg37mv5ului.eu-west-1.rds.amazonaws.com”.You should memorize it (or copy it) as you’re going to need that later on when setting up the EC2 Container.

Creating an EC2 Container

Now to create the EC2 Container. The idea here is to create a simple container that will load and deploy a docker image of the Camunda platform. To start we return to the overcrowded Services menu and select “EC2 Container Service”
 

EC2 encircled in the AWS Services menu

 
Amazon has created a handy little wizard for creating the container, click the “Get started” button to begin the fun!
 

get started button
We’re going to be creating our own custom definition, so select accordingly
Select custom task definition in the wizard

 
 

The next step of the wizard is where the task definition is named, memory is allocated and parameters are created. To make that whole process both faster and easier you can click on the JSON tab and simply paste this JSON text which I’ve created with my own fair hands.


{
  "family": "Camunda",
  "containerDefinitions": [
    {
      "name": "camunda_bpm_platform",
      "image": "camunda/camunda-bpm-platform",
      "cpu": "800",
      "memory": "500",
      "entryPoint": [],
      "environment": [
        {
          "name": "DB_DRIVER",
          "value": "org.postgresql.Driver"
        },
        {
          "name": "DB_USERNAME",
          "value": "camunda"
        },
        {
          "name": "DB_PASSWORD",
          "value": "nobullshitbpm"
        },
        {
          "name": "DB_URL",
          "value": "jdbc:postgresql://processenginedemo.chg37mv5ului.eu-west-1.rds.amazonaws.com"
        }
      ],
      "command": [],
      "portMappings": [
        {
          "hostPort": "80",
          "containerPort": "8080"
        }
      ],
      "volumesFrom": [],
      "links": [],
      "mountPoints": [],
      "essential": true
    }
  ],
  "volumes": []
}

modify parameters for the task definition in the JSON tab

When you click back to the “Build” tab, you will see an entry called “camunda_bpm_platform” in the container definitions. The fun hasn’t ended yet – click on the definition because you still need to change one of the variables. Remember the database link that I told you to memorize? Well you’re going use it to create the DB_URL variable.
definition variables with DB_URL encircled

In the annoying tiny text field circled above add “jdbc:postgresql://” followed by the link to your database. Once you’ve done that – click update and move onto the next step.

While on the next step, if someone happens to ask you what you’re doing, you can tell them “I’m defining a service, giving it a name and setting up elastic load balancing”. It sounds a lot better than the reality, which is that you’re just copying from the screen shot below:

configuration settings

The final part of the setup is configuring the cluster and sorting out security groups. The top half of the step deals with the latter. You can see the settings in the screenshot below:

configure Cluster settings

In the IAM Role information sections you’ll need to create an ECS instance role and an ECS service role. This is actually a really straightforward process, click on the button circled below
Security group settings with create IAM roles encircled

which will bring you to the following page – you don’t need to do anything more than simply clicking “Allow”. Then you can return to the IAM Role information page and you’ll able to select the two roles from the drop down menu.

allow amazon ecs to use resources in your account

 
The last thing to do on this step is to click “Review & Launch”. It should come as no surprise to anyone that once that button is clicked you’ll be taken to the final step where you’ll get to… (spoiler)… review and launch your instance.
So before the excitement of coming to the end of this setup wizard overtakes you completely – click “Launch Instance and Run Service”.
More behind-the-scenes magic is taking place – this is visualized by an unremarkable blue bar slowly crawling from left to right.

ECS Launch status

When it eventually finishes you can go back to the EC2 container service though the services menu and instead of being greeted by a creation wizard, you’ll in fact see your newly setup cluster, lazily named “default”
Clusters list

Click on the cluster’s name to have a look at what’s going on inside, you’ll see a task running in the Tasks tab. If you don’t see the task up and running – have no fear, it might take a minute or two. Meanwhile in the ECS Instance tab you’ll see the container instance.

Default cluster details
Clicking on the name of the instance will bring you to a page displaying more details about the container including the public DNS.
Default cluster details with public DNS encircled

Following that link in your browser will bring you to an apache tomcat page and adding “/camunda”
to the end of the link will bring to what we’ve all been waiting for – the Camunda BPM platform!
Camunda Platform at the Public DNS address
Now you can relax and enjoy playing with skillfully-automated processes all thanks to me (and to a lesser extent AWS)!

Camunda Developer Community

Join Camunda’s global community of developers sharing code, advice, and meaningful experiences

Try All Features of Camunda

Related Content

How to avoid pitfalls and make the most of FEEL for a citizen developer.
How to avoid pitfalls and make the most of FEEL for a seasoned software developer.
Build software that meets needs while still protecting the environment for future generations.