AWS AMI products

Introduction

We use an Ubuntu image using Docker to deploy Panintelligence containers. This allows the dashboard to use good features from docker such as health checks and self healing properties. We have a predefined docker-compose YAML script built into the AMI that deploys the dashboard.

Why use docker?

The platform makes it easier, simpler, and safer to build, deploy and manage containers. Docker is essentially a toolkit that enables developers to build, deploy, run, update, and stop containers using simple commands and work-saving automation through a single API.

Breakdown of Docker deployment:

Docker-compose script for Panintelligence containers: “/var/panintelligence/docker-compose.yml

version: "3" services: dashboard: image: ${SERVER_IMAGE}:${SERVER_TAG} container_name: dashboard restart: unless-stopped env_file: - dashboard.env ports: - 8224:8224 expose: - 8224 volumes: - ${PANINTELLIGENCE_KEYS_PATH}:/var/panintelligence/Dashboard/keys/ - ${PANINTELLIGENCE_EXCEL_PATH}:/var/panintelligence/Dashboard/excel-files/ - ${PANINTELLIGENCE_THEMES_PATH}:/var/panintelligence/Dashboard/tomcat/webapps/panMISDashboardResources/themes/ - ${PANINTELLIGENCE_IMAGES_PATH}:/var/panintelligence/Dashboard/tomcat/webapps/panMISDashboardResources/images/ - ${PAINTELLIGENCE_LOGS_PATH}:/var/panintelligence/Dashboard/tomcat/logs/ scheduler: container_name: scheduler image: ${SCHEDULER_IMAGE}:${SCHEDULER_TAG} restart: unless-stopped env_file: - scheduler.env volumes: - ${PANINTELLIGENCE_KEYS_PATH}:/var/panintelligence/Dashboard/keys/ renderer: container_name: renderer image: ${RENDERER_IMAGE}:${RENDERER_TAG} restart: unless-stopped env_file: - renderer.env pirana: container_name: pirana image: ${PIRANA_IMAGE}:${PIRANA_TAG} restart: unless-stopped env_file: - pirana.env excel-reader: container_name: excel-reader image: ${EXCEL_IMAGE}:${EXCEL_TAG} restart: unless-stopped env_file: - excel-reader.env

Docker-compose script for Database: “/var/panintelligence/docker-compose.db.yml

version: "3" services: database: image: mariadb:latest container_name: database env_file: - database.env command: - --lower_case_table_names=1 restart: unless-stopped ports: - 3306:3306 expose: - 3306 volumes: - ${DB_DATA_PATH}:/var/lib/mysql healthcheck: test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] timeout: 20s retries: 10

Environment variables

Within the YAML script it uses environment files to pass in the variables. Each container has their own environment file. You can see what type of environment variables you can use here: https://panintelligence.atlassian.net/wiki/spaces/PD/pages/34374123/Environment+Variables

Environment file

Container

Description

Environment file

Container

Description

dashboard.env

dashboard

You will need to specify the external database credentials and Licence Ke, if you’re using “Panintelligence BYOL No Repo Database”.

scheduler.env

scheduler

You will need to specify the external database credentials if you’re using “Panintelligence BYOL No Repo Database”.

pirana.env

pirana

 

excel-reader.env

excel-reader

 

renderer.env

renderer

 

database.env

database

All Panintelligence products have an inbuilt “MariaDB” container for the Dashboard. If you’re using “Panintelligence BYOL No Repo Database”, Please specify your external database credentials you are using.

Volumes

You can create your own volume paths if you wish, you will have to change the environment variables in “/var/panintelligence/.env".

Environment variable

Default path

Description

Environment variable

Default path

Description

PANINTELLIGENCE_KEYS_PATH

/var/panintelligence/keys

The security keys between the container.

PANINTELLIGENCE_EXCEL_PATH

/var/panintelligence/excel

To store excel files that you want to use inside the dashboard.

PANINTELLIGENCE_THEMES_PATH

/var/panintelligence/themes

To store the themes for the dashboard.

PANINTELLIGENCE_IMAGES_PATH

/var/panintelligence/images

To store the images for the dashboard.

PAINTELLIGENCE_LOGS_PATH

/var/panintelligence/logs

To store all the logs from the dashboard container. You will look in this volume to view any logs.

DB_DATA_PATH

/var/panintelligence/data

Keeps a backup of your database container if you’re using it within the EC2 instance.

Boot up

To ensure the Panintelligence dashboard service is running when you start the AMI instance. We are using “panintelligence.service”, which ensures that the docker is enabled and the docker-compose scripts are running. If you wish to change the service on how it starts you can change it here:

“/etc/systemd/system/panintelligence.service"

Template of Panintelligence BYOL No Repo Database :

[Unit] Description=Panintelligence docker compose service Requires=docker.service After=docker.service [Service] RemainAfterExit=yes Restart=always User=pi-user Group=docker WorkingDirectory=/var/panintelligence/ ExecStart=docker-compose -f /var/panintelligence/docker-compose.yml up -d ExecStop=docker-compose -f /var/panintelligence/docker-compose.yml down TimeoutStartSec=0 [Install] WantedBy=multi-user.target

Template of BYOL:

The docker-compose runs the database docker-compose script before it runs the dashboard to ensure the database is healthy.

How to upgrade?

You can pull the new version from “AWS marketplace” and search for the “Panintelligence” to view our products. The new versions of the AMI will ensure all packages be updated and any new features be added. The new AMI products will have up-to-date docker tags for the latest releases.

If you are a member of our private DockerHub and/or GitHub repository, You can also change the tags within the “/var/panintelligence/.env" and reboot the service for the latest docker container tags. We are sunsetting using DockerHub for such storage, therefore new requests for access will be handled through GitHub - please see HERE for more information.

EC2 Userdata?

We have an example of our AWS CloudFormation script that follows best practices:

https://github.com/Panintelligence/aws-deployment

An example of how you can connect to an external database and AWS EFS:

https://github.com/Panintelligence/aws-deployment/blob/main/nested-stacks/ec2_stack.yml

Feedback

If you have any questions or feedback, please get in touch and email support@panintelligence.com