shardmaster
shardmaster
Allows you to simply manage (semi automatic) sharding of your discord bot running in a docker swarm (across multiple hosts)
Installation
For the master, you can simply use the docker image (greenbigfrog/shardmaster
). For the peers add the following to your shard.yml
:
dependencies:
shardmaster:
github: greenbigfrog/shardmaster
branch: master
Usage
View example/README.md
for more info
Run the master in a docker container called shardmaster
and has mutual network with the peers:
docker service create --name shardmaster --network net greenbigfrog/shardmaster /shardmaster 10
Get shard:
require "shardmaster/peer"
shard = Shardmaster::Peer.get_shard
shard_id = shard[:id]
num_shards = shard[:shard_count]
Post ping every < 5 minutes to keep the shard from expiring:
require "shardmaster/peer"
Shardmaster::Peer.post_ping(shard_id)
Development
docker build -t greenbigfrog/shardmaster-example -f example/Dockerfile .
docker build -t greenbigfrog/shardmaster .
Contributing
- Fork it (https://github.com/greenbigfrog/shardmaster/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Jonathan B. - creator and maintainer
Repository
shardmaster
Owner
Statistic
- 2
- 0
- 0
- 0
- 1
- almost 6 years ago
- December 29, 2018
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 13:53:25 GMT
Languages