A ready-to-use development container for working with NATS messaging and JetStream.
This project is designed to run in a VS Code Dev Container:
-
Install Prerequisites:
- VS Code
- Docker Desktop
- VS Code "Dev Containers" extension
-
Open the Container:
- Clone this repository
- Open the folder in VS Code
- When prompted, click "Reopen in Container"
- Or use Command Palette (F1) → "Dev Containers: Reopen in Container"
The container will automatically set up your complete development environment with Go, Node.js, Git, and all necessary tools.
Important: You need credentials to connect to the Synadia Cloud.
- Get your credentials file from Synadia Cloud or your NATS administrator
- Place the
.creds
file in theCredentials/
folder:Credentials/NGS-Default-CLI.creds
- The credentials file should look something like:
-----BEGIN NATS USER JWT----- eyJ0eXAiOiJKV1QiLCJhbGc... -----END NATS USER JWT----- ************************* IMPORTANT ************************* NKEY Seed printed below can be used to sign and prove identity. NKEYs are sensitive and should be treated as secrets. -----BEGIN USER NKEY SEED----- SUABC123... -----END USER NKEY SEED-----
⚠️ Security Note: TheCredentials/
folder is gitignored. Never commit credentials to version control.
Set up a NATS context for easy connection management:
task nats-context
Or manually:
nats context add \
"NGS-Default-CLI" \
--server "tls://connect.ngs.global" \
--creds ./Credentials/NGS-Default-CLI.creds \
--select
This command:
- Creates a context named "NGS-Default-CLI"
- Configures it to use Synadia Cloud global server
- Points to your credentials file
- Selects it as the current context
You can verify the context was created:
nats context ls
Once your credentials and context are configured, start the temperature data publisher:
task publisher
Or run directly:
cd Publisher
go run main.go
connector-intro-series/
├── Credentials/ # Place your .creds file here (gitignored)
│ └── NGS-Default-CLI.creds
├── Publisher/ # Sample data publisher
│ └── main.go
├── Taskfile.yaml # Task automation
└── .devcontainer/ # Dev container configuration
The dev container comes pre-configured with:
- Go - For NATS client development
- Git & GitHub CLI - Version control
- Task Runner - Build automation
- NATS Ports - 4222 (client), 8222 (monitoring)
Command | Description |
---|---|
task deps |
Install Go dependencies |
task nats-context |
Set up NATS context for Synadia Cloud |
task publisher |
Run the sample publisher |
If you see Credentials file not found
, ensure:
- Your
.creds
file is in theCredentials/
folder - The file is named exactly
NGS-Default-CLI.creds
- The file has proper permissions
If connection fails:
- Check your credentials are valid and not expired
- Ensure you have internet connectivity