Taskforce connector

Taskforce connector

The taskforce connector is a small command line tool that is used for connecting securely a redis instance to taskforce.sh. The connector opens a websocket connection (TLS encrypted) on some instance close to your redis connection, can be inside a secured VPC without any public access, as long as the instance running itself has access to the internet.

The connector is particularly useful if you want to connect redis instances running on your localhost.

Testing the connector

You can easily test the connector locally before using it in a more sophisticated production environment. You will need a running local redis instance for the following instructions to work.

Start by installing the connector globally:

$ yarn global add taskforce-connector

In order to use the connector you will need an API token, you can find the one belonging to your account in the Account view in taskforce.sh:

Using this token you can now call the connector to establish the connection to taskforce.sh:

$ taskforce -n "My Redis" -t 40bf2f58-b684-484b-9379-581f710e9877

The connection will appear automatically in the left sidebar, and you will have access to all the queues in that redis instance:

The connector has several other settings, for instance you can specify connection details for your redis instance:

$ taskforce -n "My Redis" -h redis.host -p 6379 -passwd xxxx

you need to have enough connections quota in taskforce.sh for the connector to work.

Using a docker container

We also provide a minimal docker container that can be conveniently deployed in your infrastructure. All required settings are exposed as environment variables, see this docker-compose.yaml file as an example on how to run the connector and a redis instance connected to it:

version: "3.7"
services:
  redis:
    image: "redis:alpine"
    ports:
      - 7000:6379

  taskforce-connector:
    build: https://github.com/taskforcesh/taskforce-connector.git#master
    environment:
      TASKFORCE_CONNECTION: "local taskforce provisioner"
      TASKFORCE_TEAM: "Taskforce"
      TASKFORCE_TOKEN: ${TASKFORCE_TOKEN}
      REDIS_HOST: redis

Teams

The taskforce connector also allows you to specify a team, as in the yaml above or using the command line. For the following to work you need to create a Team in taskforce.sh first.

$ taskforce --team "my awesome team" -n "My Redis" -t 2cfe6a1b-5f0e-466f-99ad-12f51bea79a7 

You can find the lates up-to-date instructions on how to use the connector here: https://github.com/taskforcesh/taskforce-connector

You can find the lates up-to-date instructions on how to use the connector here: https://github.com/taskforcesh/taskforce-connector

Queues Discovery

By default, the connector will issue a scan to find the queues that are present in the given Redis instance. This scan filters the keys by key type (only string keys are considered), and that match a given pattern (prefix:queue-name:id). This method is automatic and works most of the time, completely transparent to the user. Depending on the Redis instance, or if the amount of keys in the instance is very large, the time to do the queue discovery can be too long. There is a maximum timeout of 40 seconds, after that, the connector will not continue trying to find more queues in the instance.

Specifying queue names manually

It is possible to manually specify the queues that we want to give access to Taskforce.sh. This is useful in order to avoid a possible slow queue discovery, or to protect queues that should not be accessible by all the members of a given team. Notice that you could have different connectors for the same Redis instance for different teams.

You can specify the queues either in the command line or in a separate text file. In the command line separate every queue name with commas (do not add any spaces between queue names):

$ taskforce -t 2cfe6a1b-5f0e-466f-99ad-12f51bea79a7 --queues monitoring,payments

If your queues are not using the standard queue prefix "bull", you can specify a different prefix as well:

$ taskforce -t 2cfe6a1b-5f0e-466f-99ad-12f51bea79a7 --queues foobar:monitoring,payments

If your queue names include non-ASCII characters or spaces you can wrap the list in quotes:

$ taskforce -t 2cfe6a1b-5f0e-466f-99ad-12f51bea79a7 --queues "my queue"

If you prefer to specify the queue names in a separate file you can just add the queue names separated by newlines:

// my-queues.txt
foobar:monitoring
payments
etc

And specifying the filename with --queuesFile :

$ taskforce -t 2cfe6a1b-5f0e-466f-99ad-12f51bea79a7 --queuesFile my-queues.txt

Last updated