From 11d28995f6ca4877dd9e036701440ea82610f498 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Fri, 22 Jul 2022 16:55:40 -0400 Subject: [PATCH] add version and windows fixes --- .gitattributes | 2 ++ Dockerfile => Dockerfile.unix | 0 Dockerfile.win | 41 +++++++++++++++++++++++++++++++++++ bootstrap.sh | 2 +- src/dune/__main__.py | 4 ++++ src/dune/args.py | 1 + src/dune/dune.py | 12 ++++++++++ 7 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .gitattributes rename Dockerfile => Dockerfile.unix (100%) create mode 100644 Dockerfile.win diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1312090 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto +*.sh text eol=lf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile.unix similarity index 100% rename from Dockerfile rename to Dockerfile.unix diff --git a/Dockerfile.win b/Dockerfile.win new file mode 100644 index 0000000..ccba8b9 --- /dev/null +++ b/Dockerfile.win @@ -0,0 +1,41 @@ +# syntax=docker/dockerfile:1 +FROM ubuntu:20.04 + +ARG USER_ID +ARG GROUP_ID + +RUN apt-get update +RUN apt-get update --fix-missing +RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata +RUN apt-get -y install zip unzip libncurses5 wget git build-essential cmake curl libboost-all-dev libcurl4-openssl-dev libgmp-dev libssl-dev libusb-1.0.0-dev libzstd-dev time pkg-config llvm-11-dev nginx npm yarn jq gdb lldb +RUN npm install -D webpack-cli +RUN npm install -D webpack +RUN npm install -D webpack-dev-server + +WORKDIR /app + +COPY ./scripts/ . +RUN chmod +x bootstrap_env.sh +RUN chmod +x start_node.sh +RUN chmod +x setup_system.sh +RUN chmod +x write_context.sh +RUN mv my_init /sbin + +RUN ./bootstrap_env.sh +RUN ./setup_system.sh + +RUN mkdir /home/www-data/nodes +RUN cp /app/config.ini /home/www-data/config.ini + +# thanks to github.com/phusion +# this should solve reaping issues of stopped nodes +CMD ["/sbin/my_init"] + +# port for nodeos p2p +EXPOSE 9876 +# port for nodeos http +EXPOSE 8888 +# port for state history +EXPOSE 8080 +# port for webapp +EXPOSE 8000 diff --git a/bootstrap.sh b/bootstrap.sh index 3d914ec..57406ca 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -7,4 +7,4 @@ GROUP_ID=$(id -g ${USER}) if [[ $(uname) == "Darwin" ]]; then GROUP_ID=200 fi -docker build --no-cache --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=${GROUP_ID} -t dune $SDIR +docker build --no-cache --build-arg USER_ID=$(id -u ${USER}) --build-arg GROUP_ID=${GROUP_ID} -f Dockerfile.unix -t dune $SDIR diff --git a/src/dune/__main__.py b/src/dune/__main__.py index 969c004..8d6ad1e 100644 --- a/src/dune/__main__.py +++ b/src/dune/__main__.py @@ -2,6 +2,7 @@ from dune import node from dune import dune_error from dune import dune_node_not_found +from dune import version_full from args import arg_parser from args import parse_optional @@ -128,6 +129,9 @@ elif args.get_table != None: dune_sys.get_table(args.get_table[0], args.get_table[1], args.get_table[2]) + elif args.version: + print ("DUNE "+version_full()) + except KeyboardInterrupt: pass except dune_node_not_found as err: diff --git a/src/dune/args.py b/src/dune/args.py index 431dc50..37a5581 100644 --- a/src/dune/args.py +++ b/src/dune/args.py @@ -76,6 +76,7 @@ def __init__(self): self._parser.add_argument('--get-table', nargs=3, metavar=["ACCOUNT", "SCOPE", "TABLE"], help='get the data from the given table') self._parser.add_argument('--activate-feature', metavar=["CODENAME"], help='active protocol feature') self._parser.add_argument('--list-features', action='store_true', help='list available protocol feature code names') + self._parser.add_argument('--version', action='store_true', help='display the current version of DUNE') self._parser.add_argument('remainder', nargs=argparse.REMAINDER) # used to store arguments to individual programs, starting with -- #TODO readdress after the launch #self._parser.add_argument('--start-webapp', metavar=["DIR"], help='start a webapp with ') diff --git a/src/dune/dune.py b/src/dune/dune.py index bcb47fe..6df6744 100644 --- a/src/dune/dune.py +++ b/src/dune/dune.py @@ -2,6 +2,18 @@ from context import context import os, platform, getpass + +# VERSION INFORMATION +def version_major(): + return 1 +def version_minor(): + return 0 +def version_patch(): + return 0 +def version_suffix(): + return "rc1" +def version_full(): + return "v"+str(version_major())+"."+str(version_minor())+"."+str(version_patch())+"."+version_suffix() class dune_error(Exception): pass class dune_node_not_found(dune_error):