Simple http service for setting up mutex service. For example set mutex for parallel GitOps repository commits.
To start mutex server you need to install Node.js and simply run node server.js
. You can customize mutex lifetime using TTL
and server port using PORT
environment variable. You can also use docker image for running mutex server.
docker pull themisir/mutexserver
docker run -p 5000:80 themisir/mutexserver
URI | Description |
---|---|
POST http://localhost:5000/<key> |
Waits for key unlock then locks the mutex. |
DELETE http://localhost:5000/<key> |
Unlocks mutex. |
Using curl commands you can easily lock/unlock mutexes.
# Will lock the mutex, if mutex is already locked the command will wait until mutex becomes unlocked
curl -XPOST http://localhost:5000/key
# Unlocks mutex
curl -XDELETE http://localhost:5000/key
You can use GitHub actions jobs to queue parallel jobs.
- name: Create mutex
uses: themisir/mutexserver@v1
with:
server: http://example.com
key: my-mutex-key