zrpc-docker - Zenith RPC server
- Docker Image distribution bundle generation
This commit is contained in:
parent
7189ddcb2a
commit
f5f1eddc59
18 changed files with 464 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@ zenith.db
|
||||||
zenith.log
|
zenith.log
|
||||||
zenith.db-shm
|
zenith.db-shm
|
||||||
zenith.db-wal
|
zenith.db-wal
|
||||||
|
docker_files/zenithrpc-docker_0.7.0.0.7z
|
||||||
|
docker_files/zenithrpc-docker_0.7.0.0/
|
||||||
|
|
|
@ -17,13 +17,13 @@ import Zenith.Types (Config(..))
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
config <- load ["$(HOME)/Zenith/zenith.cfg"]
|
config <- load ["$(HOME)/Zenith/zenith.cfg"]
|
||||||
dbFilePath <- require config "dbFilePath"
|
dbFileName <- require config "dbFileName"
|
||||||
nodeUser <- require config "nodeUser"
|
nodeUser <- require config "nodeUser"
|
||||||
nodePwd <- require config "nodePwd"
|
nodePwd <- require config "nodePwd"
|
||||||
zebraPort <- require config "zebraPort"
|
zebraPort <- require config "zebraPort"
|
||||||
zebraHost <- require config "zebraHost"
|
zebraHost <- require config "zebraHost"
|
||||||
nodePort <- require config "nodePort"
|
nodePort <- require config "nodePort"
|
||||||
let myConfig = Config dbFilePath zebraHost zebraPort nodeUser nodePwd nodePort
|
let myConfig = Config dbFileName zebraHost zebraPort nodeUser nodePwd nodePort
|
||||||
let ctx = authenticate myConfig :. EmptyContext
|
let ctx = authenticate myConfig :. EmptyContext
|
||||||
w <- try $ checkZebra zebraHost zebraPort :: IO (Either IOError ZebraGetInfo)
|
w <- try $ checkZebra zebraHost zebraPort :: IO (Either IOError ZebraGetInfo)
|
||||||
case w of
|
case w of
|
||||||
|
@ -34,17 +34,17 @@ main = do
|
||||||
case bc of
|
case bc of
|
||||||
Left e1 -> throwIO e1
|
Left e1 -> throwIO e1
|
||||||
Right chainInfo -> do
|
Right chainInfo -> do
|
||||||
x <- initDb dbFilePath
|
x <- initDb dbFileName
|
||||||
case x of
|
case x of
|
||||||
Left e2 -> throwIO $ userError e2
|
Left e2 -> throwIO $ userError e2
|
||||||
Right x' -> do
|
Right x' -> do
|
||||||
when x' $ rescanZebra zebraHost zebraPort dbFilePath
|
when x' $ rescanZebra zebraHost zebraPort dbFileName
|
||||||
let myState =
|
let myState =
|
||||||
State
|
State
|
||||||
(zgb_net chainInfo)
|
(zgb_net chainInfo)
|
||||||
zebraHost
|
zebraHost
|
||||||
zebraPort
|
zebraPort
|
||||||
dbFilePath
|
dbFileName
|
||||||
(zgi_build zebra)
|
(zgi_build zebra)
|
||||||
(zgb_blocks chainInfo)
|
(zgb_blocks chainInfo)
|
||||||
run nodePort $
|
run nodePort $
|
||||||
|
|
48
docker_files/Dockerfile
Normal file
48
docker_files/Dockerfile
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# =====================================================
|
||||||
|
# Zenith RPC Server Image
|
||||||
|
# =====================================================
|
||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
RUN apt update
|
||||||
|
|
||||||
|
# Set environment variables to non-interactive mode for installation
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Update the package list and install necessary packages
|
||||||
|
|
||||||
|
RUN apt-get install -y \
|
||||||
|
libsecp256k1-dev \
|
||||||
|
libglew-dev \
|
||||||
|
libsdl2-dev
|
||||||
|
|
||||||
|
RUN apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create a new user (e.g., "zenusr") and set a password
|
||||||
|
RUN useradd -ms /bin/bash zenusr
|
||||||
|
RUN echo "1234\n1234\n" | passwd zenusr
|
||||||
|
|
||||||
|
RUN mkdir /home/zenusr/Zenith
|
||||||
|
RUN chown zenusr:zenusr -R /home/zenusr/Zenith
|
||||||
|
|
||||||
|
COPY scripts/bash_rc_adm /root/.bashrc
|
||||||
|
COPY scripts/bash_rc_usr /home/zenusr/.bashrc
|
||||||
|
COPY scripts/welcome.sh /etc/profile.d/welcome.sh
|
||||||
|
RUN chmod +x /etc/profile.d/welcome.sh
|
||||||
|
COPY bin/zenithserver /usr/local/bin
|
||||||
|
COPY bin/startrpc /usr/local/bin
|
||||||
|
COPY lib/librustzcash_wrapper.so /usr/local/lib
|
||||||
|
COPY Downloads/libc-bin_2.38-1ubuntu6_amd64.deb /home/zenusr/Downloads/
|
||||||
|
COPY Downloads/libc-dev-bin_2.38-1ubuntu6_amd64.deb /home/zenusr/Downloads/
|
||||||
|
COPY Downloads/libc6_2.38-1ubuntu6_amd64.deb /home/zenusr/Downloads/
|
||||||
|
|
||||||
|
RUN echo '#!/bin/bash\ncd /home/zenusr/Downloads\ndpkg -i libc6_2.38-1ubuntu6_amd64.deb libc-bin_2.38-1ubuntu6_amd64.deb libc-dev-bin_2.38-1ubuntu6_amd64.deb' > /usr/local/bin/updlibc
|
||||||
|
RUN chmod +x /usr/local/bin/updlibc
|
||||||
|
RUN updlibc
|
||||||
|
|
||||||
|
# Set the user to "zenusr"
|
||||||
|
USER zenusr
|
||||||
|
WORKDIR /home/zenusr
|
||||||
|
ENV USER=zenusr
|
||||||
|
|
||||||
|
CMD ["startrpc"]
|
BIN
docker_files/Downloads/libc-bin_2.38-1ubuntu6_amd64.deb
Normal file
BIN
docker_files/Downloads/libc-bin_2.38-1ubuntu6_amd64.deb
Normal file
Binary file not shown.
BIN
docker_files/Downloads/libc-dev-bin_2.38-1ubuntu6_amd64.deb
Normal file
BIN
docker_files/Downloads/libc-dev-bin_2.38-1ubuntu6_amd64.deb
Normal file
Binary file not shown.
BIN
docker_files/Downloads/libc6_2.38-1ubuntu6_amd64.deb
Normal file
BIN
docker_files/Downloads/libc6_2.38-1ubuntu6_amd64.deb
Normal file
Binary file not shown.
6
docker_files/bin/startrpc
Executable file
6
docker_files/bin/startrpc
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
if [ x"${EXPERT_MODE}" == "x" ]; then
|
||||||
|
zenithserver
|
||||||
|
else
|
||||||
|
/bin/bash -l
|
||||||
|
fi
|
BIN
docker_files/bin/zenithserver
Executable file
BIN
docker_files/bin/zenithserver
Executable file
Binary file not shown.
43
docker_files/cfg/runzenithrpc
Executable file
43
docker_files/cfg/runzenithrpc
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
ZFOLDER=~/Zenith
|
||||||
|
IMAGE_NAME=zenithrpc-docker:0.7.0.0
|
||||||
|
|
||||||
|
for i in "$@"
|
||||||
|
do case $i in
|
||||||
|
-e=*|--expert=*)
|
||||||
|
EXPERTMODE="1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
EXPERTMODE="0"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if docker engine is running
|
||||||
|
if ! systemctl is-active --quiet docker ; then
|
||||||
|
echo "Docker is not active/installed, "
|
||||||
|
echo "Please activate docker before proceeding!!."
|
||||||
|
echo "Aborting process..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if data folder exists
|
||||||
|
if [ ! -d "$ZFOLDER" ]; then
|
||||||
|
echo "Error starting Zenith RPC server image"
|
||||||
|
echo "Zenith configurtion and data folder ($ZFOLDER) does not exists."
|
||||||
|
echo "Aborting process..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the image exists locally
|
||||||
|
if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ]]; then
|
||||||
|
echo "Error starting Zenith RPC server image"
|
||||||
|
echo "Image $IMAGE_NAME not found locally."
|
||||||
|
echo "Aborting process..."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start image in detached mode
|
||||||
|
docker run --rm -d --mount src=$ZFOLDER,target=/home/zenusr/Zenith,type=bind --net=host --env EXPERT_MODE=$EXPERTMODE $IMAGE_NAME
|
||||||
|
|
||||||
|
# End
|
5
docker_files/cfg/zenith.cfg
Normal file
5
docker_files/cfg/zenith.cfg
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
nodeUser = "user"
|
||||||
|
nodePwd = "superSecret"
|
||||||
|
dbFileName = "zenith.db"
|
||||||
|
zebraHost = "127.0.0.1"
|
||||||
|
zebraPort = 18232
|
59
docker_files/dockerpkg
Executable file
59
docker_files/dockerpkg
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
ZVERSION="0.7.0.0"
|
||||||
|
echo "Docker image package generator"
|
||||||
|
echo
|
||||||
|
if ! systemctl is-active --quiet docker ; then
|
||||||
|
echo "Docker is not active/installed, "
|
||||||
|
echo "Please activate docker before proceeding!!."
|
||||||
|
echo
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
echo "Updating docker binary files ...."
|
||||||
|
echo
|
||||||
|
echo "... copying zenith server to ./bin folder"
|
||||||
|
cp "../dist-newstyle/build/x86_64-linux/ghc-9.6.5/zenith-"$ZVERSION"/build/zenithserver/zenithserver" "bin/"
|
||||||
|
echo "... copying librustzcash_wrapper.so to ./lib folder"
|
||||||
|
cp "../zcash-haskell/librustzcash-wrapper/target/x86_64-unknown-linux-gnu/debug/librustzcash_wrapper.so" "lib/"
|
||||||
|
echo
|
||||||
|
|
||||||
|
read -r -p "Do you want to create the docker image? [Y/n] " response
|
||||||
|
case "$response" in
|
||||||
|
[yY])
|
||||||
|
if docker image ls | grep -q "zenithrpc-docker" ; then
|
||||||
|
echo "... removing previous docker image"
|
||||||
|
docker rmi -f "zenithrpc-docker:"$ZVERSION
|
||||||
|
fi
|
||||||
|
echo "... creating zenithrpc-docker:"$ZVERSION" image"
|
||||||
|
docker build -t "zenithrpc-docker:"$ZVERSION .
|
||||||
|
echo "... docker image zenithrpc-docker:"$ZVERSION" created."
|
||||||
|
echo "... exporting zenithrpc-docker:"$ZVERSION" as .tar file"
|
||||||
|
docker save -o zenithrpc-docker_$ZVERSION.tar zenithrpc-docker:$ZVERSION
|
||||||
|
echo "... zenithrpc-docker:"$ZVERSION" image ready."
|
||||||
|
echo "... creating distribution package file "
|
||||||
|
if [ -d zenithrpc-docker_$ZVERSION ]; then
|
||||||
|
rm -rf zenithrpc-docker_$ZVERSION
|
||||||
|
fi
|
||||||
|
echo "... creating distribution folder "
|
||||||
|
mkdir zenithrpc-docker_$ZVERSION
|
||||||
|
echo "... copying setup_docker script"
|
||||||
|
chmod +x setup_docker
|
||||||
|
cp setup_docker zenithrpc-docker_$ZVERSION/
|
||||||
|
chmod -x setup_docker
|
||||||
|
echo "... copying cfg folder"
|
||||||
|
cp -r cfg zenithrpc-docker_$ZVERSION/
|
||||||
|
echo "... moving docker image to distribution folder"
|
||||||
|
mv zenithrpc-docker_$ZVERSION.tar zenithrpc-docker_$ZVERSION/
|
||||||
|
if [ -f zenithrpc-docker_$ZVERSION.7z ]; then
|
||||||
|
rm zenithrpc-docker_$ZVERSION.7z
|
||||||
|
fi
|
||||||
|
echo "... creating distribution package zenithrpc-docker_$ZVERSION.7z "
|
||||||
|
7z a zenithrpc-docker_$ZVERSION.7z zenithrpc-docker_$ZVERSION
|
||||||
|
echo "... distribution file created. (zenithrpc-docker_$ZVERSION.tar.gz)"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "... docker image not created."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo
|
||||||
|
echo "Done "
|
||||||
|
echo
|
BIN
docker_files/lib/librustzcash_wrapper.so
Executable file
BIN
docker_files/lib/librustzcash_wrapper.so
Executable file
Binary file not shown.
BIN
docker_files/lib/sapling-output.params
Normal file
BIN
docker_files/lib/sapling-output.params
Normal file
Binary file not shown.
BIN
docker_files/lib/sapling-spend.params
Normal file
BIN
docker_files/lib/sapling-spend.params
Normal file
Binary file not shown.
100
docker_files/scripts/bash_rc_adm
Normal file
100
docker_files/scripts/bash_rc_adm
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||||
|
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||||
|
# for examples
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything
|
||||||
|
[ -z "$PS1" ] && return
|
||||||
|
|
||||||
|
# don't put duplicate lines in the history. See bash(1) for more options
|
||||||
|
# ... or force ignoredups and ignorespace
|
||||||
|
HISTCONTROL=ignoredups:ignorespace
|
||||||
|
|
||||||
|
# append to the history file, don't overwrite it
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||||
|
HISTSIZE=1000
|
||||||
|
HISTFILESIZE=2000
|
||||||
|
|
||||||
|
# check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||||
|
|
||||||
|
# set variable identifying the chroot you work in (used in the prompt below)
|
||||||
|
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
||||||
|
debian_chroot=$(cat /etc/debian_chroot)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||||
|
case "$TERM" in
|
||||||
|
xterm-color) color_prompt=yes;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||||
|
# off by default to not distract the user: the focus in a terminal window
|
||||||
|
# should be on the output of commands, not on the prompt
|
||||||
|
#force_color_prompt=yes
|
||||||
|
|
||||||
|
if [ -n "$force_color_prompt" ]; then
|
||||||
|
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||||
|
# We have color support; assume it's compliant with Ecma-48
|
||||||
|
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||||
|
# a case would tend to support setf rather than setaf.)
|
||||||
|
color_prompt=yes
|
||||||
|
else
|
||||||
|
color_prompt=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$color_prompt" = yes ]; then
|
||||||
|
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||||
|
else
|
||||||
|
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||||
|
fi
|
||||||
|
unset color_prompt force_color_prompt
|
||||||
|
|
||||||
|
# If this is an xterm set the title to user@host:dir
|
||||||
|
case "$TERM" in
|
||||||
|
xterm*|rxvt*)
|
||||||
|
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# enable color support of ls and also add handy aliases
|
||||||
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
#alias dir='dir --color=auto'
|
||||||
|
#alias vdir='vdir --color=auto'
|
||||||
|
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# some more ls aliases
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
|
|
||||||
|
# Alias definitions.
|
||||||
|
# You may want to put all your additions into a separate file like
|
||||||
|
# ~/.bash_aliases, instead of adding them here directly.
|
||||||
|
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||||
|
|
||||||
|
if [ -f ~/.bash_aliases ]; then
|
||||||
|
. ~/.bash_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
|
# enable programmable completion features (you don't need to enable
|
||||||
|
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||||
|
# sources /etc/bash.bashrc).
|
||||||
|
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||||
|
# . /etc/bash_completion
|
||||||
|
#fi
|
||||||
|
export LD_LIBRARY_PATH=/usr/local/lib
|
118
docker_files/scripts/bash_rc_usr
Normal file
118
docker_files/scripts/bash_rc_usr
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||||
|
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||||
|
# for examples
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything
|
||||||
|
case $- in
|
||||||
|
*i*) ;;
|
||||||
|
*) return;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# don't put duplicate lines or lines starting with space in the history.
|
||||||
|
# See bash(1) for more options
|
||||||
|
HISTCONTROL=ignoreboth
|
||||||
|
|
||||||
|
# append to the history file, don't overwrite it
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||||
|
HISTSIZE=1000
|
||||||
|
HISTFILESIZE=2000
|
||||||
|
|
||||||
|
# check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
# If set, the pattern "**" used in a pathname expansion context will
|
||||||
|
# match all files and zero or more directories and subdirectories.
|
||||||
|
#shopt -s globstar
|
||||||
|
|
||||||
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||||
|
|
||||||
|
# set variable identifying the chroot you work in (used in the prompt below)
|
||||||
|
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||||
|
debian_chroot=$(cat /etc/debian_chroot)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||||
|
case "$TERM" in
|
||||||
|
xterm-color|*-256color) color_prompt=yes;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||||
|
# off by default to not distract the user: the focus in a terminal window
|
||||||
|
# should be on the output of commands, not on the prompt
|
||||||
|
#force_color_prompt=yes
|
||||||
|
|
||||||
|
if [ -n "$force_color_prompt" ]; then
|
||||||
|
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||||
|
# We have color support; assume it's compliant with Ecma-48
|
||||||
|
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||||
|
# a case would tend to support setf rather than setaf.)
|
||||||
|
color_prompt=yes
|
||||||
|
else
|
||||||
|
color_prompt=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$color_prompt" = yes ]; then
|
||||||
|
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||||
|
else
|
||||||
|
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||||
|
fi
|
||||||
|
unset color_prompt force_color_prompt
|
||||||
|
|
||||||
|
# If this is an xterm set the title to user@host:dir
|
||||||
|
case "$TERM" in
|
||||||
|
xterm*|rxvt*)
|
||||||
|
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# enable color support of ls and also add handy aliases
|
||||||
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
#alias dir='dir --color=auto'
|
||||||
|
#alias vdir='vdir --color=auto'
|
||||||
|
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# colored GCC warnings and errors
|
||||||
|
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||||
|
|
||||||
|
# some more ls aliases
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
|
|
||||||
|
# Add an "alert" alias for long running commands. Use like so:
|
||||||
|
# sleep 10; alert
|
||||||
|
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||||
|
|
||||||
|
# Alias definitions.
|
||||||
|
# You may want to put all your additions into a separate file like
|
||||||
|
# ~/.bash_aliases, instead of adding them here directly.
|
||||||
|
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||||
|
|
||||||
|
if [ -f ~/.bash_aliases ]; then
|
||||||
|
. ~/.bash_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
|
# enable programmable completion features (you don't need to enable
|
||||||
|
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||||
|
# sources /etc/bash.bashrc).
|
||||||
|
if ! shopt -oq posix; then
|
||||||
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
|
. /usr/share/bash-completion/bash_completion
|
||||||
|
elif [ -f /etc/bash_completion ]; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
export LD_LIBRARY_PATH=/usr/local/lib
|
8
docker_files/scripts/welcome.sh
Normal file
8
docker_files/scripts/welcome.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo
|
||||||
|
echo "============================================="
|
||||||
|
echo "Welcome to Zenith RPC seerver enviroment"
|
||||||
|
echo "v0.7.0.0"
|
||||||
|
echo "Vergara Technologies LLC"
|
||||||
|
echo "============================================="
|
||||||
|
echo
|
70
docker_files/setup_docker
Normal file
70
docker_files/setup_docker
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
ZVERSION="0.7.0.0"
|
||||||
|
echo
|
||||||
|
echo "Zenith RPC Server Image Setup"
|
||||||
|
echo
|
||||||
|
echo "... testing if docker service is active.."
|
||||||
|
if systemctl is-active --quiet docker; then
|
||||||
|
echo "... Docker service active"
|
||||||
|
echo
|
||||||
|
if [ -d $HOME"/Zenith" ]; then
|
||||||
|
echo "Warning: Zenith Server configuration already exist, this procedure will create"
|
||||||
|
echo " a new configuration file. Your previous configurarion "
|
||||||
|
echo " will be saved as 'previous-zenith.cfg'. (a Backup is recommended)."
|
||||||
|
echo
|
||||||
|
read -r -p "Do you want to proceed ? [Y/n] " response
|
||||||
|
case "$response" in
|
||||||
|
[yY])
|
||||||
|
if [ -f $HOME/Zenith/previous-zenith.cfg ]; then
|
||||||
|
rm $HOME/Zenith/previous-zenith.cfg
|
||||||
|
fi
|
||||||
|
mv $HOME/Zenith/zenith.cfg $HOME/Zenith/previous-zenith.cfg
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "... Zenith docker image setup not completed."
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "... creating Zenith folder"
|
||||||
|
mkdir -p $HOME/Zenith/assets
|
||||||
|
fi
|
||||||
|
if docker image ls | grep -q "zenithrpc-docker" ; then
|
||||||
|
echo "... removing previous docker image"
|
||||||
|
docker rmi -f "zenithrpc-docker:"$ZVERSION
|
||||||
|
fi
|
||||||
|
echo "... loading zenithrpc-docker:"$ZVERSION" image"
|
||||||
|
docker load < zenithrpc-docker_$ZVERSION.tar
|
||||||
|
echo "... docker image zenithrpc-docker:"$ZVERSION" loaded."
|
||||||
|
echo "... creating default configuration"
|
||||||
|
cp cfg/zenith.cfg $HOME/Zenith/
|
||||||
|
echo "... copying zenith assets to Zenith folder."
|
||||||
|
cp -r cfg/assets $HOME/Zenith/assets
|
||||||
|
if ! [ -d $HOME/.local/bin ]; then
|
||||||
|
echo "... creating $HOME/.local/bin folder"
|
||||||
|
mkdir -p $HOME/.local/bin
|
||||||
|
else
|
||||||
|
echo "... $HOME/.local/bin exists"
|
||||||
|
fi
|
||||||
|
if [ -f $HOME/.local/bin/runzenithrpc ]; then
|
||||||
|
rm $HOME/.local/bin/runzenithrpc
|
||||||
|
fi
|
||||||
|
echo "... copying runzenithrpc to $HOME/.local/bin"
|
||||||
|
cp cfg/runzenithrpc $HOME/.local/bin/
|
||||||
|
if ! echo $PATH | grep -q $HOME/.local/bin ; then
|
||||||
|
echo PATH=$PATH:$HOME/.local/bin | tee -a $HOME/.bashrc
|
||||||
|
echo "... reloading configuration ...."
|
||||||
|
source $HOME/.bashrc
|
||||||
|
else
|
||||||
|
echo "... PATH=$PATH"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "To start Zenith RPC server execute 'runzenithrpc' from the command line."
|
||||||
|
else
|
||||||
|
echo "... Docker service is not active"
|
||||||
|
echo "... Please activate Docker service first."
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "Done"
|
||||||
|
echo
|
Loading…
Reference in a new issue