[bitnami/matomo] Adding the Matomo Helm Chart (#10652)

* Adding Matomo Chart v0.1.0

Signed-off-by: Jeremy Boyle <jeremy.t.boyle2.mil@swf.army.mil>

* Updating values.yaml, with missing @param values, regenerated README.md

Signed-off-by: Jeremy Boyle <jeremy.t.boyle2.mil@swf.army.mil>

* Updating values.yaml, changed DEBUG = FALSE, regenerated README.md

Signed-off-by: Jeremy Boyle <jeremy.t.boyle2.mil@swf.army.mil>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <containers@bitnami.com>

* test:  Add VIB testing

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* fix matomo

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* test:  Update incorrect url

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* chore: ⬆️ Update image

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* chore: 🔥 Remove unused variable ingress.hosts and service.httpsport

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* fix: 🐛 Add reference to missing certificate values

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* docs: 📝 Fix incorrect placeholder in values documentation

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* feat:  Adapt ingress to standard and add missing values

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* ci: 👷 Add chart to cd-pipeline

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* chore: ⬆️ Bump subcharts

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* test:  Add two extra GOSS tests

Check that the httpd process exists and check the Matomo config contents

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* test:  Improve cypress tests

- Add documentation on the API
- Check that the user has been created

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* chore: ⬆️ Bump image tag

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* chore: 🔥 Remove references to service.port

This is a deprecated parameter not used anymore

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* feat:  Use common.secrets.password.manage for password management

This avoids issues during upgrades

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* fix: 🐛 Remove erroneous call to coalesce

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* chore: 🔥 Remove component label

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* feat:  Add smtpExistingSecret value

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* fix: 🐛 Use correct PVC values

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* chore: 🔥 Remove unused reference to sessionAffinity and service.port

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

Co-authored-by: Bitnami Containers <containers@bitnami.com>
Co-authored-by: Javier Salmeron Garcia <jsalmeron@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Jeremy
2022-07-07 10:12:39 -05:00
committed by GitHub
parent 982dd0f603
commit 4084152a96
31 changed files with 2676 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
"env": {
"username": "user",
"password": "ComplicatedPassword123!4",
"email": "user@example.com"
},
"hosts": {
"bitnami-matomo.my": "{{ TARGET_IP }}"
},
"defaultCommandTimeout": 30000
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1,7 @@
{
"newUser": {
"username": "NonTrivialUser",
"password": "N0ntR1Vi@lPaS$wOrD",
"email": "test@email.com"
}
}

View File

@@ -0,0 +1,6 @@
{
"newSite": {
"name": "Bitnami site",
"url": "https://bitnami.com"
}
}

View File

@@ -0,0 +1,71 @@
/// <reference types="cypress" />
import { random } from './utils';
it('allows to log in and out', () => {
cy.login();
cy.get('a[href*="logout"]').first().click();
cy.contains('Sign in');
});
it('allows to create user', () => {
cy.login();
cy.visit('/?module=UsersManager&showadduser=1');
cy.fixture('users').then((user) => {
cy.get('#user_login').type(`${user.newUser.username}-${random}`);
cy.get('#user_password').type(
`${user.newUser.password}-${random}`
);
cy.get('#user_password').type(
`${user.newUser.password}-${random}`
);
cy.get('#user_email').type(`${random}_${user.newUser.email}`);
cy.get('input[value*="Create user"]').click();
cy.contains('changes have been saved');
cy.visit('/index.php?module=UsersManager');
cy.contains('#userLogin', `${user.newUser.username}-${random}`);
});
});
it('allows to create a new website', () => {
cy.login();
cy.visit('/index.php?module=SitesManager&showaddsite=1');
// We need to use the title attribute because with the inner HTML we cannot differentiate
// between "website" and "intranet website"
cy.get('button[title*="A website"]').click();
cy.fixture('websites').then((site) => {
// The name input has no attribute "name" or "id"
cy.get('input[placeholder="Name"]').type(`${site.newSite.name} ${random}`, { force: true });
cy.get('textarea[name="urls"]').type(`${site.newSite.url}`, { force: true });
});
cy.get('input[type="submit"]').click();
cy.contains('Website created');
});
// The Matomo API allows checking the site analytics and tracking metrics
// Source: https://matomo.org/guide/apis/analytics-api/
it('allows to use the API', () => {
cy.login();
cy.visit('/index.php?module=UsersManager&action=addNewToken');
cy.get('#login_form_password').type(Cypress.env('password'));
cy.get('input[type="submit"]').click();
cy.get('#description').type(random);
cy.get('input[type="submit"]').click();
cy.contains('Token successfully generated');
cy.get('code').invoke('text').then((apiToken) => {
cy.request(
'/index.php?module=API&method=API.getMatomoVersion'
+ `&format=JSON&token_auth=${apiToken}`).then((response) => {
const bodyString = JSON.stringify(response.body);
expect(response.status).to.eq(200);
expect(bodyString).to.contain('"value":');
});
});
});
it('allows to change users settings', () => {
cy.login();
cy.visit('/index.php?module=UsersManager&action=userSettings');
cy.contains('Last 7 days').click();
cy.get('input[value*="Save"]').first().click();
cy.contains('Settings updated');
});

View File

@@ -0,0 +1,3 @@
/// <reference types="cypress" />
export let random = (Math.random() + 1).toString(36).substring(7);

View File

@@ -0,0 +1,29 @@
const COMMAND_DELAY = 500;
const BASE_URL = 'http://bitnami-matomo.my';
for (const command of ['click']) {
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
const origVal = originalFn(...args);
return new Promise((resolve) => {
setTimeout(() => {
resolve(origVal);
}, COMMAND_DELAY);
});
});
}
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
return originalFn(`${BASE_URL}${url}`, options);
});
Cypress.Commands.add(
'login',
(username = Cypress.env('username'), password = Cypress.env('password')) => {
cy.clearCookies();
cy.visit('/');
cy.get('#login_form_login').type(username);
cy.get('#login_form_password').type(password);
cy.contains('input', 'Sign in').click();
}
);

