Skip to content
Snippets Groups Projects
Hueser, Christian's avatar
Hueser, Christian authored
Fix variable type because invite_only is bool and not string

See merge request !59
49fc33c0
History

Mattermost Plugin for the Helmholtz Cloud Agent

This is the documentation of the Mattermost Plugin for the Helmholtz Cloud Agent (HCA).

Possible Configuration Variables for HCA

Variable Default Description
HCA_USERNAME "hca" The username to authenticate to RabbitMQ. Will be assigned for each plugin.
HCA_PASSWORD "supersecret" The password to authenticate to RabbitMQ. Will be assigned for each plugin.
HCA_SERVICE_ID "d4c32c0e-6375-4f31-9360-5d5d62172703" The ID in Cloud Portal for this service. It is used to match messages to the right plugin.
HCA_RABBITMQ_USE_SSL False Use SSL to connect to RabbitMQ.
HCA_RABBITMQ_CA_FILE "/etc/ssl/certs/ca-certificates.crt" Location of the CA bundle to use to verify the server certificate.
HCA_RABBITMQ_HOSTNAME "hifis-rabbitmq.desy.de" The hostname of the RabbitMQ server.
HCA_RABBITMQ_PORT 5672 The port of the RabbitMQ server.
HCA_RABBITMQ_VIRTUAL_HOST "test-provider" The RabbitMQ virtual host. Each provider will get its own.
HCA_RABBITMQ_RETRY_DELAY 20 Time to wait to retry connection attempt to RabbitMQ in case of failure.
HCA_RABBITMQ_CONNECTION_ATTEMPTS 3 Number of connections attempts to RabbitMQ
HCA_RABBITMQ_HEARTBEAT 0 Enable RabbitMQ heartbeat mechanism. https://pika.readthedocs.io/en/stable/modules/parameters.html?highlight=heartbeat#pika.connection.ConnectionParameters.heartbeat
HCA_LOG_LEVEL "INFO" The output log level.

Prerequisites

Docker and Docker Compose plugin are installed.

Running the Plugin

Place a .env file into folder src/mattermost with the following content:

MM_TOKEN = "<Mattermost Token>"
GL_TOKEN = "<GitLab Token>"
MM_DOMAIN = "<Matttermost domain>"
GL_URL = "<GitLab URL>"
MM_BOT_USERNAME = "<Username of the Mattermost Bot>"

Build the container for the Mattermost plugin:

docker build -t hca_mattermost_plugin .

Place a .env file into root folder of the project with the following content:

HCA_USERNAME = "<HCA username>"
HCA_PASSWORD = "<HCA password>"
HCA_SERVICE_ID = "<HCA service id>"
HCA_RABBITMQ_HOSTNAME = "<RabbitMQ hostname>"
HCA_RABBITMQ_USE_SSL = "true"
HCA_RABBITMQ_PORT = "5671"
HCA_RABBITMQ_VIRTUAL_HOST = "<RabbitMQ virtual host>"
HCA_RABBITMQ_HEARTBEAT = "1"

Set the following mtu configuration in file /etc/docker/daemon.json if a different mtu is needed by taking the needed configurations file daemon.json of this project:

{
  "mtu": 1500,
  "default-network-opts": {
    "bridge": {
      "com.docker.network.bridge.mtu": "1500"
    }
  }
}

Then you need to restart the Docker service:

sudo systemctl restart docker.service

You might also want to adapt the mtu in file docker-compose.yml:

[...]

networks:
  default:
    driver: bridge
    driver_opts:
      com.docker.network.driver.mtu: 1500

Run the application by spinning up the container:

docker compose up -d

Development Setup

For development, you can build your image with tag hca_mattermost_plugin:latest using a separate Dockerfile from the root folder of the project that can be found in folder dev/ and spin up the application container alongside a RabbitMQ container using the docker-compose.yml that can also be found in folder dev/. Please make sure that the .env file of the Python application reside in the correct location providing the secrets for the application. The .env file in the root folder of the project is not important for the development environment, since all development variables are given in the respective docker-compose.yml file.

Using RabbitMQ Service

The RabbitMQ service can be found at URL http://localhost:15672.

The development credentials for the login are:

  • Username: hca
  • Password: XyolFOjpnapsUW

Open to_hca queue and publish the following message:

  1. Headers:
    • service_id = d4c32c0e-6375-4f31-9360-5d5d62172703
  2. Properties:
    • type = ResourceAllocateV1
  3. Payload with respective uuid of the requesting user:
{
    "target_entity": {
        "group_urn_target": null,
        "user_id_target": "<uuid>"
    },
    "type": "MmTeamResourceSpecV1",
    "specification": {
        "team_name": "My Awesome Team 1",
        "team_slug": "my-awesome-team-1",
        "invite_only": true
    }
}

Author

HIFIS Software Services

License

MIT