💾 Archived View for perso.pw › blog › articles › drist-parallel.gmi captured on 2023-07-22 at 16:42:59. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-05-24)

-=-=-=-=-=-=-

How to parallelize Drist

Comment on Mastodon

This article will show you how to make drist faster by using it on multiple

servers at the same time, in a correct way.

[What is drist?](https://dataswamp.org/~solene/2018-11-29-drist-intro.html)

It is easily possible to parallelize drist (this works for everything though)

using Makefile. I use this to deploy a configuration on my servers at the same

time, this is way faster.

A simple BSD Make compatible Makefile looks like this:

SERVERS=tor-relay.local srvmail.tld srvmail2.tld

${SERVERS}:

drist $*

install: ${SERVERS}

.PHONY: all install ${SERVERS}

This create a target for each server in my list which will call drist. Typing

`make install` will iterate over `$SERVERS` list but it is so possible to use

`make -j 3` to tell make to use 3 threads. The output may be mixed though.

You can also use `make tor-relay.local` if you don't want make to iterate over

all servers. This doesn't do more than typing `drist tor-relay.local` in the

example, but your Makefile may do other logic before/after.

If you want to type `make` to deploy everything instead of `make install` you

can add the line `all: install` in the Makefile.

If you use GNU Make (gmake), the file requires a small change:

The part `${SERVERS}:` must be changed to `${SERVERS}: %:`, I think that gmake

will print a warning but I did not succeed with better result. If you have the

solution to remove the warning, please tell me.

If you are not comfortable with Makefiles, the .PHONY line tells *make* that

the targets are not valid files.

Make is awesome!