View File

@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')

View File

@@ -0,0 +1,36 @@
file:
/opt/bitnami/matomo/js:
filetype: symlink
linked-to: /bitnami/matomo/js
exists: true
/opt/bitnami/matomo/plugins:
filetype: symlink
linked-to: /bitnami/matomo/plugins
exists: true
/bitnami/matomo/config/config.ini.php:
mode: "0644"
filetype: file
exists: true
contains:
- {{ printf "/dbname.*%s/" .Env.MATOMO_DATABASE_NAME }}
- {{ printf "/username.*%s/" .Env.MATOMO_DATABASE_USER }}
- {{ printf "/host.*%s/" .Env.MATOMO_DATABASE_HOST }}
# Checks the user running the container is non-root
command:
user-id-test:
exec: if [ "$(id -u)" -eq 0 ]; then exit 1; fi
exit-status: 0
stdout: []
stderr: []
which-php:
exec: which php
exit-status: 0
stdout:
- "/opt/bitnami/php/bin/php"
stderr: []
ps-aux-apache:
exec: ps aux
exit-status: 0
stdout:
- "/opt/bitnami/apache/bin/httpd"
stderr: []

View File

@@ -0,0 +1,93 @@
{
"phases": {
"package": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/matomo"
}
},
"actions": [
{
"action_id": "helm-package"
},
{
"action_id": "helm-lint"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/matomo"
},
"runtime_parameters": "bWF0b21vVXNlcm5hbWU6IHVzZXIKbWF0b21vUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNAptYXRvbW9FbWFpbDogdXNlckBleGFtcGxlLmNvbQptYXRvbW9XZWJzaXRlSG9zdDogaHR0cHM6Ly9iaXRuYW1pLW1hdG9tby5teQpzZXJ2aWNlOgogIHR5cGU6IExvYWRCYWxhbmNlcgogIHBvcnRzOgogICAgaHR0cDogODAK",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
}
}
},
"actions": [
{
"action_id": "trivy",
"params": {
"threshold": "CRITICAL",
"vuln_type": [
"OS"
]
}
},
{
"action_id": "health-check",
"params": {
"endpoint": "lb-matomo-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib/matomo/goss"
},
"remote": {
"workload": "deploy-matomo"
}
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/matomo/cypress"
},
"endpoint": "lb-matomo-http",
"app_protocol": "HTTP",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
}
}
}
]
},
"publish": {
"actions": [
{
"action_id": "helm-publish",
"params": {
"repository": {
"kind": "S3",
"url": "{VIB_ENV_S3_URL}",
"username": "{VIB_ENV_S3_USERNAME}",
"password": "{VIB_ENV_S3_PASSWORD}"
}
}
}
]
}
}
}

View File

@@ -0,0 +1,78 @@
{
"phases": {
"package": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/matomo"
}
},
"actions": [
{
"action_id": "helm-package"
},
{
"action_id": "helm-lint"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/matomo"
},
"runtime_parameters": "bWF0b21vVXNlcm5hbWU6IHVzZXIKbWF0b21vUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNAptYXRvbW9FbWFpbDogdXNlckBleGFtcGxlLmNvbQptYXRvbW9XZWJzaXRlSG9zdDogaHR0cHM6Ly9iaXRuYW1pLW1hdG9tby5teQpzZXJ2aWNlOgogIHR5cGU6IExvYWRCYWxhbmNlcgogIHBvcnRzOgogICAgaHR0cDogODAK",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
}
}
},
"actions": [
{
"action_id": "trivy",
"params": {
"threshold": "CRITICAL",
"vuln_type": [
"OS"
]
}
},
{
"action_id": "health-check",
"params": {
"endpoint": "lb-matomo-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib/matomo/goss"
},
"remote": {
"workload": "deploy-matomo"
}
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/matomo/cypress"
},
"endpoint": "lb-matomo-http",
"app_protocol": "HTTP",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
}
}
}
]
}
}
}