- AWS Account
- ECS Cluster (either ECS using Amazon EC2 or ECS on AWS Fargate)
- PostgreSQL Database accessible from the ECS Cluster (either self-hosted or hosted by AWS RDS)
You will need the following information:
- PostgreSQL Hostname (from here on: <psqlhost>)
- PostgreSQL Username (from here on: <psqluser>)
- PostgreSQL Password (from here on: <psqlpassword>)
Log into the PostgreSQL Database via
psql and execute the following commands:
Amazon DocumentDB does not support several features required by JTL Reporter to serve as a drop-in replacement for MongoDB (see Using JTL-Reporter with AWS DocumentDB), so we are going to use AWS Elastic File System for the MongoDB persistent storage.
Create an EFS File System and Mount Target(s) accessible from the ECS Cluster (see the
EFS documentation for a walkthrough). Note
the File System ID, which looks like
fs-0a1b2c3d (from now on: <efsid>).
You require the following information:
- Any string to serve as the JWT Token (from here on: <jwt_token>)
- Any string to serve as the JWT Token Login (from here on: <jwt_token_login>)
The hostnames for the docker containers in the task are hard coded. This is no problem when bringing up the service
docker-compose, but in ECS Fargate you cannot assign hostnames to the containers in a Task. To work around this,
we will append the hostnames for the backend, frontend, listener, and mongodb to
/etc/hosts on the containers (which
contains the IP address of the Task, so it will resolve the local hostnames to the correct IP address).
Do do that, we modify the
command of the containers in the
ContainerDefinitions to first echo the hostnames into
/etc/hosts, then start the actual service.
For MongoDB, we also first echo all commands to prepare the database into
before starting the service. We also attach the EFS volume we created earlier to the
/data/db/ directory to serve as
IMPORTANT: Only one MongoDB can access the database files on the EFS volume concurrently, so you need to ensure that only one JTL Reporter service is running at a time and spin down the old service before replacing it with a newer version.
Below is a minimum viable ECS Task Definition CloudFormation resource. You will have to adjust it to your environment and configuration.