zrpc-docker - Milestone 3 -> Docker Image Gerneration
Final version includes : Option for starting GUI Option for starting RPC Server Option for starting expert mode
This commit is contained in:
parent
f5f1eddc59
commit
b142028c9f
31 changed files with 133 additions and 93 deletions
|
@ -1,5 +1,5 @@
|
|||
# =====================================================
|
||||
# Zenith RPC Server Image
|
||||
# Zenith Full Node Wallet and RPC Server
|
||||
# =====================================================
|
||||
FROM ubuntu:22.04
|
||||
|
||||
|
@ -9,9 +9,13 @@ RUN apt update
|
|||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Update the package list and install necessary packages
|
||||
RUN apt-get install -qqy xterm x11-apps
|
||||
|
||||
RUN apt-get install -y \
|
||||
libxss-dev \
|
||||
libxrandr-dev \
|
||||
libsecp256k1-dev \
|
||||
xclip \
|
||||
libglew-dev \
|
||||
libsdl2-dev
|
||||
|
||||
|
@ -29,8 +33,11 @@ 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/zenith /usr/local/bin
|
||||
COPY bin/startzen /usr/local/bin
|
||||
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/
|
||||
|
@ -45,4 +52,4 @@ USER zenusr
|
|||
WORKDIR /home/zenusr
|
||||
ENV USER=zenusr
|
||||
|
||||
CMD ["startrpc"]
|
||||
CMD ["startzen"]
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ x"${EXPERT_MODE}" == "x" ]; then
|
||||
zenithserver
|
||||
else
|
||||
/bin/bash -l
|
||||
fi
|
9
docker_files/bin/startzen
Executable file
9
docker_files/bin/startzen
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
if [ x"${EXPERT_MODE}" == "x0" ] && [ x"${RPC_SERVER}" == "x0" ]; then
|
||||
zenith gui
|
||||
elif [ x"${RPC_SERVER}" == "x1" ] && ( [ x"${EXPERT_MODE}" == "x0" ] || [ x"${EXPERT_MODE}" == "x1" ] ); then
|
||||
zenithserver
|
||||
else
|
||||
# xterm -geometry 90x55 -fs 10 -fa DejaVuSansMono -cr green -bg black -fg lightgray
|
||||
/bin/bash -l
|
||||
fi
|
BIN
docker_files/bin/zenith
Executable file
BIN
docker_files/bin/zenith
Executable file
Binary file not shown.
Binary file not shown.
BIN
docker_files/cfg/assets/1F616_color.png
Normal file
BIN
docker_files/cfg/assets/1F616_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
docker_files/cfg/assets/1F928_color.png
Normal file
BIN
docker_files/cfg/assets/1F928_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
docker_files/cfg/assets/1F993.png
Normal file
BIN
docker_files/cfg/assets/1F993.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
docker_files/cfg/assets/2620_color.png
Normal file
BIN
docker_files/cfg/assets/2620_color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-Bold-102.ttf
Normal file
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-Bold-102.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-BoldItalic-102.ttf
Normal file
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-BoldItalic-102.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-Italic-102.ttf
Normal file
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-Italic-102.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-Regular-102.ttf
Normal file
BIN
docker_files/cfg/assets/Atkinson-Hyperlegible-Regular-102.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/DejaVuSansMono-Bold.ttf
Normal file
BIN
docker_files/cfg/assets/DejaVuSansMono-Bold.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/DejaVuSansMono-BoldOblique.ttf
Normal file
BIN
docker_files/cfg/assets/DejaVuSansMono-BoldOblique.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/DejaVuSansMono-Oblique.ttf
Normal file
BIN
docker_files/cfg/assets/DejaVuSansMono-Oblique.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/DejaVuSansMono.ttf
Normal file
BIN
docker_files/cfg/assets/DejaVuSansMono.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/OpenMoji-color-glyf_colr_1.ttf
Normal file
BIN
docker_files/cfg/assets/OpenMoji-color-glyf_colr_1.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/Roboto-Regular.ttf
Normal file
BIN
docker_files/cfg/assets/Roboto-Regular.ttf
Normal file
Binary file not shown.
BIN
docker_files/cfg/assets/remixicon.ttf
Normal file
BIN
docker_files/cfg/assets/remixicon.ttf
Normal file
Binary file not shown.
65
docker_files/cfg/runzenith
Executable file
65
docker_files/cfg/runzenith
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
ZFOLDER=~/Zenith
|
||||
IMAGE_NAME=zenith-docker:0.7.0.0
|
||||
|
||||
EXPERTMODE="0"
|
||||
RPCSERVER="0"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-e|--expert)
|
||||
EXPERTMODE="1"
|
||||
shift 2
|
||||
break
|
||||
;;
|
||||
-r|--rpc)
|
||||
RPCSERVER="1"
|
||||
shift 2
|
||||
break
|
||||
;;
|
||||
-h|--help)
|
||||
echo
|
||||
echo "======================================================"
|
||||
echo "Zenith Full Node Wallet and RPC server "
|
||||
echo "version 0.7.0.0"
|
||||
echo "======================================================"
|
||||
echo
|
||||
echo "Usage: runzenith"
|
||||
echo " runzenith -e|--expert"
|
||||
echo " runzenith -r|--rpc"
|
||||
echo "Decription"
|
||||
echo " no params -> starts zenith GUI wallet"
|
||||
echo " -e | --expert -> starts zenith in expert mode"
|
||||
echo " -r | --rpc -> starts zenith's rpc server"
|
||||
echo " -h | --help -> displays this screen"
|
||||
echo
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
# Check if data folder exists
|
||||
if [ ! -d "$ZFOLDER" ]; then
|
||||
echo "Error starting Zenith 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 image"
|
||||
echo "Image $IMAGE_NAME not found locally."
|
||||
echo "Aborting process..."
|
||||
exit
|
||||
fi
|
||||
|
||||
docker run --rm -it --mount src=$ZFOLDER,target=/home/zenusr/Zenith,type=bind --net=host --env DISPLAY=$DISPLAY --env EXPERT_MODE=$EXPERTMODE --env RPC_SERVER=$RPCSERVER $IMAGE_NAME
|
||||
|
||||
# End
|
|
@ -1,43 +0,0 @@
|
|||
#!/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
|
|
@ -1,5 +1,6 @@
|
|||
nodeUser = "user"
|
||||
nodePwd = "superSecret"
|
||||
nodePort = 8234
|
||||
dbFileName = "zenith.db"
|
||||
zebraHost = "127.0.0.1"
|
||||
zebraPort = 18232
|
||||
zebraPort = 8232
|
||||
|
|
|
@ -4,14 +4,21 @@ 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 "Please activate docker befor proceed!!."
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
echo "Updating docker binary files ...."
|
||||
echo
|
||||
echo "... copying zenith to ./bin folder"
|
||||
cp "../dist-newstyle/build/x86_64-linux/ghc-9.6.5/zenith-"$ZVERSION"/build/zenith/zenith" "bin/"
|
||||
echo "... copying zenithserver to ./bin folder"
|
||||
cp "../dist-newstyle/build/x86_64-linux/ghc-9.6.5/zenith-"$ZVERSION"/build/zenithserver/zenithserver" "bin/"
|
||||
echo "... copying assets folder to ./cfg folder"
|
||||
if [ -d ./cfg/assets ]; then
|
||||
rm -rf ./cfg/assets
|
||||
fi
|
||||
cp -r "../assets" "cfg/"
|
||||
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
|
||||
|
@ -19,36 +26,36 @@ 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
|
||||
if docker image ls | grep -q "zenith-docker" ; then
|
||||
echo "... removing previous docker image"
|
||||
docker rmi -f "zenithrpc-docker:"$ZVERSION
|
||||
docker rmi -f "zenith-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 zenith-docker:"$ZVERSION" image"
|
||||
docker build -t "zenith-docker:"$ZVERSION .
|
||||
echo "... docker image zenith-docker:"$ZVERSION" created."
|
||||
echo "... exporting zenith-docker:"$ZVERSION" as .tar file"
|
||||
docker save -o zenith-docker_$ZVERSION.tar zenith-docker:$ZVERSION
|
||||
echo "... zenith-docker:"$ZVERSION" image ready."
|
||||
echo "... creating distribution package file "
|
||||
if [ -d zenithrpc-docker_$ZVERSION ]; then
|
||||
rm -rf zenithrpc-docker_$ZVERSION
|
||||
if [ -d zenith-docker_$ZVERSION ]; then
|
||||
rm -rf zenith-docker_$ZVERSION
|
||||
fi
|
||||
echo "... creating distribution folder "
|
||||
mkdir zenithrpc-docker_$ZVERSION
|
||||
mkdir zenith-docker_$ZVERSION
|
||||
echo "... copying setup_docker script"
|
||||
chmod +x setup_docker
|
||||
cp setup_docker zenithrpc-docker_$ZVERSION/
|
||||
cp setup_docker zenith-docker_$ZVERSION/
|
||||
chmod -x setup_docker
|
||||
echo "... copying cfg folder"
|
||||
cp -r cfg zenithrpc-docker_$ZVERSION/
|
||||
cp -r cfg zenith-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
|
||||
mv zenith-docker_$ZVERSION.tar zenith-docker_$ZVERSION/
|
||||
if [ -f zenith-docker_$ZVERSION.7z ]; then
|
||||
rm zenith-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 "... creating distrigution package zenith-docker_$ZVERSION.7z "
|
||||
7z a zenith-docker_$ZVERSION.7z zenith-docker_$ZVERSION
|
||||
echo "... distribution file created. (zenith-docker_$ZVERSION.tar.gz)"
|
||||
;;
|
||||
*)
|
||||
echo "... docker image not created."
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
echo
|
||||
echo "============================================="
|
||||
echo "Welcome to Zenith RPC seerver enviroment"
|
||||
echo "Welcome to Zenith Full Node Wallet enviroment"
|
||||
echo "v0.7.0.0"
|
||||
echo "Vergara Technologies LLC"
|
||||
echo "Expert mode"
|
||||
echo "============================================="
|
||||
echo
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/bash
|
||||
ZVERSION="0.7.0.0"
|
||||
echo
|
||||
echo "Zenith RPC Server Image Setup"
|
||||
echo "Zenith Full Node Wallet and RPC-Server Docker 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 "Warning: Zenith 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
|
||||
|
@ -30,28 +30,28 @@ if systemctl is-active --quiet docker; then
|
|||
echo "... creating Zenith folder"
|
||||
mkdir -p $HOME/Zenith/assets
|
||||
fi
|
||||
if docker image ls | grep -q "zenithrpc-docker" ; then
|
||||
if docker image ls | grep -q "zenith-docker" ; then
|
||||
echo "... removing previous docker image"
|
||||
docker rmi -f "zenithrpc-docker:"$ZVERSION
|
||||
docker rmi -f "zenith-docker:"$ZVERSION
|
||||
fi
|
||||
echo "... loading zenithrpc-docker:"$ZVERSION" image"
|
||||
docker load < zenithrpc-docker_$ZVERSION.tar
|
||||
echo "... docker image zenithrpc-docker:"$ZVERSION" loaded."
|
||||
echo "... loading zenith-docker:"$ZVERSION" image"
|
||||
docker load < zenith-docker_$ZVERSION.tar
|
||||
echo "... docker image zenith-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
|
||||
cp -r cfg/assets $HOME/Zenith
|
||||
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
|
||||
if [ -f $HOME/.local/bin/runzenith ]; then
|
||||
rm $HOME/.local/bin/runzenith
|
||||
fi
|
||||
echo "... copying runzenithrpc to $HOME/.local/bin"
|
||||
cp cfg/runzenithrpc $HOME/.local/bin/
|
||||
echo "... copying runzenith to $HOME/.local/bin"
|
||||
cp cfg/runzenith $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 ...."
|
||||
|
@ -60,7 +60,7 @@ if systemctl is-active --quiet docker; then
|
|||
echo "... PATH=$PATH"
|
||||
fi
|
||||
echo
|
||||
echo "To start Zenith RPC server execute 'runzenithrpc' from the command line."
|
||||
echo "To start zenith execute 'runzenith' from the command line."
|
||||
else
|
||||
echo "... Docker service is not active"
|
||||
echo "... Please activate Docker service first."
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7965dc38c48da348f503a52ee10042fffc43f32c
|
||||
Subproject commit d45bd7dcf3c3cf4e893900a1774d24b14bf56591
|
Loading…
Reference in a new issue