fix readme docker compose commands

This commit is contained in:
Nicola Zambello 2025-08-04 10:21:01 +02:00
parent d91eb82a4a
commit e5553e56fb
Signed by: nzambello
GPG key ID: 0A7E9D12831FAAF9

View file

@ -18,7 +18,7 @@ A simple NATS client/server setup for testing message publishing and subscribing
### 1. Start the NATS server and message subscriber
```bash
docker-compose up nats server -d
docker compose up nats server
```
This starts:
@ -29,7 +29,7 @@ This starts:
### 2. Run the interactive client
```bash
docker-compose run --rm client
docker compose run --rm client
```
This opens an interactive prompt where you can:
@ -43,13 +43,13 @@ This opens an interactive prompt where you can:
To see incoming messages in real-time:
```bash
docker-compose logs -f server
docker compose logs -f server
```
### 4. Stop everything
```bash
docker-compose down
docker compose down
```
## Example Usage
@ -57,13 +57,13 @@ docker-compose down
1. **Terminal 1**: Start the infrastructure
```bash
docker-compose up nats server -d
docker compose up nats server -d
```
2. **Terminal 2**: Run the client
```bash
docker-compose run --rm client
docker compose run --rm client
```
You'll see:
@ -78,7 +78,7 @@ docker-compose down
3. **Terminal 1**: Check server logs to see received messages
```bash
docker-compose logs server
docker compose logs server
```
## Local Development (without Docker)
@ -115,8 +115,8 @@ bun run client.ts
## Troubleshooting
- **Client not accepting input**: Make sure you're using `docker-compose run --rm client` instead of `docker-compose up client`
- **Client not accepting input**: Make sure you're using `docker compose run --rm client` instead of `docker compose up client`
- **Connection refused**: Ensure NATS server is running first
- **Messages not appearing**: Check that the server container is running with `docker-compose ps`
- **Messages not appearing**: Check that the server container is running with `docker compose ps`
This project was created using `bun init` in bun v1.2.18. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.