Integrate SRM into an Existing Docker Compose Stack

In this post, we’ll guide you through the process of adding Smart Report Maker (SRM) to an existing Docker Compose stack.

Prerequisites

Before we begin, let’s assume:

  • You have downloaded the docker_installation_package from our download area. It contains:
    • docker_install.sh: A shell script for Linux installations.
    • docker_install.ps1: A PowerShell script for Windows installations.
    • Includes directory: Contains essential files for the installation process.
    • docker-compose.yml: Configuration file to define the services.
    • .docker-env: Environment file that stores sensitive information like passwords and ports.
File structure within the docker_installation_package
  • You are familiar with Docker and Docker Compose.
  • Docker and Docker Compose are installed on your machine.
  • You already have an existing Docker Compose stack, and you want to add SRM to it.

Step-by-Step Process

1. SRM and MySQL Database Setup

SRM requires a MySQL database for user management, roles, and processes. You can:

  • Create a new MySQL database (requires pulling a MySQL image).
  • Use an existing MySQL database already defined in your Docker stack.

2. Pulling the SRM Image

  1. Navigate to the Installation Package Directory:
    Open a terminal and navigate to the folder containing the installation package.
cd /path_to_docker_installation_package/docker_installation_package

2. Grant Execute Permission to the Script (Linux):

sudo chmod +x docker_install.sh

3. Verify Permissions:

ls -ahl

4. Run the Installation Script:

./docker_install.sh

3. Installation Script Tasks

  • Check Docker Installation:
    The script will verify that Docker and Docker Compose are installed. If everything is in order, you’ll see:
    “Docker and Docker Compose are successfully installed and up to date.”
  • Login Token Prompt:
    Enter the login token from the download area. The token is valid for 12 hours. If expired, log in again to obtain a new one.
  • Pulling the SRM Image:
    The script pulls the SRM image from a remote Docker registry.
  • Select the Installation Option:
    Choose option 3 to add SRM to an existing Docker Compose stack.
    Once the SRM image is pulled, you’ll see:
    “SRM image has been successfully pulled to your server.

4. Database Configuration

Option 1: Create a New MySQL Database

If you choose to create a new database, pull the MySQL image with:

docker pull mysql:latest

Option 2: Use an Existing MySQL Database

If you already have a MySQL service in your docker compose stack, and you plan to use it for SRM.

5. Merging Environment Files

  • If Your Existing Stack Doesn’t Have a .docker-env File:
    Copy the .docker-env file from the docker_installation_package to the same directory as your docker-compose.yml file.
  • If You Already Have a .docker-env File:
    Merge the relevant content based on your database choice:
    • New MySQL Database: Copy all contents from the downloaded .docker-env and change the MYSQL_PASSWORD and MYSQL_ROOT_PASSWORD to secure values.
    • Existing MySQL Database: Copy only the IMAGE_TAG and SRM_PORT variables to your .docker-env file.

6. Customizing docker-compose.yml

  1. Update the Network:
    Replace all occurrences of srm_network in the downloaded docker-compose.yml with the network name used in your stack.
  2. Configure Volumes:
    • Use srm_volume_config and srm_volume_reports for the SRM container.
    • Add srm_volume_db only if you’re creating a new MySQL database.
    • Copy the relevant volumes to your docker-compose.yml file.
  3. Add Services:
    • Option 1: Copy the srm service alone.
    • Option 2: Copy both the srm and db services if you’re creating a new MySQL database.

7. Validate the docker-compose.yml File

After editing the docker-compose.yml, validate it with:

docker-compose config

If the configuration is valid, it will display the merged configuration. If there are errors, they will be listed.

8. Start the Docker Compose Stack

When the configuration is ready, start the stack with:

docker-compose up -d

To verify the running containers:

docker ps

9. Launch the Web Installation Wizard

Open your browser and access the SRM web installation wizard at:

10. Follow the Installation Wizard

For detailed instructions on completing the wizard, visit this link

Conclusion

Adding Smart Report Maker to an existing Docker Compose stack is a straightforward process if you follow the steps outlined in this guide. From pulling the SRM image and configuring the environment files to updating the docker-compose.yml file, each step ensures a seamless integration. Whether you’re using a new or existing MySQL database, proper setup and validation are essential to avoid conflicts.

Once the installation is complete, the web installation wizard will guide you through the final configurations to get the system up and running. With SRM successfully integrated, you can now leverage its powerful reporting and dashboard capabilities within your Docker environment.