Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Valkey trigger application tutorial #136

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tpmccallum
Copy link
Contributor

@tpmccallum tpmccallum commented Mar 22, 2024

Add an end-to-end Valkey trigger example.

Signed-off-by: tpmccallum <tim.mccallum@fermyon.com>
Copy link
Contributor

@ThorstenHans ThorstenHans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went through the article one and added a couple of suggestions. However, I didn't run the sample so far (conference wifi isn't the best TBH)

Copy link
Contributor

@vdice vdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some notes as I went through the tutorial today. Would be great to get a version of this in soon!


```bash
my-redis-master:6379> PUBLISH channel-one message-one
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lastly, shall we show the redis app pod logs printing receipt of the message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vdice
I made it all the way to the end of this document on my machine, but I get integer 0 when I publish the message on channel-one. There are no error messages; everything seems to be running, and the prompts are in a ready state.
I feel like I am missing something; should I be writing any Rust code after the // Implement me comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tpmccallum, that's all good on the publishing side. What I meant here was to then show the logs from the consuming side, eg the Spin app that is subscribing to messages published to the channel-one channel. For example, here are the logs for a redis SpinAapp when I published "HELLO" to the messages channel:

$ kubectl logs -f -l core.spinoperator.dev/app-name=redis-spinapp
Active Channels on redis://:DTatx2DV4p@redis-master.redis.svc.cluster.local:6379:
	messages: [redis-rust]
HELLO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice one @vdice!

Signed-off-by: tpmccallum <tim.mccallum@fermyon.com>
Signed-off-by: tpmccallum <tim.mccallum@fermyon.com>
@@ -0,0 +1,219 @@
---
title: Publish-Subscribe With Redis
description: Learn how to create a Spin App that responds to messages on pub-sub Redis channels and runs in Kubernetes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this to use Valkey rather than Redis now that Redis is no-longer open source software.

```toml
# --snip --
[application.trigger.redis]
address = "redis://:password@my-redis-master.default.svc.cluster.local:6379"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't ship this as an example - this should use secrets via the Spin App manifest rather than pushing them in plaintext to an OCI registry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With spinkube/containerd-shim-spin#78 merged, I think we can treat the address as a variable as well.

@tpmccallum tpmccallum changed the title Add Redis trigger application tutorial Add Valkey trigger application tutorial Apr 16, 2024
Signed-off-by: tpmccallum <tim.mccallum@fermyon.com>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating step by step:

  • change Redis to Valkey where possible (some template prompts and manifest configuration can't change unless the SDK is changed or a new SDK is written specifically for Valkey)
  • Install Valkey (instead of Redis via Bitnami) - see the #TODO inline
  • Use secrets instead of password in plain text in config or commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants