From 36c8cee4d2d76956dd90a8d4d3701da9d6c14d29 Mon Sep 17 00:00:00 2001 From: sahaj05 <135546365+sahaj05@users.noreply.github.com> Date: Mon, 18 Sep 2023 12:49:21 +0530 Subject: [PATCH 01/19] Create Backend-flo.service Content Contains the starting command for backend-flo.service --- Backend-flo.service Content | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Backend-flo.service Content diff --git a/Backend-flo.service Content b/Backend-flo.service Content new file mode 100644 index 0000000..1775be7 --- /dev/null +++ b/Backend-flo.service Content @@ -0,0 +1,42 @@ +[Unit] +Description=Flo backend daemon +After=network.target + +[Service] +ExecStart=/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid +User=flo +Restart=on-failure +TimeoutStopSec=300 +WorkingDirectory=/opt/coins/nodes/flo +Type=forking +RuntimeDirectory=flo +PIDFile=/run/flo/flo.pid + + + +# Resource limits +LimitNOFILE=500000 + +# Hardening measures +#################### + +# Provide a private /tmp and /var/tmp. +PrivateTmp=true + +# Mount /usr, /boot/ and /etc read-only for the process. +ProtectSystem=full + +# Disallow the process and all of its children to gain +# new privileges through execve(). +NoNewPrivileges=true + +# Use a new /dev namespace only populated with API pseudo devices +# such as /dev/null, /dev/zero and /dev/random. +PrivateDevices=true + +# Deny the creation of writable and executable memory mappings. +MemoryDenyWriteExecute=true + + +[Install] +WantedBy=multi-user.target From 45a58f28b4f9943181b66ac0fc1ebac56ca42129 Mon Sep 17 00:00:00 2001 From: sahaj05 <135546365+sahaj05@users.noreply.github.com> Date: Mon, 18 Sep 2023 12:53:13 +0530 Subject: [PATCH 02/19] Create Blockbook-flo.service Content Contains the starting command for Blockbook-flo.service --- Blockbook-flo.service Content | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Blockbook-flo.service Content diff --git a/Blockbook-flo.service Content b/Blockbook-flo.service Content new file mode 100644 index 0000000..f8413e0 --- /dev/null +++ b/Blockbook-flo.service Content @@ -0,0 +1,38 @@ +[Unit] +Description=Blockbook daemon (Flo) +After=network.target +Wants=backend-flo.service + +[Service] +ExecStart=/opt/coins/blockbook/flo/bin/blockbook -blockchaincfg=/opt/coins/blockbook/flo/config/blockchaincfg.json -datadir=/opt/coins/data/flo/blockbook/db -sync -internal=:9066 -public=:9166 -certfile=/opt/coins/blockbook/flo/cert/blockbook -explorer= -log_dir=/opt/coins/blockbook/flo/logs -dbcache=1073741824 +User=blockbook-flo +Type=simple +Restart=on-failure +TimeoutStopSec=300 +WorkingDirectory=/opt/coins/blockbook/flo + +# Resource limits +LimitNOFILE=500000 + +# Hardening measures +#################### + +# Provide a private /tmp and /var/tmp. +PrivateTmp=true + +# Mount /usr, /boot/ and /etc read-only for the process. +ProtectSystem=full + +# Disallow the process and all of its children to gain +# new privileges through execve(). +NoNewPrivileges=true + +# Use a new /dev namespace only populated with API pseudo devices +# such as /dev/null, /dev/zero and /dev/random. +PrivateDevices=true + +# Deny the creation of writable and executable memory mappings. +MemoryDenyWriteExecute=true + +[Install] +WantedBy=multi-user.target From 8bda09862192a2a33141d455ff937b462432ecfe Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 20 Sep 2023 13:57:14 +0000 Subject: [PATCH 03/19] Step guide for dockerising blockbook --- README.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/README.md b/README.md index 1038f19..50bf758 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,82 @@ Should have [sysbox installed on your machine](https://github.com/nestybox/sysbo sudo docker run -d --runtime=sysbox-runc -P -p :9166 --name blockbook ranchimallfze/blockbook:1.0.0 ``` +## Requirements + +Installation of Sysbox: +1. $ git clone --recursive https://github.com/nestybox/sysbox.git +2. $ make (For this step go to the sysbox directory) +3. $ make sysbox-static +4. $ sudo make install +5. $ make sysbox TARGET_ARCH=arm64 +6. $ sudo ./docker-cfg --sysbox-runtime=enable (For this step go to the scr directory) + If in step 6 command not found error comes then first install jq and then again run this command. + +For Uninstalling: +1. $ sudo make uninstall +2. $ make clean + +Installation of Docker: +1. $ sudo apt update +2. $ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common +3. $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg +4. $ echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu + focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + (Replace focal with your Ubuntu version (e.g., bionic, xenial, or hirsute) if you are using a different version) +5. $ sudo apt update +6. $ sudo apt install -y docker-ce docker-ce-cli containerd.io +7. $ sudo systemctl start docker + $ sudo systemctl enable docker +8. $ sudo docker --version (If installed correctly the version will be displayed) + + + +## Running Manually + +1. After the installation of docker and sysbox run the dockerfile. + For running first we build its docker-image by the following command: + + ``` + + docker build -t . + docker build -f -t + + + ``` + +2. After building the docker-image use the following command to run it. + ``` + + docker run -d --privileged -p : --name + + docker run -d --privileged -p 9166: --name + + ``` + +3. Now access the blockbook by opening the following LINK: https://localhost:/ + Use xdg-open https://localhost:/ to open the link through the terminal and can view the interface of Blockbook. + + + ## Code Explanation + + . We use the base image "nestybox/ubuntu-focal-systemd-docker," which is an Ubuntu-based image with systemd for managing system + services. + . We update the package list and installs necessary packages like wget, gnupg2, software-properties-common, and unzip. + . The Dockerfile downloads a ZIP archive containing Debian (.deb) files from a GitHub repository and extracts them. + . Within the extracted directory, it installs two Debian packages ("dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb" and + "dind_blockbook-flo_0.4.0_amd64.deb") using apt. + . It exposes three ports (22, 80, and 9166) for potential network access. + . The CMD instruction specifies the default command to run when a container is started based on this image. In this case, it starts the + systemd initialization process. + + ### Why Sysbox Is Used ? + + . When you run Docker containers inside a Docker container (DinD), the inner containers typically share the same Docker daemon as the + host and other containers. This can lead to security and isolation concerns. Sysbox allows you to run containers within an isolated environment, providing stronger separation between inner containers, the host, and other outer containers. This is achieved by creating separate container runtimes for each inner container using runc (the OCI runtime). + . In our dockerfile we are able to execute systemctl command by using sysbox. + + + ## Testing The code and steps required to run Docker version of Blockbook block explorer From efbce1e9df993492f8fe197ffdd668192621b651 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 20 Sep 2023 14:01:54 +0000 Subject: [PATCH 04/19] check --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 50bf758..f862c46 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,12 @@ For Uninstalling: Installation of Docker: 1. $ sudo apt update 2. $ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common -3. $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg -4. $ echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu - focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - (Replace focal with your Ubuntu version (e.g., bionic, xenial, or hirsute) if you are using a different version) +3. $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/ + docker-archive-keyring.gpg +4. $ echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ + ubuntu + focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + (Replace focal with your Ubuntu version (e.g., bionic, xenial, or hirsute) if you are using a different version) 5. $ sudo apt update 6. $ sudo apt install -y docker-ce docker-ce-cli containerd.io 7. $ sudo systemctl start docker From 59f423e8dacaa916bd4277c9834ea61921f50518 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 20 Sep 2023 14:38:58 +0000 Subject: [PATCH 05/19] checks --- README.md | 99 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index f862c46..0845e8f 100644 --- a/README.md +++ b/README.md @@ -11,34 +11,44 @@ sudo docker run -d --runtime=sysbox-runc -P -p :9166 --name blockbook ## Requirements Installation of Sysbox: -1. $ git clone --recursive https://github.com/nestybox/sysbox.git -2. $ make (For this step go to the sysbox directory) -3. $ make sysbox-static -4. $ sudo make install -5. $ make sysbox TARGET_ARCH=arm64 -6. $ sudo ./docker-cfg --sysbox-runtime=enable (For this step go to the scr directory) - If in step 6 command not found error comes then first install jq and then again run this command. +``` + +git clone --recursive https://github.com/nestybox/sysbox.git +make (For this step go to the sysbox directory) +make sysbox-static +sudo make install +make sysbox TARGET_ARCH=arm64 +sudo ./docker-cfg --sysbox-runtime=enable (For this step go to the scr directory) + + + ``` For Uninstalling: -1. $ sudo make uninstall -2. $ make clean +``` + +sudo make uninstall +make clean + + ``` Installation of Docker: -1. $ sudo apt update -2. $ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common -3. $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/ - docker-archive-keyring.gpg -4. $ echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ - ubuntu - focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - (Replace focal with your Ubuntu version (e.g., bionic, xenial, or hirsute) if you are using a different version) -5. $ sudo apt update -6. $ sudo apt install -y docker-ce docker-ce-cli containerd.io -7. $ sudo systemctl start docker - $ sudo systemctl enable docker -8. $ sudo docker --version (If installed correctly the version will be displayed) +``` +sudo apt update +sudo apt install -y apt-transport-https ca-certificates curl software-properties-common +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/ +docker-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ +ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +sudo apt update +sudo apt install -y docker-ce docker-ce-cli containerd.io +sudo systemctl start docker +sudo systemctl enable docker +sudo docker --version + +``` ## Running Manually @@ -66,26 +76,6 @@ Installation of Docker: Use xdg-open https://localhost:/ to open the link through the terminal and can view the interface of Blockbook. - ## Code Explanation - - . We use the base image "nestybox/ubuntu-focal-systemd-docker," which is an Ubuntu-based image with systemd for managing system - services. - . We update the package list and installs necessary packages like wget, gnupg2, software-properties-common, and unzip. - . The Dockerfile downloads a ZIP archive containing Debian (.deb) files from a GitHub repository and extracts them. - . Within the extracted directory, it installs two Debian packages ("dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb" and - "dind_blockbook-flo_0.4.0_amd64.deb") using apt. - . It exposes three ports (22, 80, and 9166) for potential network access. - . The CMD instruction specifies the default command to run when a container is started based on this image. In this case, it starts the - systemd initialization process. - - ### Why Sysbox Is Used ? - - . When you run Docker containers inside a Docker container (DinD), the inner containers typically share the same Docker daemon as the - host and other containers. This can lead to security and isolation concerns. Sysbox allows you to run containers within an isolated environment, providing stronger separation between inner containers, the host, and other outer containers. This is achieved by creating separate container runtimes for each inner container using runc (the OCI runtime). - . In our dockerfile we are able to execute systemctl command by using sysbox. - - - ## Testing The code and steps required to run Docker version of Blockbook block explorer @@ -110,4 +100,27 @@ sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -ti ubuntu:20.04 sudo docker run -d --runtime=sysbox-runc -P -p 9167:9166 5018bee64419 sudo docker run -d --runtime=sysbox-runc --net=host -P 5018bee64419 -``` \ No newline at end of file +``` + + ## Code Explanation + + . We use the base image "nestybox/ubuntu-focal-systemd-docker," which is an Ubuntu-based image with + systemd for managing system services. + . We update the package list and installs necessary packages like wget, gnupg2,software-properties-common, + and unzip. + . The Dockerfile downloads a ZIP archive containing Debian (.deb) files from a GitHub repository and + extracts them. + . Within the extracted directory, it installs two Debian packages ("dind_backend-flo_0.15.1.1-satoshilabs + -1_amd64.deb" and "dind_blockbook-flo_0.4.0_amd64.deb") using apt . + . It exposes three ports (22, 80, and 9166) for potential network access. + . The CMD instruction specifies the default command to run when a container is started based on this + image. In this case, it starts the systemd initialization process. + + + ### Why Sysbox Is Used ? + + . When you run Docker containers inside a Docker container (DinD), the inner containers typically share + the same Docker daemon as the host and other containers. This can lead to security and isolation concerns. + . Sysbox allows you to run containers within an isolated environment, providing stronger separation + between inner containers, the host, and other outer containers. This is achieved by creating separate container runtimes for each inner container using runc (the OCI runtime). + . In our dockerfile we are able to execute systemctl command by using sysbox. From 8fd3f5875ea3d034ca0bff31f7077c1575b34a88 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 20 Sep 2023 14:43:51 +0000 Subject: [PATCH 06/19] checks1 --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0845e8f..972bf31 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ sudo docker --version ## Running Manually -1. After the installation of docker and sysbox run the dockerfile. ++ After the installation of docker and sysbox run the dockerfile. For running first we build its docker-image by the following command: ``` @@ -63,7 +63,7 @@ sudo docker --version ``` -2. After building the docker-image use the following command to run it. ++ After building the docker-image use the following command to run it. ``` docker run -d --privileged -p : --name @@ -72,7 +72,7 @@ sudo docker --version ``` -3. Now access the blockbook by opening the following LINK: https://localhost:/ ++ Now access the blockbook by opening the following LINK: https://localhost:/ Use xdg-open https://localhost:/ to open the link through the terminal and can view the interface of Blockbook. @@ -104,23 +104,23 @@ sudo docker run -d --runtime=sysbox-runc --net=host -P 5018bee64419 ## Code Explanation - . We use the base image "nestybox/ubuntu-focal-systemd-docker," which is an Ubuntu-based image with + + We use the base image "nestybox/ubuntu-focal-systemd-docker," which is an Ubuntu-based image with systemd for managing system services. - . We update the package list and installs necessary packages like wget, gnupg2,software-properties-common, + + We update the package list and installs necessary packages like wget, gnupg2,software-properties-common, and unzip. - . The Dockerfile downloads a ZIP archive containing Debian (.deb) files from a GitHub repository and + + The Dockerfile downloads a ZIP archive containing Debian (.deb) files from a GitHub repository and extracts them. - . Within the extracted directory, it installs two Debian packages ("dind_backend-flo_0.15.1.1-satoshilabs + + Within the extracted directory, it installs two Debian packages ("dind_backend-flo_0.15.1.1-satoshilabs -1_amd64.deb" and "dind_blockbook-flo_0.4.0_amd64.deb") using apt . - . It exposes three ports (22, 80, and 9166) for potential network access. - . The CMD instruction specifies the default command to run when a container is started based on this + + It exposes three ports (22, 80, and 9166) for potential network access. + + The CMD instruction specifies the default command to run when a container is started based on this image. In this case, it starts the systemd initialization process. ### Why Sysbox Is Used ? - . When you run Docker containers inside a Docker container (DinD), the inner containers typically share + + When you run Docker containers inside a Docker container (DinD), the inner containers typically share the same Docker daemon as the host and other containers. This can lead to security and isolation concerns. - . Sysbox allows you to run containers within an isolated environment, providing stronger separation + + Sysbox allows you to run containers within an isolated environment, providing stronger separation between inner containers, the host, and other outer containers. This is achieved by creating separate container runtimes for each inner container using runc (the OCI runtime). - . In our dockerfile we are able to execute systemctl command by using sysbox. + + In our dockerfile we are able to execute systemctl command by using sysbox. From 2833fcea47efe77bce906d0c62caf90d966dc3f8 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 20 Sep 2023 14:46:07 +0000 Subject: [PATCH 07/19] checkss --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 972bf31..d93a5a1 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ sudo docker --version ``` - docker build -t . + docker build -t . + docker build -f -t @@ -117,7 +118,7 @@ sudo docker run -d --runtime=sysbox-runc --net=host -P 5018bee64419 image. In this case, it starts the systemd initialization process. - ### Why Sysbox Is Used ? + ## Why Sysbox Is Used ? + When you run Docker containers inside a Docker container (DinD), the inner containers typically share the same Docker daemon as the host and other containers. This can lead to security and isolation concerns. From b3f34bdc0ed6d1cf15bd948d7f449fe3ab21993b Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 20 Sep 2023 14:49:15 +0000 Subject: [PATCH 08/19] checksss --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d93a5a1..a51000f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ sudo docker run -d --runtime=sysbox-runc -P -p :9166 --name blockbook ## Requirements -Installation of Sysbox: +### Installation of Sysbox: ``` git clone --recursive https://github.com/nestybox/sysbox.git @@ -23,7 +23,7 @@ sudo ./docker-cfg --sysbox-runtime=enable (For this step go to the scr directory ``` -For Uninstalling: +### For Uninstalling: ``` sudo make uninstall @@ -31,7 +31,7 @@ make clean ``` -Installation of Docker: +### Installation of Docker: ``` sudo apt update From 1ac3bcb9b1810d2769655a2434ce4cd414eb7f01 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 04:31:52 +0000 Subject: [PATCH 09/19] new _changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a51000f..4ef3ffe 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ sudo docker --version + After building the docker-image use the following command to run it. ``` - docker run -d --privileged -p : --name + docker run -d --privileged -p : --name docker run -d --privileged -p 9166: --name From d35075f35feff6d786ed3874f235875d7e293a37 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 04:34:06 +0000 Subject: [PATCH 10/19] news --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ef3ffe..e3a9ae6 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ sudo docker --version docker run -d --privileged -p : --name - docker run -d --privileged -p 9166: --name + docker run -d --privileged -p :9166 --name ``` From c6f85bca916792b4fd501584035fb01a0a29e800 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 07:30:58 +0000 Subject: [PATCH 11/19] checks_1 --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index e3a9ae6..abd87e3 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,27 @@ sudo docker --version ``` +## How to see availble ports ? + ++ Open a new terminal on your Ubuntu system and copy the code given below: +``` + + # Specify the range of ports you want to check (e.g., 8000 to 9000) + start_port=8000 + end_port=9000 + + # Use a loop to check each port in the specified range + for port in $(seq "$start_port" "$end_port"); do + # Use netstat or ss to check if the port is in use + if ! ss -tuln | grep -q ":$port\b"; then + echo "Port $port is available" + fi + done + + ``` + + + ## Running Manually + After the installation of docker and sysbox run the dockerfile. From af189d23fd3d43096b21fb83d584732e25b2c23a Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 07:31:53 +0000 Subject: [PATCH 12/19] asdf --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index abd87e3..de1f611 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ sudo docker --version ``` -## How to see availble ports ? +## How to see available ports ? + Open a new terminal on your Ubuntu system and copy the code given below: ``` From 1024f11c837d59a28644c18deceb8149b59b6cb1 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 08:02:48 +0000 Subject: [PATCH 13/19] video support added --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index de1f611..8184618 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Blockbook docker + +## Video-Demonstration ++ https://drive.google.com/file/d/1MQlndJi1w992uhUtGTbf89uq0Q7mZR6k/view?usp=sharing (Only Text) ++ https://www.youtube.com/watch?v=QKd3EriMPx0 (Both Text And Audio) + ## Pre-requisites Should have [sysbox installed on your machine](https://github.com/nestybox/sysbox/blob/master/docs/developers-guide/build.md) From 60150aa8e45c78de2037a4390519e4cbb24f1c3c Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 08:58:34 +0000 Subject: [PATCH 14/19] test_net dockerfile --- Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 83057b0..7788e1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,20 @@ FROM nestybox/ubuntu-focal-systemd-docker RUN apt update && \ apt install -y wget gnupg2 software-properties-common unzip -# Download deb files -RUN wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip -RUN cd blockbook-docker-main && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb +# Download deb files based on the TESTNET environment variable +ARG TESTNET=false + +# If TESTNET is true, download testnet deb files; otherwise, download mainnet deb files +RUN if [ "$TESTNET" = "true" ]; then \ + wget https://github.com/ranchimall/blockbook-docker/archive/testnet.zip && unzip testnet.zip && \ + cd blockbook-docker-testnet && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb; \ + else \ + wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip && \ + cd blockbook-docker-main && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb; \ + fi # Expose ports EXPOSE 22 80 9166 # Start your applications (Uncomment and replace with your application start commands) -CMD ["/lib/systemd/systemd"] \ No newline at end of file +CMD ["/lib/systemd/systemd"] From 31c346aa3e44124f1d1b225303780386e06d8a29 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 09:06:35 +0000 Subject: [PATCH 15/19] updated docker files for test_net and main_net --- Main_net_Dockerfile | 16 ++++++++++++++++ Test_net_Dockerfile | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Main_net_Dockerfile create mode 100644 Test_net_Dockerfile diff --git a/Main_net_Dockerfile b/Main_net_Dockerfile new file mode 100644 index 0000000..83057b0 --- /dev/null +++ b/Main_net_Dockerfile @@ -0,0 +1,16 @@ +# Use a base image +FROM nestybox/ubuntu-focal-systemd-docker + +# Install necessary packages +RUN apt update && \ + apt install -y wget gnupg2 software-properties-common unzip + +# Download deb files +RUN wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip +RUN cd blockbook-docker-main && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb + +# Expose ports +EXPOSE 22 80 9166 + +# Start your applications (Uncomment and replace with your application start commands) +CMD ["/lib/systemd/systemd"] \ No newline at end of file diff --git a/Test_net_Dockerfile b/Test_net_Dockerfile new file mode 100644 index 0000000..edd72bf --- /dev/null +++ b/Test_net_Dockerfile @@ -0,0 +1,24 @@ +# Use a base image +FROM nestybox/ubuntu-focal-systemd-docker + +# Install necessary packages +RUN apt update && \ + apt install -y wget gnupg2 software-properties-common unzip + +# Download deb files based on the TESTNET environment variable +ARG TESTNET=false + +# If TESTNET is true, download testnet deb files; otherwise, download mainnet deb files +RUN if [ "$TESTNET" = "true" ]; then \ + wget https://github.com/ranchimall/blockbook-docker/archive/testnet.zip && unzip testnet.zip && \ + cd blockbook-docker-testnet && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb; \ + else \ + wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip && \ + cd blockbook-docker-main && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb; \ + fi + +# Expose ports +EXPOSE 22 80 9166 + +# Start your applications (Uncomment and replace with your application start commands) +CMD ["/lib/systemd/systemd"] From d8be353192abb38a99d4f8503fa8735dcf5efb06 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 09:27:42 +0000 Subject: [PATCH 16/19] removed dockerfile --- Dockerfile | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 7788e1e..0000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Use a base image -FROM nestybox/ubuntu-focal-systemd-docker - -# Install necessary packages -RUN apt update && \ - apt install -y wget gnupg2 software-properties-common unzip - -# Download deb files based on the TESTNET environment variable -ARG TESTNET=false - -# If TESTNET is true, download testnet deb files; otherwise, download mainnet deb files -RUN if [ "$TESTNET" = "true" ]; then \ - wget https://github.com/ranchimall/blockbook-docker/archive/testnet.zip && unzip testnet.zip && \ - cd blockbook-docker-testnet && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb; \ - else \ - wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip && \ - cd blockbook-docker-main && sudo apt install -y ./dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./dind_blockbook-flo_0.4.0_amd64.deb; \ - fi - -# Expose ports -EXPOSE 22 80 9166 - -# Start your applications (Uncomment and replace with your application start commands) -CMD ["/lib/systemd/systemd"] From a03742524c5cbfb34d39c9c5128fad3b1d7cea97 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 10:08:12 +0000 Subject: [PATCH 17/19] updated documentation --- README.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8184618..c5bec0c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # Blockbook docker -## Video-Demonstration +## Video-Demonstration For Mainnet + https://drive.google.com/file/d/1MQlndJi1w992uhUtGTbf89uq0Q7mZR6k/view?usp=sharing (Only Text) + https://www.youtube.com/watch?v=QKd3EriMPx0 (Both Text And Audio) +## Video-Demonstration For Testnet + + ## Pre-requisites Should have [sysbox installed on your machine](https://github.com/nestybox/sysbox/blob/master/docs/developers-guide/build.md) -## Main commands +## Main commands (For Both Mainnet and Testnet) ``` sudo docker run -d --runtime=sysbox-runc -P -p :9166 --name blockbook ranchimallfze/blockbook:1.0.0 ``` @@ -76,7 +79,7 @@ sudo docker --version -## Running Manually +## Running Manually For Both Mainnet And Testnet + After the installation of docker and sysbox run the dockerfile. For running first we build its docker-image by the following command: @@ -129,7 +132,7 @@ sudo docker run -d --runtime=sysbox-runc -P -p 9167:9166 5018bee64419 sudo docker run -d --runtime=sysbox-runc --net=host -P 5018bee64419 ``` - ## Code Explanation + ## Code Explanation For Mainnet + We use the base image "nestybox/ubuntu-focal-systemd-docker," which is an Ubuntu-based image with systemd for managing system services. @@ -144,6 +147,27 @@ sudo docker run -d --runtime=sysbox-runc --net=host -P 5018bee64419 image. In this case, it starts the systemd initialization process. + ## Code Explanation For Testnet + + + This line specifies the base image for the Docker container. It starts with a base image called nestybox/ubuntu-focal-systemd-docker, + which includes Ubuntu Focal Fossa (20.04) with systemd support. + + We run a shell command inside the container during the image-building process. It updates the package list by executing apt + update. The && operator is used to chain multiple commands in a single line. + + We define an argument named TESTNET with a default value of false. Docker ARGs can be used to pass values at build time, and + in this case, it's determining whether to set up the testnet or the mainnet environment. + + Inside the if block, this line downloads a ZIP file containing testnet-related files from a GitHub repository using wget and + then unzips it using unzip. + + If the value of TESTNET is not "true," the else block is executed.Inside the else block, similar to the if block, we download + a different ZIP file (likely containing mainnet-related files) and unzip it. + + We change the working directory to the one where the mainnet ZIP file was extracted (blockbook-docker-main) and install the + same two Debian packages as in the if block. + + Use of 'fi' marks the end of the conditional statement, closing the if-else block. + + Now we expose the ports 22, 80, and 9166 and make them accessible for communication with the host system or other containers. + + The CMD instruction specifies the default command to run when a container is started based on this + image. In this case, it starts the systemd initialization process. + + + ## Why Sysbox Is Used ? + When you run Docker containers inside a Docker container (DinD), the inner containers typically share From a9f569655c4ed86cde4ac5b82d837b7c6b6a014b Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Thu, 21 Sep 2023 11:12:05 +0000 Subject: [PATCH 18/19] updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5bec0c..6518fa6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ + https://www.youtube.com/watch?v=QKd3EriMPx0 (Both Text And Audio) ## Video-Demonstration For Testnet - ++ https://youtu.be/EnX3-cBbpcE (Both Text And Audio) ## Pre-requisites Should have [sysbox installed on your machine](https://github.com/nestybox/sysbox/blob/master/docs/developers-guide/build.md) From 398b08fc008b0f2044bed4a54e5f12c2d515aeb5 Mon Sep 17 00:00:00 2001 From: Kumar Sahaj Date: Wed, 27 Sep 2023 10:00:42 +0000 Subject: [PATCH 19/19] added testnet_files --- blockbook | 1 + 1 file changed, 1 insertion(+) create mode 160000 blockbook diff --git a/blockbook b/blockbook new file mode 160000 index 0000000..a586ce2 --- /dev/null +++ b/blockbook @@ -0,0 +1 @@ +Subproject commit a586ce22e64bb5beddb42d58b6499db024487148