From a1a69f0fa93d3e7a2bd4252efd4eb98fae666b25 Mon Sep 17 00:00:00 2001
From: Lyn <0xlynett@proton.me>
Date: Sat, 24 Aug 2024 15:31:46 +0100
Subject: [PATCH 1/2] use docker buildkit
---
README.md | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 5d3350fbb..c79b5e538 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,6 @@
-
Kinode is a general-purpose sovereign cloud computer, built for crypto.
This repo contains the core runtime and processes.
@@ -17,10 +16,10 @@ Then follow the instructions to [install it](https://book.kinode.org/install.htm
If you have questions, join the [Kinode discord](https://discord.gg/TCgdca5Bjt) and drop us a line in `#dev-support`.
-
## Setup
On certain operating systems, you may need to install these dependencies if they are not already present:
+
- openssl-sys: https://docs.rs/crate/openssl-sys/0.9.19
- libclang 5.0: https://rust-lang.github.io/rust-bindgen/requirements.html
@@ -54,6 +53,7 @@ No security audits of this crate have ever been performed. This software is unde
Make sure not to use the same home directory for two nodes at once! You can use any name for the home directory: here we just use `home`. The `--` here separates cargo arguments from binary arguments.
TODO: document feature flags in `--simulation-mode`
+
```bash
# OPTIONAL: --release flag
cargo +nightly run -p kinode -- home
@@ -66,6 +66,7 @@ On boot you will be prompted to navigate to `localhost:8080` (or whatever HTTP p
By default, a node will use the [hardcoded providers](./kinode/src/eth/default_providers_mainnet.json) for the network it is booted on. A node can use a WebSockets RPC URL directly, or use another Kinode as a relay point. To adjust the providers a node uses, just create and modify the `.eth_providers` file in the node's home folder (set at boot). See the Kinode Book for more docs, and see the [default providers file here](./kinode/src/eth/default_providers_mainnet.json) for a template to create `.eth_providers`.
You may also add a RPC provider or otherwise modify your configuration by sending messages from the terminal to the `eth:distro:sys` process. You can get one for free at `alchemy.com`. Use this message format to add a provider -- this will make your node's performance better when accessing a blockchain:
+
```
m our@eth:distro:sys '{"AddProvider": {"chain_id": , "trusted": true, "provider": {"RpcUrl": ""}}}'
```
@@ -121,18 +122,18 @@ The `sys` publisher is not a real node ID, but it's also not a special case valu
- CTRL+R to search history, CTRL+R again to toggle through search results, CTRL+G to cancel search
- `m ''`: send an inter-process message. is formatted as @. is formatted as ::. JSON containing spaces must be wrapped in single-quotes (`''`).
- - Example: `m our@eth:distro:sys "SetPublic" -a 5`
- - the '-a' flag is used to expect a response with a given timeout
- - `our` will always be interpolated by the system as your node's name
+ - Example: `m our@eth:distro:sys "SetPublic" -a 5`
+ - the '-a' flag is used to expect a response with a given timeout
+ - `our` will always be interpolated by the system as your node's name
- `hi `: send a text message to another node's command line.
- - Example: `hi ben.os hello world`
+ - Example: `hi ben.os hello world`
- `top `: display kernel debugging info about a process. Leave the process ID blank to display info about all processes and get the total number of running processes.
- - Example: `top net:distro:sys`
- - Example: `top`
+ - Example: `top net:distro:sys`
+ - Example: `top`
- `cat `: print the contents of a file in the terminal
- - Example: `cat /terminal:sys/pkg/scripts.json`
+ - Example: `cat /terminal:sys/pkg/scripts.json`
- `echo `: print `text` to the terminal
- - Example: `echo foo`
+ - Example: `echo foo`
- `net_diagnostics`: print some useful networking diagnostic data
- `peers`: print the peers the node currently hold connections with
- `peer `: print the peer's PKI info, if it exists
@@ -146,9 +147,10 @@ The image includes EXPOSE directives for TCP port `8080` and TCP port `9000`. Po
If you are running a direct node, you must map port `9000` to the same port on the host and on your router. Otherwise, your Kinode will not be able to connect to the rest of the network as connection info is written to the chain, and this information is based on the view from inside the Docker container.
To build a local Docker image, run the following command in this project root.
+
```bash
# The `VERSION` may be replaced with the tag of a GitHub release
-docker build -t 0xlynett/kinode . --build-arg VERSION=v0.8.6
+docker buildx build -t 0xlynett/kinode . --build-arg VERSION=v0.9.1 --platform linux/amd64,linux/arm64
```
For example:
@@ -159,4 +161,4 @@ docker volume create kinode-volume
docker run -d -p 8080:8080 -it --name my-kinode \
--mount type=volume,source=kinode-volume,destination=/kinode-home \
0xlynett/kinode
-```
\ No newline at end of file
+```
From 63ea699d186fd65e80bb1ae85c1af558936d7aab Mon Sep 17 00:00:00 2001
From: Lyn <0xlynett@proton.me>
Date: Mon, 26 Aug 2024 22:41:01 +0100
Subject: [PATCH 2/2] add support for multiarch builds
---
Dockerfile | 20 ++++++++++++--------
README.md | 7 ++++++-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 2f1f5822d..5496d4b26 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,18 +1,22 @@
-FROM debian:12-slim AS downloader
+FROM --platform=$BUILDPLATFORM alpine AS downloader_start
ARG VERSION
-
+ARG TARGETARCH
WORKDIR /tmp/download
+RUN apk update && apk add unzip wget --no-cache
-RUN apt-get update
-RUN apt-get install unzip -y
-
+FROM downloader_start AS downloader_amd64
ADD "https://github.com/kinode-dao/kinode/releases/download/${VERSION}/kinode-x86_64-unknown-linux-gnu.zip" kinode-x86_64-unknown-linux-gnu.zip
RUN unzip kinode-x86_64-unknown-linux-gnu.zip
+FROM downloader_start AS downloader_arm64
+ADD "https://github.com/kinode-dao/kinode/releases/download/${VERSION}/kinode-aarch64-unknown-linux-gnu.zip" kinode-aarch64-unknown-linux-gnu.zip
+RUN unzip kinode-aarch64-unknown-linux-gnu.zip
+
+FROM downloader_${TARGETARCH} AS downloader
+
FROM debian:12-slim
-RUN apt-get update
-RUN apt-get install openssl -y
+RUN apt-get update && apt-get install openssl -y
COPY --from=downloader /tmp/download/kinode /bin/kinode
@@ -20,4 +24,4 @@ ENTRYPOINT [ "/bin/kinode" ]
CMD [ "/kinode-home" ]
EXPOSE 8080
-EXPOSE 9000
\ No newline at end of file
+EXPOSE 9000
diff --git a/README.md b/README.md
index c79b5e538..11464cb0f 100644
--- a/README.md
+++ b/README.md
@@ -150,7 +150,12 @@ To build a local Docker image, run the following command in this project root.
```bash
# The `VERSION` may be replaced with the tag of a GitHub release
-docker buildx build -t 0xlynett/kinode . --build-arg VERSION=v0.9.1 --platform linux/amd64,linux/arm64
+
+# Build for your system's architecture
+docker build . -t 0xlynett/kinode --build-arg VERSION=v0.9.1
+
+# Build a multiarch image
+docker buildx build . --platform arm64,amd64 --build-arg VERSION=v0.9.1 -t 0xlynett/kinode
```
For example: