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

feat(anna): Get minikube working #1472

Merged
merged 1 commit into from
Oct 2, 2024
Merged
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
8 changes: 6 additions & 2 deletions datastores/gossip_kv/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
FROM "hydroflow/gossip-kv-server-base-image:latest" as builder
FROM "hydroflow/gossip-kv-server-base-image:latest" AS builder
WORKDIR /usr/src/gossip-kv-server
COPY . .
RUN find .
RUN cargo build --release --workspace -p gossip_kv

FROM rustlang/rust:nightly-slim
COPY --from=builder /usr/src/gossip-kv-server/target/release/gossip_server /usr/local/bin/gossip_server
CMD ["gossip_server"]

# Don't skip the trailing slash in the destination directory
COPY datastores/gossip_kv/server/config/*.toml /config/
CMD ["gossip_server"]
# ENTRYPOINT ["tail", "-f", "/dev/null"]
28 changes: 22 additions & 6 deletions datastores/gossip_kv/server/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
From the `datastores/gossip_kv` directory, run
From the `hydroflow` directory, run

## Minikube

### Start Minikube
Disk allocation is done by the driver used to create the VM. Setting this to a high value will do nothing if the
driver isn't correctly configured. You'll only notice that hydroflow runs out of disk space while compiling.
For Docker, the disk size is set in the Docker Desktop settings. Also, provide as many CPUs here as possible, since
building the code is CPU-intensive.
```shell
minikube start --disk-size=100g --cpus=16 --memory=32768
```

### Use the Docker daemon from minikube
```shell
eval $(minikube docker-env)
```

## Build Docker Base Image
Speeds up code changes by caching build dependencies.
```shell
docker build -t "hydroflow/gossip-kv-server-base-image:latest" -f examples/server/baseimage.Dockerfile .
docker build -t "hydroflow/gossip-kv-server-base-image:latest" -f datastores/gossip_kv/server/baseimage.Dockerfile .
```

## Build Docker Server Image
```shell
docker build -t "hydroflow/gossip-kv-server:latest" -f examples/server/Dockerfile .
docker build -t "hydroflow/gossip-kv-server:latest" -f datastores/gossip_kv/server/Dockerfile .
```

## Check if minikube has the image
You should see "hydroflow/gossip-kv"
```shell
minikube image ls --format table
``
minikube image ls --format tablemin
```

## Deploy to Minikube
```shell
kubectl apply -f examples/server/deployment/local
kubectl apply -f datastores/gossip_kv/server/deployment/local
```
9 changes: 8 additions & 1 deletion datastores/gossip_kv/server/baseimage.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
FROM rustlang/rust:nightly as builder
FROM rustlang/rust:nightly AS builder
WORKDIR /usr/src/gossip-kv-server-base-image
COPY . .

RUN apt-get update && apt-get install -y \
python3 \
python3.11-dev \
libpython3.11 \
build-essential \
&& rm -rf /var/lib/apt/lists/*

## Build everything, including dependencies. The built dependencies will be cached, so only changing the server
## code requires lesser build time.
RUN cargo build --release --workspace -p gossip_kv
Expand Down
9 changes: 7 additions & 2 deletions datastores/gossip_kv/server/deployment/local/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
- name: gossip-kv-server
image: docker.io/hydroflow/gossip-kv-server:latest
imagePullPolicy: IfNotPresent
env:
- name: RUST_LOG
value: "trace"
ports:
- containerPort: 80
protocol: TCP
- containerPort: 3000
protocol: UDP
- containerPort: 3001
protocol: UDP
8 changes: 4 additions & 4 deletions datastores/gossip_kv/server/deployment/local/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
app: gossip-kv-server-example
type: LoadBalancer
ports:
- name: tcp-port
port: 80
targetPort: 80
protocol: TCP
- name: client-port
port: 3001
targetPort: 3001
protocol: UDP
8 changes: 0 additions & 8 deletions datastores/gossip_kv/server/deployment/patch.yaml

This file was deleted.

6 changes: 1 addition & 5 deletions datastores/gossip_kv/server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ async fn main() {
member_data,
seed_nodes,
);
server
.meta_graph()
.unwrap()
.open_mermaid(&Default::default())
.unwrap();

server.run_async().await;
}
Loading