Skip to content
Permalink
Browse files

chore(Docker): minimal docker image for node + redis

related to #165
  • Loading branch information...
emschwartz committed Jul 26, 2019
1 parent 0492055 commit 58df5fd3a5c64efba0361456fb3940e2b1682753
Showing with 85 additions and 1 deletion.
  1. +3 −0 .dockerignore
  2. +53 −0 Dockerfile
  3. +1 −1 README.md
  4. +20 −0 redis.conf
  5. +8 −0 run-node-and-redis.sh
@@ -0,0 +1,3 @@
target
docs
examples
@@ -0,0 +1,53 @@
# Build Interledger node into standalone binary
FROM clux/muslrust:stable as rust

WORKDIR /usr/src
COPY ./Cargo.toml /usr/src/Cargo.toml
COPY ./crates /usr/src/crates

# TODO: investigate using a method like https://whitfin.io/speeding-up-rust-docker-builds/
# to ensure that the dependencies are cached so the build doesn't take as long
RUN cargo build --release --package interledger
# RUN cargo build --package interledger

FROM alpine

# Expose ports for HTTP and BTP
EXPOSE 7768
EXPOSE 7770

# To save the node's data across runs, mount a volume called "/data".
# You can do this by adding the option `-v data-volume-name:/data`
# when calling `docker run`.

VOLUME [ "/data" ]

# Install SSL certs and Redis
RUN apk --no-cache add \
ca-certificates \
redis

# Copy Interledger binary
COPY --from=rust \
/usr/src/target/x86_64-unknown-linux-musl/release/interledger \
/usr/local/bin/interledger
# COPY --from=rust \
# /usr/src/target/x86_64-unknown-linux-musl/debug/interledger \
# /usr/local/bin/interledger

WORKDIR /opt/app

COPY redis.conf redis.conf
COPY run-node-and-redis.sh run-node-and-redis.sh

# ENV RUST_BACKTRACE=1
ENV RUST_LOG=interledger/.*

# In order for the node to access the config file, you need to mount
# the directory with the node's config.yml file as a Docker volume
# called "/config". You can do this by adding the option
# `-v /path/to/config.yml:/config` when calling `docker run`.
VOLUME [ "/config" ]

ENTRYPOINT [ "/bin/sh", "./run-node-and-redis.sh" ]
CMD [ "-c", "/config/config.yml" ]
@@ -9,7 +9,7 @@
[![Interledger.rs Documentation](https://docs.rs/interledger/badge.svg)](https://docs.rs/interledger)
[![CircleCI](https://circleci.com/gh/emschwartz/interledger-rs.svg?style=shield)](https://circleci.com/gh/emschwartz/interledger-rs)
![Rust Version](https://img.shields.io/badge/rust-stable-Success)
<!-- [![Docker Image](https://img.shields.io/docker/pulls/emschwartz/interledger-rs.svg?maxAge=2592000)](https://hub.docker.com/r/emschwartz/interledger-rs/) -->
[![Docker Image](https://img.shields.io/docker/pulls/emschwartz/interledger-rs.svg?maxAge=2592000)](https://hub.docker.com/r/emschwartz/interledger-rs/)

## Understanding Interledger.rs
- [HTTP API](./docs/api.md)
@@ -0,0 +1,20 @@
# Listen for TCP connections on this port
port 6379
# Also listen for unix socket connections, because they are faster than TCP
unixsocket /tmp/redis.sock
unixsocketperm 777

# Save redis data using append-only log of commands
# Note this is in addition to the RDB snapshots that are on by default
appendonly yes
# This saves the data every second, which is faster than after
# each command but means that up to 1 second of transactions
# can be lost if the server crashes
# Change this value to "always" to make it save transactions to
# the file before applying them
appendfsync everysec

# Load redis-cell module, which is used for rate limiting
loadmodule ./interledger-store-redis/external/libredis_cell.so

daemonize yes
@@ -0,0 +1,8 @@
#!/bin/bash

# turn on bash's job control
set -m

redis-server --dir /data &
sleep 1
interledger node $@

0 comments on commit 58df5fd

Please sign in to comment.
You can’t perform that action at this time.