added Dockerfile to waku node so we can build and run on demo w/ burnettk

This commit is contained in:
jasquat 2022-10-17 16:17:19 -04:00
parent 7429a0725f
commit 3e9491d8b0
4 changed files with 84 additions and 4 deletions

View File

@ -0,0 +1,28 @@
# Build status-go in a Go builder container
FROM golang:1.18-alpine as builder
RUN apk add --no-cache make gcc g++ musl-dev linux-headers
ARG build_tags
ARG build_flags
RUN mkdir -p /go/src/github.com/status-im/status-go
WORKDIR /go/src/github.com/status-im/status-go
ADD . .
# RUN cd cmd/spiff-workflow && go build --mod=vendor
RUN cd cmd/spiff-workflow && go build --mod=vendor
# Copy the binary to the second image
FROM alpine:latest
RUN apk add --no-cache ca-certificates bash libgcc libstdc++
RUN mkdir -p /static/keys
COPY --from=builder /go/src/github.com/status-im/status-go/cmd/spiff-workflow/spiff-workflow /usr/local/bin/
# 30304 is used for Discovery v5
EXPOSE 8080 8545 30303 30303/udp 30304/udp
# ENTRYPOINT ["/usr/local/bin/statusd"]
ENTRYPOINT ["/usr/local/bin/spiff-workflow"]
CMD ["--help"]

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
docker \
run \
--net=host \
--name spiffworkflow-waku-node \
-d \
spiffworkflow-waku-node:latest \
--seed-phrase "waku ftw we are about to send a one on one message baby oh yeah"

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
git clone https://github.com/status-im/status-go.git "${tmp_dir}/status-go"
cd "${tmp_dir}/status-go"
git checkout feature/spiff-workflow
# cd cmd/spiff-workflow
cp "${script_dir}/../Dockerfile" .
docker build -t spiffworkflow-waku-node:latest .

View File

@ -6,6 +6,21 @@ import requests
from flask import current_app
# Example:
"""
curl -XPOST http://localhost:8545 -H 'Content-type: application/json' \
'{
"jsonrpc": "2.0",
"method": "wakuext_sendOneToOneMessage",
"params": [
{
"id": "0xPUBLIC_KEY",
"message": "hello there, try http://167.172.242.138:7001/"
}
],
"id": 1
}'
"""
@dataclass
class SendMessage:
"""SendMessage."""
@ -16,12 +31,14 @@ class SendMessage:
def execute(self, config, task_data):
"""Execute."""
url = f'{current_app.config["WAKU_PROXY_BASE_URL"]}/sendMessage'
url = f'{current_app.config["WAKU_BASE_URL"]}'
headers = {"Accept": "application/json", "Content-type": "application/json"}
request_body = {
"message": self.message,
"recipient": self.recipient,
"message_type": self.message_type,
"jsonrpc": "2.0",
"method": self.message_type,
"params":[{"id": self.recipient,
"message": self.message}],
"id": 1
}
status_code = None