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

Components in local k3d #14

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions platform-wasmcloud/k3d/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Local K3d cluster

### Prerequisites

- [Docker](https://docs.docker.com/get-docker/)
- [K3d](https://k3d.io/#installation)


### Create a local K3d cluster

```bash
./create.fish
./up.fish
```

### Install wasmCloud operator

see [wasmCloud operator](../operator/README.md)

### Install redis

```bash
helm install redis oci://registry-1.docker.io/bitnamicharts/redis
```

### Delete the local K3d cluster

```bash
./down.fish
./destroy.fish
```
42 changes: 42 additions & 0 deletions platform-wasmcloud/postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Install postgres

```fish
helm install postgres oci://registry-1.docker.io/bitnamicharts/postgresql
```

### Accessing the PostgreSQL® cluster

Get the PostgreSQL® password:

```fish
set POSTGRES_PASSWORD (kubectl get secret --namespace default postgres-postgresql -o jsonpath="{.data.postgresql-password}" | base64 -d)
```

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

postgres-postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

export POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgres-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

To connect to your database run the following command:

kubectl run postgres-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:16.4.0-debian-12-r4 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
--command -- psql --host postgres-postgresql -U postgres -d postgres -p 5432

> NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"

To connect to your database from outside the cluster execute the following commands:

kubectl port-forward --namespace default svc/postgres-postgresql 5432:5432 &
PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432

WARNING: The configured password will be ignored on new installation in case when previous PostgreSQL release was deleted through the helm command. In that case, old PVC will have an old password, and setting it through helm won't take effect. Deleting persistent volumes (PVs) will solve the issue.

WARNING: There are "resources" sections in the chart not set. Using "resourcesPreset" is not recommended for production. For production installations, please set the following values according to your workload needs:
- primary.resources
- readReplicas.resources
+info https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
12 changes: 12 additions & 0 deletions platform-wasmcloud/postgres/client.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env fish

set POSTGRES_PASSWORD (kubectl get secret --namespace default postgres-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)
echo "Password: $POSTGRES_PASSWORD"

kubectl run postgres-postgresql-client --rm --tty -i \
--namespace default \
--restart Never \
--image docker.io/bitnami/postgresql:16.4.0-debian-12-r4 \
--env "PGPASSWORD=$POSTGRES_PASSWORD" \
--command -- \
psql --host postgres-postgresql -U postgres -d postgres -p 5432
35 changes: 35 additions & 0 deletions platform-wasmcloud/redis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### Install redis

```fish
helm install redis oci://registry-1.docker.io/bitnamicharts/redis
```

### Accessing the Redis® cluster

Get the Redis® password:

```fish
set REDIS_PASSWORD (kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 -d)
```

Create a client pod:

```fish
./client.fish
```

Connect to your database using the Redis® CLI:

```bash
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-replicas
```

To connect to your database from outside the cluster execute the following commands:

```fish
set REDIS_PASSWORD (kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 -d)

kubectl port-forward --namespace default svc/redis-master 6379:6379 &
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379
```
14 changes: 14 additions & 0 deletions platform-wasmcloud/redis/client.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env fish


set REDIS_PASSWORD (kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 -d)

echo "!!! Press <shift-r> to get the redis cli prompt"

kubectl run redis-client --rm --tty -i \
--namespace default \
--restart Never \
--image docker.io/bitnami/redis:7.4.0-debian-12-r2 \
--env "REDISCLI_AUTH=$REDIS_PASSWORD" \
--command -- \
redis-cli -h redis-master