Skip to main content

Step 4: Cache and message bus

You need

Cache​

Redis is used as cache. Setup redis with following steps.

Create folder​

Create the folder where the cache configuration will be.

mkdir cache

Redis configuration​

Copy the default.redis.conf file to ~/medialib/cache/redis.conf. Remove the default. part of the filename. Replace <password> with your own password.

Update .env file and start service​

Update the required values in the ~/medialib/.env file.

cat .env

## redis cache configuration section
## The docker tag to be used.
#REDIS_VERSION=latest
## Path to the folder on host which stores the default.redis.conf file
CONFIG_PATH=/home/mml/medialib/cache

The docker of the redis image runs for user with id 999. Update the user rights of the folder to the redis user and group 999 and start the cache service.

sudo chown -R 999:999 cache/
sudo docker compose up wekode.mml.cache -d

Message bus​

RabbitMQ is used as message bus between backend services.

Create folder​

Create the folder where the configuration will be.

mkdir mbus

Configuration​

Copy enabled_plugins to ~/medialib/mbus/enabled_plugins on the server. Copy default.rebbitmq.conf to ~/medialib/mbus/rabbitmq.conf on the server. Remove the default. part of the filename. Change the default user guest and password guest in rabbitmq.conf.

Update .env file and start service​

Update the required values in the ~/medialib/.env file.

cat .env

## mbus configuration section
## The docker tag to be used for the rabbitmq image.
# MBUS_VERSION=latest
## Path to the enabled_plugins file on host.
ENABLED_PLUGINS_FILE=/home/mml/medialib/mbus/enabled_plugins
## Path to the default.rabbitmq.conf file on host.
CONFIG_FILE=/home/mml/medialib/mbus/rabbitmq.conf

Set user rights of the folder to the docker user and start the service.

sudo chown -R 1001:1001 mbus/
sudo docker compose up wekode.mml.mbus -d

RabbitMQ stores users, permissions, queues, and messages that are not delivered yet in the named docker volume wekode.mml.mbus.data. The volume is created on the first start and kept when the container is recreated or removed with docker compose down. Only docker compose down -v deletes it.

Check​

sudo docker compose ps wekode.mml.cache wekode.mml.mbus

Both containers are running. Note the Redis password and the RabbitMQ user for step 6 and step 7.

Next: Step 5: Reverse proxy