-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple load-balancing with use libcluster (#57)
* Add simple load-balancing with use libcluster * Update mix.exs Co-authored-by: Przemysław Rożnawski <48837433+roznawsk@users.noreply.github.com> * Update test/jellyfish/cluster/load_balancing_test.exs Co-authored-by: Przemysław Rożnawski <48837433+roznawsk@users.noreply.github.com> * Update lib/jellyfish/room_service.ex Co-authored-by: Przemysław Rożnawski <48837433+roznawsk@users.noreply.github.com> * Fix typo * Fix another typo * Remove unused variable * Modify how cluster configuration is passed * Code review fixes * Fix typo * Fix one more typo * Move config jellyfish address outside if * Code review fixes * Use rpc.multicall for gather resources on other nodes * Fix multicall * Update openapi.yaml Co-authored-by: Michał Śledź <michalsledz34@gmail.com> * Update lib/jellyfish/room_service.ex Co-authored-by: Michał Śledź <michalsledz34@gmail.com> * More renaming * Change module tag in load-balancing tests * Modify docker-compose --------- Co-authored-by: Przemysław Rożnawski <48837433+roznawsk@users.noreply.github.com> Co-authored-by: Michał Śledź <michalsledz34@gmail.com>
- Loading branch information
1 parent
1302b8a
commit 1de16a8
Showing
13 changed files
with
310 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Config | ||
|
||
config :jellyfish, server_api_token: "development" | ||
|
||
# We don't run a server during test. If one is required, | ||
# you can enable the server option below. | ||
config :jellyfish, JellyfishWeb.Endpoint, | ||
http: [ip: {127, 0, 0, 1}, port: 4002], | ||
secret_key_base: "DtVd7qfpae0tk5zRgAM75hOaCc+phk38gDFVvLPyqVN/vvVg0EPmksTSm5JcyjoJ", | ||
server: false | ||
|
||
# Print only warnings and errors during test | ||
config :logger, level: :warning | ||
|
||
# Initialize plugs at runtime for faster test compilation | ||
config :phoenix, :plug_init_mode, :runtime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
version: "3" | ||
|
||
x-jellyfish-template: &jellyfish-template | ||
build: . | ||
environment: &jellyfish-environment | ||
ERLANG_COOKIE: "panuozzo-pollo-e-pancetta" | ||
SERVER_API_TOKEN: "development" | ||
SECRET_KEY_BASE: "super-secret-key" | ||
VIRTUAL_HOST: "localhost" | ||
NODES: "app@app1 app@app2" | ||
networks: | ||
- net1 | ||
restart: on-failure | ||
healthcheck: | ||
test: | ||
[ | ||
"CMD", | ||
"sh", | ||
"-c", | ||
"curl --fail -H \"authorization: Bearer $$SERVER_API_TOKEN\" http://localhost:$$PORT/room || exit 1" | ||
] | ||
interval: 3s | ||
retries: 2 | ||
timeout: 2s | ||
start_period: 15s | ||
|
||
services: | ||
test: | ||
image: membraneframeworklabs/docker_membrane | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
cd app/ | ||
mix deps.get | ||
MIX_ENV=ci mix test --only cluster | ||
volumes: | ||
- .:/app | ||
- /app/_build | ||
- /app/deps | ||
networks: | ||
- net1 | ||
depends_on: | ||
- app1 | ||
- app2 | ||
|
||
app1: | ||
<<: *jellyfish-template | ||
environment: | ||
<<: *jellyfish-environment | ||
RELEASE_NODE: app@app1 | ||
NODE_NAME: app@app1 | ||
PORT: 4001 | ||
ports: | ||
- 4001:4001 | ||
|
||
app2: | ||
<<: *jellyfish-template | ||
environment: | ||
<<: *jellyfish-environment | ||
RELEASE_NODE: app@app2 | ||
NODE_NAME: app@app2 | ||
PORT: 4002 | ||
ports: | ||
- 4002:4002 | ||
|
||
networks: | ||
net1: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.