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

Add a Dockerfile and build instructions #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fuzz/hfuzz_target
fuzz/hfuzz_workspace
fuzz/target
target
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ The anti-replay oracle used under the [Revault architecture](https://github.com/
## Usage
`cosignerd` must be used along with `revaultd`. Check `revaultd's` [tutorial](https://github.com/revault/revaultd/tree/master/doc/USAGE.md) to get started!

You can build it like any other Rust project, using Cargo:
```
git clone https://github.com/revault/cosignerd
cd cosignerd && cargo build
```

You'll need a configuration file to start it. You can find an example at
[`contrib/config.toml`](contrib/config.toml):
```
cargo run -- --conf ./contrib/config.toml
```

For testing purpose and/or running `cosignerd` on a non-UNIX system you can use Docker:
```
# From the root of the repository
docker build -t cosignerd -f contrib/cosignerd.Dockerfile .
docker run --rm --name cosignerd cosignerd
```
The configuration is here passed through environment variables:
```
docker run -it --rm --name cosignerd -e NOISE_SECRET="\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02" -e BITCOIN_SECRET="\x43\xff\x32\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\81\x01" -e MANAGERS_NOISE_KEYS="e798cf79e7245f06f62cc76609d51c76d42f3da4fab831f543f3254e5c6d7dc7 a19052df1337936e549a6b830ff4cc0e9028eaf6e79779de76d200e3b201953b cebbe8b9edadab14f23dbe1f4f0d55c7a3e9de13ab9adbe4aefacdc26f7c7dd1" -e LOG_LEVEL="debug" cosignerd
```

## Licence

BSD 3-clauses, see [LICENSE](LICENSE).
29 changes: 29 additions & 0 deletions contrib/cosignerd.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM rust:alpine

# Space separated list of managers' noise keys. Must be set at startup, that's a dummy key.
ENV MANAGERS_NOISE_KEYS="b28cf2091bbbecf347d29420f884a936713e7b2e86fe4f6653d7e12356d26114"
# Bitcoin and Noise private keys
ENV BITCOIN_SECRET="\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x42"
ENV NOISE_SECRET="\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x42"
# Other config options
ENV LOG_LEVEL="trace"


COPY . /srv/cosignerd/src
RUN apk add g++ make && \
cd /srv/cosignerd/src && \
RUSTFLAGS="-C target-feature=-crt-static" cargo build

EXPOSE 8383/tcp

CMD echo "daemon = false" >> /srv/cosignerd/config.toml && \
echo "data_dir = '/srv/cosignerd/datadir'" >> /srv/cosignerd/config.toml && \
echo "log_level = '$LOG_LEVEL'" >> /srv/cosignerd/config.toml && \
for key in $MANAGERS_NOISE_KEYS; do \
echo "[[managers]]" >> /srv/cosignerd/config.toml && \
echo "noise_key = \"$key\"" >> /srv/cosignerd/config.toml \
; done && \
mkdir /srv/cosignerd/datadir && \
printf $BITCOIN_SECRET > /srv/cosignerd/datadir/bitcoin_secret && \
printf $NOISE_SECRET > /srv/cosignerd/datadir/noise_secret && \
/srv/cosignerd/src/target/debug/cosignerd --conf /srv/cosignerd/config.toml