spinkube / documentation

Site and Docs for the SpinKube community project
https://www.spinkube.dev/
Apache License 2.0
15 stars 23 forks source link

Tutorial: Document using Redis trigger Spin App with spin-operator #40

Open macolso opened 7 months ago

macolso commented 7 months ago

@calebschoepp shows using Redis trigger app with spin-operator here:

# Setup cluster in one terminal
k3d cluster create wasm-cluster --image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.10.0 -p "8081:80@loadbalancer" --agents 2x
k apply -f spin-runtime-class.yaml
make install
make run

# Install Redis
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install redis bitnami/redis
export REDIS_PASSWORD=$(kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 -d)
echo $REDIS_PASSWORD

# Build and push app (make sure to change password in redis address of spin.toml
cd apps/order-processor
spin build
spin registry push ttl.sh/your-unique-name:1h

# Apply spinapp (make sure to update image)
k apply -f config/samples/redis.yaml

# Publish message to redis channel
kubectl run --namespace default redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image docker.io/bitnami/redis:7.2.4-debian-11-r0 --command -- sleep infinity
kubectl exec --tty -i redis-client --namespace default -- bash
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master
PUBLISH orders "hello world"

# Then go look at the logs of the spin app to see that it received the Redis message

The steps provided can be written up as a new file in the documentation/content folder and join the queue for approval/review.

vdice commented 5 months ago

Relevant PR: https://github.com/spinkube/documentation/pull/136