From ede5a96c0fe2e718c7ae7b017f2602d41eb38fad Mon Sep 17 00:00:00 2001 From: Kevin Davis Date: Mon, 25 Nov 2019 14:24:46 -0500 Subject: [PATCH] add init scripts --- Dockerfile | 27 +++++++++++++++++++++++++++ contrib/init/README.md | 6 ++++++ contrib/init/io.kava.kvd.plist | 20 ++++++++++++++++++++ contrib/init/kvd.service | 15 +++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 Dockerfile create mode 100644 contrib/init/README.md create mode 100644 contrib/init/io.kava.kvd.plist create mode 100644 contrib/init/kvd.service diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7fe1a7f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:alpine AS build-env + +# Set up dependencies +# bash for debugging +# git, make for installation +# libc-dev, gcc, linux-headers, eudev-dev are used for cgo and ledger installation (possibly) +RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq + + +# Set working directory for the build +WORKDIR /root/kava +# default home directory is /root + +COPY go.mod . +COPY go.sum . + +RUN go mod download + +# Add source files +COPY . . + +# Install kvd, kvcli +#ENV LEDGER_ENABLED False +RUN make install + +# Run kvd by default, omit entrypoint to ease using container with kvcli +CMD ["kvd"] diff --git a/contrib/init/README.md b/contrib/init/README.md new file mode 100644 index 00000000..28bca6b4 --- /dev/null +++ b/contrib/init/README.md @@ -0,0 +1,6 @@ +Sample configuration files for: + +``` +SystemD: kvd.service +macOS: io.kava.kvd.plist +``` \ No newline at end of file diff --git a/contrib/init/io.kava.kvd.plist b/contrib/init/io.kava.kvd.plist new file mode 100644 index 00000000..0e557313 --- /dev/null +++ b/contrib/init/io.kava.kvd.plist @@ -0,0 +1,20 @@ + + + + + Label + io.kava.kvd + ProgramArguments + + + /Users/kava/go/bin/kvd + start + + RunAtLoad + + UserName + kava + + + +QuantaFrontier.com \ No newline at end of file diff --git a/contrib/init/kvd.service b/contrib/init/kvd.service new file mode 100644 index 00000000..790a5fe9 --- /dev/null +++ b/contrib/init/kvd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Kava daemon +After=network-online.target + +[Service] + +# Run as kava:kava +User=kava +ExecStart=/home/kava/go/bin/kvd start +Restart=on-failure +RestartSec=3 +LimitNOFILE=4096 + +[Install] +WantedBy=multi-user.target \ No newline at end of file