From 276239b8a9bd59a687a5b6d31a496390a0601c51 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Thu, 21 May 2020 14:21:38 -0700 Subject: [PATCH 1/2] Create ngs-docker-python.md --- nats-server/nats_docker/ngs-docker-python.md | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 nats-server/nats_docker/ngs-docker-python.md diff --git a/nats-server/nats_docker/ngs-docker-python.md b/nats-server/nats_docker/ngs-docker-python.md new file mode 100644 index 0000000..3735b30 --- /dev/null +++ b/nats-server/nats_docker/ngs-docker-python.md @@ -0,0 +1,39 @@ +# Getting started with Python and NGS running in Docker + +Start a lightweight Docker container + +``` +docker run --entrypoint /bin/bash -it python:3.8-slim-buster +``` + +Or can also mount local creds via a volume: + +``` +docker run --entrypoint /bin/bash -v $HOME/.nkeys/creds/synadia/NGS/:/creds -it python:3.8-slim-buster +``` + +Install nats.py and deps to install nkeys. + +``` +apt-get update && apt-get install -y build-essential curl +pip install asyncio-nats-client[nkeys] +``` + +Get the Python examples using curl + +``` +curl -o nats-pub.py -O -L https://raw.githubusercontent.com/nats-io/nats.py/master/examples/nats-pub/__main__.py +curl -o nats-sub.py -O -L https://raw.githubusercontent.com/nats-io/nats.py/master/examples/nats-sub/__main__.py +``` + +Create a subscription that lingers + +``` +python nats-sub.py --creds /creds/NGS.creds -s tls://connect.ngs.global:4222 hello & +``` + +Publish a message + +``` +python nats-pub.py --creds /creds/NGS.creds -s tls://connect.ngs.global:4222 hello -d world +``` From 45b4edb6dcf446762a387dd3e1b99ba3a70da858 Mon Sep 17 00:00:00 2001 From: Ginger Collison Date: Fri, 22 May 2020 12:21:07 -0500 Subject: [PATCH 2/2] Update ngs-docker-python.md --- nats-server/nats_docker/ngs-docker-python.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nats-server/nats_docker/ngs-docker-python.md b/nats-server/nats_docker/ngs-docker-python.md index 3735b30..410497b 100644 --- a/nats-server/nats_docker/ngs-docker-python.md +++ b/nats-server/nats_docker/ngs-docker-python.md @@ -1,38 +1,38 @@ # Getting started with Python and NGS running in Docker -Start a lightweight Docker container +Start a lightweight Docker container: ``` docker run --entrypoint /bin/bash -it python:3.8-slim-buster ``` -Or can also mount local creds via a volume: +Or you can also mount local creds via a volume: ``` docker run --entrypoint /bin/bash -v $HOME/.nkeys/creds/synadia/NGS/:/creds -it python:3.8-slim-buster ``` -Install nats.py and deps to install nkeys. +Install nats.py and dependencies to install nkeys: ``` apt-get update && apt-get install -y build-essential curl pip install asyncio-nats-client[nkeys] ``` -Get the Python examples using curl +Get the Python examples using curl: ``` curl -o nats-pub.py -O -L https://raw.githubusercontent.com/nats-io/nats.py/master/examples/nats-pub/__main__.py curl -o nats-sub.py -O -L https://raw.githubusercontent.com/nats-io/nats.py/master/examples/nats-sub/__main__.py ``` -Create a subscription that lingers +Create a subscription that lingers: ``` python nats-sub.py --creds /creds/NGS.creds -s tls://connect.ngs.global:4222 hello & ``` -Publish a message +Publish a message: ``` python nats-pub.py --creds /creds/NGS.creds -s tls://connect.ngs.global:4222 hello -d world