fix(core): update

This commit is contained in:
Philipp Kunz 2019-06-07 13:13:11 +02:00
commit a0a6d57c9f
6 changed files with 173 additions and 0 deletions

52
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,52 @@
# gitzone ci_docker
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci-cache/
key: "$CI_BUILD_STAGE"
before_script:
- npmci npm prepare
stages:
- test
- release
- trigger
- pages
testSTABLE:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:dind
stage: release
script:
- npmci node install stable
- npmci docker login
- npmci docker build
- npmci docker test
- npmci docker push registry.gitlab.com
only:
- tags
tags:
- docker
- priv
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
FROM ubuntu:18.04
RUN apt-get update &&\
apt-get install -y git curl bzip2 nginx sudo nano &&\
useradd -ms /bin/bash cardano &&\
mkdir -m 0755 /nix &&\
chown cardano /nix &&\
mkdir -p /etc/nix &&\
echo sandbox = false >> /etc/nix/nix.conf &&\
echo binary-caches = https://cache.nixos.org https://hydra.iohk.io >> /etc/nix/nix.conf &&\
echo binary-cache-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= >> /etc/nix/nix.conf &&\
su - cardano -c 'git clone https://github.com/input-output-hk/cardano-sl.git /home/cardano/cardano-sl'
RUN cat /etc/nix/nix.conf
ADD default.conf /etc/nginx/conf.d/
ADD start-cardano-container.sh /home/cardano/cardano-sl/
RUN chmod a+x /home/cardano/cardano-sl/start-cardano-container.sh
RUN echo "cardano ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER cardano
ENV USER cardano
RUN curl https://nixos.org/nix/install | sh
WORKDIR /home/cardano/cardano-sl
RUN git checkout tags/3.0.1
RUN . /home/cardano/.nix-profile/etc/profile.d/nix.sh &&\
nix-build -A connectScripts.mainnet.wallet -o connect-to-mainnet
CMD /home/cardano/cardano-sl/start-cardano-container.sh

4
README.md Normal file
View File

@ -0,0 +1,4 @@
This repository contains a Dockerfile used to build a docker image of the Cardano SL node with wallet features.
For more informations read https://cardanodocs.com/introduction/

50
connect-to-mainnet Normal file
View File

@ -0,0 +1,50 @@
#!/nix/store/zqh3l3lyw32q1ayb15bnvg9f24j5v2p0-bash-4.4-p12/bin/bash -e
if [[ "$1" == "--delete-state" ]]; then
echo "Deleting state-wallet-mainnet ... "
rm -Rf state-wallet-mainnet
shift
fi
if [[ "$1" == "--runtime-args" ]]; then
RUNTIME_ARGS=$2
shift 2
else
RUNTIME_ARGS=""
fi
echo "Keeping state in state-wallet-mainnet"
mkdir -p state-wallet-mainnet/logs
echo "Launching a node connected to 'mainnet' ..."
export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8
if [ ! -d state-wallet-mainnet/tls ]; then
mkdir -p state-wallet-mainnet/tls/server && mkdir -p state-wallet-mainnet/tls/client
/nix/store/q6ji7sdkrw00cdmqvcxdi41xsab5v9f5-cardano-sl-tools-1.3.0/bin/cardano-x509-certificates \
--server-out-dir state-wallet-mainnet/tls/server \
--clients-out-dir state-wallet-mainnet/tls/client \
--configuration-key mainnet_full \
--configuration-file /nix/store/49jpvj5znnnbw2b326bc7dbcvhsfpm13-cardano-sl-config/lib/configuration.yaml
fi
exec /nix/store/g1z2splkx9wb0sgyj1yn8gba1f4ic3sg-cardano-sl-wallet-new-1.3.0/bin/cardano-node \
--configuration-file /nix/store/49jpvj5znnnbw2b326bc7dbcvhsfpm13-cardano-sl-config/lib/configuration.yaml \
--configuration-key mainnet_full \
--tlscert state-wallet-mainnet/tls/server/server.crt \
--tlskey state-wallet-mainnet/tls/server/server.key \
--tlsca state-wallet-mainnet/tls/server/ca.crt \
--log-config /nix/store/49jpvj5znnnbw2b326bc7dbcvhsfpm13-cardano-sl-config/log-configs/connect-to-cluster.yaml \
--topology "/nix/store/qslalll5z2cyf7cl9ysiv6by4g6arvfx-topology-mainnet" \
--logs-prefix "state-wallet-mainnet/logs" \
--db-path "state-wallet-mainnet/db" \
--wallet-db-path 'state-wallet-mainnet/wallet-db' \
\
\
--keyfile state-wallet-mainnet/secret.key \
--wallet-address localhost:8090 \
--wallet-doc-address localhost:8091 \
--ekg-server localhost:8000 --metrics \
+RTS -N2 -qg -A1m -I0 -T -RTS \
\
$RUNTIME_ARGS

21
default.conf Normal file
View File

@ -0,0 +1,21 @@
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://localhost:8090/;
}
}
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /home/cardano/cardano-sl/state-wallet-mainnet/tls/server/server.crt;
ssl_certificate_key /home/cardano/cardano-sl/state-wallet-mainnet/tls/server/server.key;
#ssl_client_certificate /home/cardano/cardano-sl/state-wallet-mainnet/tls/server/ca.crt;
location / {
proxy_pass http://localhost:8090/;
}
}

View File

@ -0,0 +1,14 @@
#!/bin/bash
echo "Docker container ::: Starting node cardano-sl, wallet mode"
# remove default nginx config
sudo rm -f /etc/nginx/sites-enabled/default
# try to remove lock file from previous execution
sudo rm -f /home/cardano/cardano-sl/state-wallet-mainnet/wallet-db/open.lock
# restart nginx service in bg, give 10 sec that cardano node create ssl certif.
sleep 10 && sudo /usr/sbin/service nginx restart && echo "Docker container ::: Nginx service restarted" &
# start node
sudo /home/cardano/cardano-sl/connect-to-mainnet --runtime-args --no-tls