Matomo

In this example, we'll deploy Matomo with its MariaDB database.

1. Create shared variables

Go to "Environment variables" menu and create 4 variables.

  • MYSQL_PASSWORD (don't forget to check the "hide value" box)
  • MYSQL_USER
  • MYSQL_DATABASE
  • MYSQL_ROOT_PASSWORD (don't forget to check the "hide value" box)

2. Create Matomo + MariaDB

services:
  - id: db
    name: db
    dockerConfiguration:
      image: mariadb
      imageVersion: "10.11"
      command: --max-allowed-packet=64MB
    countMin: 1
    countMax: 1
    ports:
      - listeningPort: 3306
        healthCheckEnabled: false
    environmentVariables:
      - key: MARIADB_AUTO_UPGRADE
        value: "1"
      - key: MARIADB_DISABLE_UPGRADE_BACKUP
        value: "1"
    sharedEnvironmentVariables:
      - MYSQL_USER
      - MYSQL_DATABASE
      - MYSQL_PASSWORD
      - MYSQL_ROOT_PASSWORD
    volumes:
      - name: db
        path: /var/lib/mysql
    capacityCpuMhz: 500
    capacityMemoryMB: 500
  - id: matomo
    name: matomo
    dockerConfiguration:
      image: matomo
      imageVersion: latest
    countMin: 1
    countMax: 1
    ports:
      - listeningPort: 80
        healthCheckType: HTTP
        healthCheckPath: /
        healthCheckMethod: GET
        loadBalancerRules:
          - publicPort: 443
        healthCheckEnabled: true
        healthCheckTimeoutSeconds: 30
        healthCheckIntervalSeconds: 60
    links:
      - toServiceId: db
        toServicePort: 3306
        localExposedPort: 3306
        variableHost: DB_HOST
        variablePort: DB_PORT
        variableAddress: DB_ADDR
    sharedEnvironmentVariables:
      - MYSQL_USER
      - MYSQL_DATABASE
      - MYSQL_PASSWORD
    environmentVariables:
      - key: MATOMO_DATABASE_HOST
        value: "%DB_HOST%"
      - key: MATOMO_DATABASE_DBNAME
        value: "%MYSQL_DATABASE%"
      - key: MATOMO_DATABASE_USERNAME
        value: "%MYSQL_USER%"
      - key: MATOMO_DATABASE_PASSWORD
        value: "%MYSQL_PASSWORD%"
    capacityCpuMhz: 500
    capacityMemoryMB: 500