Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Making docker image for byzcoin and web
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Sep 20, 2023
1 parent 3af85bf commit 787289a
Show file tree
Hide file tree
Showing 14 changed files with 297 additions and 133 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile*
docker-compose*
11 changes: 9 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -25,5 +23,14 @@ jobs:
with:
context: .
platforms: linux/amd64
target: byzcoin
push: true
tags: ghcr.io/c4dt/byzcoin:latest
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
target: web
push: true
tags: ghcr.io/c4dt/byzcoin-web:latest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/cached.db
.godocker
.idea
nodes
/nodes/
53 changes: 0 additions & 53 deletions DEDIS_BYZCOIN.md

This file was deleted.

63 changes: 56 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM golang:1.15 as builder
FROM golang:1.15 as builder-byzcoin

COPY . /byzcoin
RUN apt update && apt install -y zsh && apt clean
COPY go.* /byzcoin/
COPY cmd /byzcoin/cmd/
COPY pkg /byzcoin/pkg/
WORKDIR /byzcoin
ENV LDFLAGS="-s -w -X main.gitTag=archive"
RUN go build -ldflags="$LDFLAGS" ./cmd/byzcoin
Expand All @@ -9,18 +12,64 @@ WORKDIR /byzcoin/pkg/cothority
RUN go build -ldflags="$LDFLAGS" ./byzcoin/bcadmin
RUN go build -ldflags="$LDFLAGS" ./personhood/phapp
RUN cd scmgr && go build -ldflags="$LDFLAGS" .
WORKDIR /byzcoin
RUN cp /byzcoin/pkg/cothority/bcadmin /byzcoin/pkg/cothority/phapp \
/byzcoin/pkg/cothority/scmgr/scmgr /byzcoin
COPY docker/byzcoin.sh setup_demo_chain.sh ./
RUN ./setup_demo_chain.sh

FROM node:12 as builder-omniledger
RUN git clone https://github.com/c4dt/omniledger -b archive /omniledger
WORKDIR /omniledger/webapp
RUN npm ci && npm link ../dynacred
RUN npx ng build --prod --base-href /login/ --deploy-url /login/ --aot --output-path www
COPY --from=builder-byzcoin /byzcoin/nodes/config.toml www/assets/

FROM node:14 as builder-olexplorer
RUN git clone https://github.com/c4dt/ol-explorer -b archive /ol-explorer
WORKDIR /ol-explorer
RUN npm ci
RUN npx ng build --prod --base-href /ol-explorer/ --deploy-url /ol-explorer/ --output-path www
COPY --from=builder-byzcoin /byzcoin/nodes/config.toml www/assets/config.toml

FROM node:14 as builder-columbus
RUN git clone https://github.com/c4dt/columbus-united -b archive /columbus
WORKDIR /columbus
RUN npm i
RUN npm run bundle
COPY --from=builder-byzcoin /byzcoin/nodes/config.toml assets/config.toml

FROM debian:bookworm-slim
FROM scratch as setup_log
COPY --from=builder-byzcoin /byzcoin/login.txt .
COPY --from=builder-byzcoin /byzcoin/nodes/config.toml .

FROM lipanski/docker-static-website:latest as web
#FROM python:latest
COPY httpd.conf .
COPY --from=builder-omniledger /omniledger/webapp/www/ login/
COPY --from=builder-olexplorer /ol-explorer/www/ ol-explorer/
COPY --from=builder-columbus /columbus/index.html columbus/
COPY --from=builder-columbus /columbus/dist/ columbus/dist/
COPY --from=builder-columbus /columbus/assets/ columbus/assets/
COPY --from=builder-byzcoin /byzcoin/login.txt login.txt

FROM debian:bookworm-slim as byzcoin

RUN apt update && apt install -y procps ca-certificates netcat-openbsd && apt clean
WORKDIR /root/
RUN mkdir /byzcoin
RUN mkdir -p .local/share .config
RUN ln -s /byzcoin .local/share/conode
RUN ln -s /byzcoin .config/conode
COPY --from=builder /byzcoin/byzcoin /byzcoin/full /root/
COPY --from=builder /byzcoin/pkg/cothority/bcadmin /byzcoin/pkg/cothority/phapp /root/
COPY --from=builder /byzcoin/pkg/cothority/scmgr/scmgr /root/
COPY --from=builder-byzcoin /byzcoin/byzcoin /byzcoin/full \
/byzcoin/bcadmin /byzcoin/phapp \
/byzcoin/scmgr /root/
COPY --from=builder-byzcoin /byzcoin/nodes/ /root/nodes/
COPY docker/byzcoin.sh /root/

CMD ["./byzcoin.sh"]
ENV BYZCOIN=./full
ENV DEBUG_LVL=2
ENV DEBUG_COLOR=false
ENV DEBUG_TIME=true

CMD ./byzcoin.sh
29 changes: 29 additions & 0 deletions Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:12 as builder-omniledger
RUN git clone https://github.com/c4dt/omniledger -b archive /omniledger
WORKDIR /omniledger/webapp
RUN npm ci && npm link ../dynacred
RUN npx ng build --prod --base-href /login/ --deploy-url /login/ --aot --output-path www
COPY --from=byzcoin-builder /byzcoin/nodes/config.toml www/assets/

FROM node:14 as builder-olexplorer
RUN git clone https://github.com/c4dt/ol-explorer -b archive /ol-explorer
WORKDIR /ol-explorer
RUN npm ci
RUN npx ng build --prod --base-href /ol-explorer/ --deploy-url /ol-explorer/ --output-path www
COPY --from=byzcoin-builder /byzcoin/nodes/config.toml www/assets/config.toml

FROM node:14 as builder-columbus
RUN git clone https://github.com/c4dt/columbus-united -b archive /columbus
WORKDIR /columbus
RUN npm i
RUN npm run bundle
COPY --from=byzcoin-builder /byzcoin/nodes/config.toml assets/config.toml

FROM lipanski/docker-static-website:latest as web
#FROM python:latest
COPY httpd.conf .
COPY --from=builder-omniledger /omniledger/webapp/www/ login/
COPY --from=builder-olexplorer /ol-explorer/www/ ol-explorer/
COPY --from=builder-columbus /columbus/index.html columbus/
COPY --from=builder-columbus /columbus/dist/ columbus/dist/
COPY --from=builder-columbus /columbus/assets/ columbus/assets/
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Byzcoin node
# Byzcoin node - ARCHIVED

This repo has been archived and is no longer supporter.
You can however run this as a demo to run on your local machine.
To run the demo, download the repo and run the `docker-compose.yaml` file.
Then point your browser to http://localhost:8080
The upcoming page gives a short summary of the different tools available
to interact with the byzcoin-blockchain.
The following tools are incorporated:

