Skip to content

Commit

Permalink
fix(nats-server): Only one processes is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
misuzu committed Jan 3, 2025
1 parent bbf8dac commit e76f6eb
Showing 1 changed file with 26 additions and 33 deletions.
59 changes: 26 additions & 33 deletions nix/services/nats-server_test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,41 +53,34 @@ in
};
};

settings.processes = {
nats-test = {
command = pkgs.writeShellApplication {
runtimeInputs = [ pkgs.natscli ];
text = ''
nats account info -s nats://localhost:4222
'';
name = "nats-test";
};
depends_on."nats".condition = "process_healthy";
};
nats-cluster-test = {
command = pkgs.writeShellApplication {
runtimeInputs = [ pkgs.natscli ];
text = ''
nats server info -s nats://admin:admin@localhost:14222
settings.processes.test = {
command = pkgs.writeShellApplication {
runtimeInputs = [ pkgs.natscli ];
text = ''
# standalone
nats account info -s nats://localhost:4222
# nats cluster with jetstream enabled
nats server info -s nats://admin:admin@localhost:14222
export NATS_URL=nats://js:js@localhost:14222
nats account info
export NATS_URL=nats://js:js@localhost:14222
nats account info
# https://docs.nats.io/nats-concepts/jetstream/js_walkthrough
nats stream add my_stream --subjects=foo --storage=memory --replicas=3 --defaults
nats stream info my_stream
nats pub foo --count=5 "publication #{{Count}} @ {{TimeStamp}}"
nats consumer add my_stream pull_consumer --pull --replicas=3 --defaults
nats consumer next my_stream pull_consumer --count 5
nats stream rm -f my_stream
'';
name = "nats-cluster-test";
};
depends_on = {
"nats-1".condition = "process_healthy";
"nats-2".condition = "process_healthy";
"nats-3".condition = "process_healthy";
};
# https://docs.nats.io/nats-concepts/jetstream/js_walkthrough
nats stream add my_stream --subjects=foo --storage=memory --replicas=3 --defaults
nats stream info my_stream
nats pub foo --count=5 "publication #{{Count}} @ {{TimeStamp}}"
nats consumer add my_stream pull_consumer --pull --replicas=3 --defaults
nats consumer next my_stream pull_consumer --count 5
nats stream rm -f my_stream
'';
name = "nats-test";
};
depends_on = {
"nats".condition = "process_healthy";
"nats-1".condition = "process_healthy";
"nats-2".condition = "process_healthy";
"nats-3".condition = "process_healthy";
};
};
}

0 comments on commit e76f6eb

Please sign in to comment.