Article
· Sep 22 2m read

Deploying InterSystems WSGI Apps on AWS with Pulumi and Docker Compose

In this post, we'll discuss our project that leverages Pulumi and Docker Compose to automate the deployment of InterSystems WSGI applications on AWS. The focus is on simplicity and efficiency, using pre-built infrastructure templates for provisioning and scaling AWS resources.

Overview

This repository automates the deployment of a WSGI-based application using AWS infrastructure templates and Pulumi’s Python SDK. The infrastructure is provisioned with Pulumi's declarative approach, while Docker Compose handles application orchestration. The project is structured to minimize the manual effort of setting up complex AWS resources, offering a Python-first way to manage the entire process.


Infrastructure Components

The deployment pipeline focuses on a few key AWS services:

  1. EC2 Instances: The core of the deployment. EC2 instances are provisioned to host the WSGI application using Pulumi. These instances are created with Docker pre-installed, which will later handle the application container.
  2. VPC: A dedicated VPC is created to encapsulate all networking aspects of the deployment. Subnets, route tables, and an internet gateway are configured to ensure proper traffic routing.
  3. Security Groups: Security groups are configured to allow HTTP (port 80) and SSH (port 22) traffic, alongside custom ports for the InterSystems WSGI application.
  4. IAM Roles: Pulumi provisions an IAM role for EC2, granting the necessary permissions for accessing resources like S3 buckets or ECR (if needed).

Pulumi + Python

Pulumi's declarative style makes infrastructure management highly manageable in Python. Here’s how it works:

  1. Define AWS Resources: In __main__.py, Pulumi is used to define the core AWS resources such as EC2 instances, VPCs, and security groups. This is done by interacting with the pulumi_aws module to specify the configuration.
  2. Parameter Injection: The project accepts a repository URL (where the application’s Docker Compose file is hosted) as a configuration parameter. Pulumi’s config module pulls this value and integrates it into the deployment.
  3. Docker Compose for Application Management: Once the EC2 instance is created, Docker Compose is used to pull the application from the given repository, build it, and bring it up in a containerized environment. This isolates the application runtime and ensures consistency across environments.

Test for yourself

Our application can be found here: https://openexchange.intersystems.com/package/Irisheimer

You can use the InterSystems WSGI project: https://github.com/grongierisc/iris-flask-template

Which cloud provider do you like the most?
Discussion (0)1
Log in or sign up to continue