- ByzCoin itself, running 4 nodes locally
- [OmniLedger](https://) login tool

If you have any questions, or remarks, don't hesitate to reach out to
us by [c4dt-services@listes.epfl.ch](mailto:c4dt-services@listes.epfl.ch)

## Description

Byzcoin is a high-performance permissioned blockchain that can safely run in
public mode, meaning everybody with access tokens can use it.
Expand Down
2 changes: 0 additions & 2 deletions TODO.md

This file was deleted.

55 changes: 55 additions & 0 deletions docker-compose.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "3.0"

services:
byzcoin:
environment:
# ADDRESS_NODE should always be tls:// - tcp:// is insecure and should
# not be used.
- ADDRESS_NODE=tls://byzcoin.c4dt.org:7770
# ADDRESS_WS can be either http:// or https:// - for most of the use-cases
# you want this to be https://, so that secure webpages can access the node.
- ADDRESS_WS=http://byzcoin.c4dt.org:7771
# A short description of your node that will be visible to the outside.
- DESCRIPTION=New ByzCoin node
# Whether to use TLS in the conodes. It is tested against 'false'. So
# anything different from 'false' will be interpreted as true.
- USE_TLS=false
# WS_SSL_* is ignored if ADDRESS_WS is http or USE_TLS=false. These files
# need to be in the ~/byzcoin directory before the node is started.
- WS_SSL_CHAIN=fullchain.pem
- WS_SSL_KEY=privkey.pem
# ID of the byzcoin to follow - this corresponds to the DEDIS byzcoin.
- BYZCOIN_ID=9cc36071ccb902a1de7e0d21a2c176d73894b1cf88ae4cc2ba4c95cd76f474f3
# How much debugging output - 0 is none, 1 is important ones, 2 is
# interesting, 3 is detailed, 4 is lots of details, and 5 is too detailed for
# most purposes.
- DEBUG_LVL=2
# Whether to niceify the debug outputs. If you put this to `true`, you should
# have a black background in the terminal.
- DEBUG_COLOR=false
# If set to true, adds a timestamp to each log-message
- DEBUG_TIME=true
# Send the logging information to a graylog instance. Optional, can be put to
# "" if not needed.
- GRAYLOG=
# Send tracing information to honeycomb.io. The format is: api_key:dataset.
# If no key is set, tracing is disabled.
- HONEYCOMB_API_KEY=
ports:
- "7770-7771:7770-7771"
image: c4dt/byzcoin:latest
volumes:
# Where the byzcoin data resides on the host. Do not change the :/byzcoin
# part, only the ~/byzcoin.
- ~/byzcoin:/byzcoin
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "4"
restart: unless-stopped
watchtower:
image: containrrr/watchtower:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 3600 --label-enable --cleanup
102 changes: 52 additions & 50 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
version: "3.0"
version: "3.8"

services:
byzcoin:
environment:
# ADDRESS_NODE should always be tls:// - tcp:// is insecure and should
# not be used.
- ADDRESS_NODE=tls://byzcoin.c4dt.org:7770
# ADDRESS_WS can be either http:// or https:// - for most of the use-cases
# you want this to be https://, so that secure webpages can access the node.
- ADDRESS_WS=http://byzcoin.c4dt.org:7771
# A short description of your node that will be visible to the outside.
- DESCRIPTION=New ByzCoin node
# Whether to use TLS in the conodes. It is tested against 'false'. So
# anything different from 'false' will be interpreted as true.
- USE_TLS=false
# WS_SSL_* is ignored if ADDRESS_WS is http or USE_TLS=false. These files
# need to be in the ~/byzcoin directory before the node is started.
- WS_SSL_CHAIN=fullchain.pem
- WS_SSL_KEY=privkey.pem
# ID of the byzcoin to follow - this corresponds to the DEDIS byzcoin.
- BYZCOIN_ID=9cc36071ccb902a1de7e0d21a2c176d73894b1cf88ae4cc2ba4c95cd76f474f3
# How much debugging output - 0 is none, 1 is important ones, 2 is
# interesting, 3 is detailed, 4 is lots of details, and 5 is too detailed for
# most purposes.
- DEBUG_LVL=2
# Whether to niceify the debug outputs. If you put this to `true`, you should
# have a black background in the terminal.
- DEBUG_COLOR=false
# If set to true, adds a timestamp to each log-message
- DEBUG_TIME=true
# Send the logging information to a graylog instance. Optional, can be put to
# "" if not needed.
- GRAYLOG=
# Send tracing information to honeycomb.io. The format is: api_key:dataset.
# If no key is set, tracing is disabled.
- HONEYCOMB_API_KEY=
node-1:
image: ghcr.io/c4dt/byzcoin:latest
build:
context: ./
dockerfile: Dockerfile
target: byzcoin
args:
DOCKER_BUILDKIT: 1
platform: linux/amd64
ports:
- "7770-7771:7770-7771"
image: c4dt/byzcoin:latest
- "7770-7777:7770-7777"
- "8080:3000"
environment:
- NODE=1
volumes:
# Where the byzcoin data resides on the host. Do not change the :/byzcoin
# part, only the ~/byzcoin.
- ~/byzcoin:/byzcoin
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "4"
restart: unless-stopped
watchtower:
image: containrrr/watchtower:latest
- ./nodes/node-1:/byzcoin

node-2:
image: ghcr.io/c4dt/byzcoin:latest
platform: linux/amd64
environment:
- NODE=2
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 3600 --label-enable --cleanup
- ./nodes/node-2:/byzcoin
network_mode: "service:node-1"

node-3:
image: ghcr.io/c4dt/byzcoin:latest
platform: linux/amd64
environment:
- NODE=3
volumes:
- ./nodes/node-3:/byzcoin
network_mode: "service:node-1"

node-4:
image: ghcr.io/c4dt/byzcoin:latest
platform: linux/amd64
environment:
- NODE=4
volumes:
- ./nodes/node-4:/byzcoin
network_mode: "service:node-1"

login:
image: ghcr.io/c4dt/byzcoin-web:latest
platform: linux/amd64
build:
context: ./
dockerfile: Dockerfile
target: web
args:
DOCKER_BUILDKIT: 1
network_mode: "service:node-1"
Loading

0 comments on commit 787289a

Please sign in to comment.