Skip to content

MyMiniFactory/task-actioner

Repository files navigation

Task Actioner

Build Status Docker Cloud Build Status

Task Actioner is a RabbitMQ comsumer that receives task messages and runs them as native or docker actions

Consumer role

  • Always on - never crash or restart on crash
  • Consumes rabbitMQ
  • Read the message (i.e. payload-example.json)
  • Download the required files
  • Read the type of task to call the right action if it's a docker container:
  • mount the right volumes
  • convert the params as args

Two types of actions:

  • Built in code (faster/reliable)
  • call of Docker image (GitHub actions-like)

Use Task Actioner Docker image

Pull image

docker pull myminifactory/task-actioner

Environment variable

Here are all the environment variables you need to run the container:

Variable name Description Default value
MMF_API_BASE_URL The base url of your MyMiniFactory instance null
MMF_API_SECRET_KEY Your access token to use your MyMiniFactory instance null
FILE_STORAGE_HOST The url of your storage service null
FILE_STORAGE_PORT The port of you storage service null
FILE_STORAGE_USE_SSL put it to true if you want to use SSL to communicate with your storage service null
FILE_STORAGE_ACCESS_KEY The login of your storage service null
FILE_STORAGE_SECRET_KEY The password of your storage service null
RABBITMQ_HOST The url of your RabbitMQ service null
RABBITMQ_PORT The port of your storage service null
RABBITMQ_USE_SSL set true if you want to use AMQPS to communicate with RabbitMQ AMQP otherwise
RABBITMQ_USER The login of your storage service null
RABBITMQ_PASSWORD The password of your storage service null
UID The user id of the user to manipulate your file in the container launched with docker actions 1000
GID The group id of the user to manipulate your file in the container launched with docker actions 1000
UNAME The name of the user to manipulate your file in the container launched with docker actions worker
TASK_ACTIONER_PATH The location of your task actioner application null
SIMULTANEOUS_TASKS Number of concurrent tasks 1

Run the tests suite

Start the test environment

Go into the tests directory and run docker-compose specifying the environment variable TASK_ACTIONER_PATH, RABBITMQ_PORT, FILE_STORAGE_ACCESS_KEY and FILE_STORAGE_SECRET_KEY

TASK_ACTIONER_PATH=<task_actioner_path> RABBITMQ_PORT=<rabbitmq_port> FILE_STORAGE_ACCESS_KEY=<access_key> FILE_STORAGE_SECRET_KEY=<secret_key> docker-compose up -d

Go back tot the root the repository

Install the the test actions with docker and npm:

docker build -t zip -f tests/actions/zip/Dockerfile tests/actions/zip/

npm i tests/actions/unzip

Now you can run:

npm test

TODO

  • Plug the consumer to rabbitMQ
  • Build docker image if it doesn't exist
  • Rebuild in Rust
  • Handle errors nicely and log!
  • Handle progress feedback of tasks

About

Task consumer for RabbitMQ calling a Docker container on demand

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •