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.

  • MATOMO_MYSQL_PASSWORD (don't forget to check the "hide value" box)
  • MATOMO_MYSQL_USER
  • MATOMO_MYSQL_DATABASE
  • MATOMO_MYSQL_ROOT_PASSWORD (don't forget to check the "hide value" box)

2. Create Matomo + MariaDB

Go to "Services" menu and click on Import service:

Classic environment
services:
  - id: matomodb
    name: matomo-db
    dockerConfiguration:
      image: mariadb
      imageVersion: "10.11"
      args:
        - "--max-allowed-packet=128MB"
    countMin: 1
    countMax: 1
    ports:
      - listeningPort: 3306
    environmentVariables:
      - key: MARIADB_AUTO_UPGRADE
        value: "1"
      - key: MARIADB_DISABLE_UPGRADE_BACKUP
        value: "1"
      - key: MARIADB_ROOT_PASSWORD
        value: "%MATOMO_MYSQL_ROOT_PASSWORD%"
      - key: MARIADB_USER
        value: "%MATOMO_MYSQL_USER%"
      - key: MARIADB_PASSWORD
        value: "%MATOMO_MYSQL_PASSWORD%"
      - key: MARIADB_DATABASE
        value: "%MATOMO_MYSQL_DATABASE%"
    sharedEnvironmentVariables:
      - MATOMO_MYSQL_USER
      - MATOMO_MYSQL_DATABASE
      - MATOMO_MYSQL_PASSWORD
      - MATOMO_MYSQL_ROOT_PASSWORD
    volumes:
      - name: matomodb
        path: /var/lib/mysql
    cpuLimit: 512 # MHz
    memoryLimitMiB: 500
  - id: matomo
    name: matomo
    dockerConfiguration:
      image: matomo
      imageVersion: latest
    countMin: 1
    countMax: 1
    ports:
      - listeningPort: 80
        loadBalancerRules:
          - publicPort: 443
        healthCheck:
          healthCheckType: HTTP
          healthCheckPath: /
          healthCheckMethod: GET
          healthCheckEnabled: true
          healthCheckTimeoutSeconds: 30
          healthCheckIntervalSeconds: 60
    links:
      - toServiceId: matomodb
        toServicePort: 3306
        localExposedPort: 3306
        variableHost: DB_HOST
        variablePort: DB_PORT
        variableAddress: DB_ADDR
    sharedEnvironmentVariables:
      - MATOMO_MYSQL_USER
      - MATOMO_MYSQL_DATABASE
      - MATOMO_MYSQL_PASSWORD
    environmentVariables:
      - key: MATOMO_DATABASE_HOST
        value: "%DB_HOST%"
      - key: MATOMO_DATABASE_DBNAME
        value: "%MATOMO_MYSQL_DATABASE%"
      - key: MATOMO_DATABASE_USERNAME
        value: "%MATOMO_MYSQL_USER%"
      - key: MATOMO_DATABASE_PASSWORD
        value: "%MATOMO_MYSQL_PASSWORD%"
    cpuLimit: 512 # MHz
    memoryLimitMiB: 500
Kubernetes environment
services:
  - id: matomodb
    name: matomo-db
    dockerConfiguration:
      image: mariadb
      imageVersion: "10.11"
      command: 
        - docker-entrypoint.sh
      args:
        - "--max-allowed-packet=128MB"
    countMin: 1
    countMax: 1
    ports:
      - listeningPort: 3306
    environmentVariables:
      - key: MARIADB_AUTO_UPGRADE
        value: "1"
      - key: MARIADB_DISABLE_UPGRADE_BACKUP
        value: "1"
      - key: MARIADB_ROOT_PASSWORD
        value: "%MATOMO_MYSQL_ROOT_PASSWORD%"
      - key: MARIADB_USER
        value: "%MATOMO_MYSQL_USER%"
      - key: MARIADB_PASSWORD
        value: "%MATOMO_MYSQL_PASSWORD%"
      - key: MARIADB_DATABASE
        value: "%MATOMO_MYSQL_DATABASE%"
    sharedEnvironmentVariables:
      - MATOMO_MYSQL_USER
      - MATOMO_MYSQL_DATABASE
      - MATOMO_MYSQL_PASSWORD
      - MATOMO_MYSQL_ROOT_PASSWORD
    volumes:
      - name: matomodb
        path: /var/lib/mysql
    cpuLimit: 1000 # = 1 CPU
    memoryLimitMiB: 500
  - id: matomo
    name: matomo
    dockerConfiguration:
      image: matomo
      imageVersion: latest
    countMin: 1
    countMax: 1
    ports:
      - listeningPort: 80
        loadBalancerRules:
          - publicPort: 443
    healthCheck:
      enabled: true
      path: "/"
      port: 80
    links:
      - toServiceId: matomodb
        toServicePort: 3306
        localExposedPort: 3306
        variableHost: DB_HOST
        variablePort: DB_PORT
        variableAddress: DB_ADDR
    sharedEnvironmentVariables:
      - MATOMO_MYSQL_USER
      - MATOMO_MYSQL_DATABASE
      - MATOMO_MYSQL_PASSWORD
    environmentVariables:
      - key: MATOMO_DATABASE_HOST
        value: "%DB_HOST%"
      - key: MATOMO_DATABASE_DBNAME
        value: "%MATOMO_MYSQL_DATABASE%"
      - key: MATOMO_DATABASE_USERNAME
        value: "%MATOMO_MYSQL_USER%"
      - key: MATOMO_DATABASE_PASSWORD
        value: "%MATOMO_MYSQL_PASSWORD%"
    cpuLimit: 1000 # = 1 CPU
    memoryLimitMiB: 500