Skip to content

Instantly share code, notes, and snippets.

View wallyqs's full-sized avatar
🌎

Waldemar Quevedo wallyqs

🌎
  • Synadia Communications, Inc.
  • San Francisco
  • X @wallyqs
View GitHub Profile
@wallyqs
wallyqs / stan-simple-ft.yaml
Last active October 14, 2020 17:48
Simple STAN + FT setup on AKS
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: stan-ssd-ft
annotations:
volume.beta.kubernetes.io/storage-class: "azurefile"
spec:
accessModes:
- ReadWriteMany
@wallyqs
wallyqs / stan-simple.yaml
Created October 8, 2020 22:02
STAN + AKS + Storage
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: stan-disk
annotations:
volume.beta.kubernetes.io/storage-class: "managed-premium"
spec:
accessModes:
- ReadWriteOnce
@wallyqs
wallyqs / azure-stan-ft.md
Last active October 5, 2020 20:49
Azure File + STAN + Helm

First need to create a PVC (PersistentVolumeClaim), in Azure we can use azurefile to get a volume with ReadWriteMany:

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: stan-efs
  annotations:
@wallyqs
wallyqs / threads-asyncio.py
Created September 30, 2020 16:18
threads-asyncio.py
import asyncio
import nats
import concurrent.futures
import time
def train(msg):
print("->> Train task started...", msg.data)
time.sleep(1) # seconds
print("<<- Train task done...", msg.data)
return f"DONE: {msg.data.decode()}"
@wallyqs
wallyqs / ractor-nats.rb
Last active September 26, 2020 22:00
NATS + Ruby3 Ractors
require 'socket'
module NATS
VERSION = '2.0.0'
class Subscription
def initialize(ractor)
@ractor = ractor
end
@wallyqs
wallyqs / nats-async-for.py
Created September 24, 2020 15:44
nats.py async for experiments
import asyncio
import nats
async def run():
nc = await nats.connect(servers=["nats://localhost:4222"])
# Using list comprehension like syntax with limited interest
sub1 = await nc.subscribe("foo")
await nc.publish("foo", b'First')
await nc.publish("foo", b'Second')
@wallyqs
wallyqs / stan-block-device.yaml
Last active September 10, 2020 21:44
STAN + Block Device
---
apiVersion: v1
kind: ConfigMap
metadata:
name: stan-config
data:
stan.conf: |
port: 4222
http: 8222
import asyncio
from nats.aio.client import Client as NATS
async def run(loop):
nc = NATS()
await nc.connect("nats://demo.nats.io:4222", loop=loop)
future = asyncio.Future()
async def cb(msg):
@wallyqs
wallyqs / cert-manager.yaml
Created June 25, 2020 20:56
NATS Helm Charts + Cert Manager
---
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
name: selfsigning
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1alpha2
kind: Certificate