Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXAMPLE] Thespian director - dockerized cluster working example #78

Open
htarnacki opened this issue May 27, 2021 · 0 comments
Open

[EXAMPLE] Thespian director - dockerized cluster working example #78

htarnacki opened this issue May 27, 2021 · 0 comments

Comments

@htarnacki
Copy link

htarnacki commented May 27, 2021

hi,
during my personal work i prepared some example project that uses Thespian and has following features:

  • cluster of 2 nodes: leader and worker
  • nodes are separated docker containers
  • actor implementation code is loaded into leader node and propagated to worker node through Thespian director
  • actors on worker node are created from actors on leader node
  • built in mechanism for an actor creation on selected worker nodes identified by their individual node id

requirements:

  • docker (to run example)
  • java with JAVA_HOME variable set (to build project. I use gradle as a build tool and it requires java to run)
  • python 3.8
  • pipenv

description of steps which happen after running an example:

  • leader node is started
  • worker node is started
  • on leader node Thespian director starts 2 actors: ConventionListener and LeaderActor. After starting it sends to them "start messages"
  • Leader actor starts "wake up" process. It will wake up every 60s to just log: "I am alive" message
  • ConventionListener actor starts listening on ActorSystemConventionUpdate events
  • When worker node starts then ActorSystemConventionUpdate event is emitted and then ConventionListener actor records node id of a started worker node and sends this information to Leader actor (in a WorkerNodeAdded message)
  • Leader actor after receiving WorkerNodeAdded message records node id of started worker node and creates specifically on this node an instance of a WorkerActor. After that it sends a message to this WorkerActor asking it to say hello
  • WorkerActor on worker node after receiving SayHello message just logs hello message

usage:

# unpack archive file
cd ./thespian/example
vim ./docker/worker-node/THESPIAN_DIRECTOR_DIR/convleader.cfg
# change string "x.x.x.x" to your real external ip adress (not local host!. Do not remove port from string!)
./gradlew install
./gradlew build
./start

# observe logs:
# ./docker/leader-node/logs/leader.log
# ./docker/worker-node/logs/worker.log

./stop

@kquick feel free to use it as an example in Thespian project if you find it usefull

thespian-example.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant