Squashed commit of the following:
commit5d82cb79f9Author: Vivek Teega <vivek.teega@gmail.com> Date: Sat Aug 3 15:30:18 2024 +0530 remove build workflows commit14e392ee8aMerge:24f8a6332821cdAuthor: Vivek Teega <vivek.teega@gmail.com> Date: Sat Aug 3 15:20:12 2024 +0530 Merge pull request #15 from vivekteega/upgrade/separate-images Merged changes from source-branch as a single commit commit32821cd482Author: Vivek Teega <vivek.teega@gmail.com> Date: Sat Aug 3 14:29:00 2024 +0530 Merged changes from source-branch as a single commit commit24f8a637d2Author: Vivek Teega <vivek.teega@gmail.com> Date: Wed Jul 3 21:29:30 2024 +0530 Preparation for CI CD commit95393696edAuthor: Vivek Teega <vivek.teega@gmail.com> Date: Tue Jul 2 15:52:47 2024 +0530 Updated Readme, added comments, minor changes and cleanup commit9cbfe96d44Author: Vivek Teega <vivek.teega@gmail.com> Date: Tue Jul 2 15:17:58 2024 +0530 Structure set in place for Docker compose based deployment commitb7d99fcd08Author: Vivek Teega <vivek.teega@gmail.com> Date: Wed Jun 12 20:08:31 2024 +0530 Added changes to entrypoint.sh for frontend to take in IP of backend container for RPC connection commita162ab19f3Author: Vivek Teega <vivek.teega@gmail.com> Date: Tue Jun 11 15:48:12 2024 +0530 Build single image, but separate execution commit15b9955f98Author: Vivek Teega <vivek.teega@gmail.com> Date: Sat Jun 8 23:11:36 2024 +0000 Separated images, attached same volume and port mapping commit81b6cee363Author: Vivek Teega <vivek.teega@gmail.com> Date: Sun Jun 9 03:52:19 2024 +0530 Cleanup and roadmap commit76a911542bMerge:1f463bd00b2ca2Author: Vivek Teega <vivek.teega@gmail.com> Date: Mon Jun 3 15:16:45 2024 +0530 Merge pull request #7 from asif158/upgrade/sysbox-independent Initial changes for removing sysbox dependency
This commit is contained in:
parent
0114d71b94
commit
b60a489df4
12
.env.example
Normal file
12
.env.example
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
BACKEND_IMAGE=vivekteega/blockbook:1.0.0
|
||||||
|
FRONTEND_IMAGE=vivekteega/blockbook:1.0.0
|
||||||
|
BACKEND_CONTAINER_NAME=blockbook-backend
|
||||||
|
FRONTEND_CONTAINER_NAME=blockbook-frontend
|
||||||
|
BACKEND_BOOTSTRAP_FILE=/path/to/your/bootstrap-blockbook-flo-mainnet-backend.tar.gz # Set to empty string if not provided
|
||||||
|
FRONTEND_BOOTSTRAP_FILE=/path/to/your/bootstrap-blockbook-flo-mainnet-frontend.tar.gz # Set to empty string if not provided
|
||||||
|
BACKEND_BOOTSTRAP_URL=/path/to/your/bootstrap-blockbook-flo-mainnet-backend.tar.gz # Set to empty string if not provided
|
||||||
|
FRONTEND_BOOTSTRAP_URL=/path/to/your/bootstrap-blockbook-flo-mainnet-frontend.tar.gz # Set to empty string if not provided
|
||||||
|
BACKEND_PORT_1=38366
|
||||||
|
BACKEND_PORT_2=8066
|
||||||
|
FRONTEND_PORT_1=9166
|
||||||
|
FRONTEND_PORT_2=9066
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.env
|
||||||
|
playbook.yml
|
||||||
29
Dockerfile
29
Dockerfile
@ -1,16 +1,21 @@
|
|||||||
# Use a base image
|
FROM ubuntu:22.04
|
||||||
FROM nestybox/ubuntu-focal-systemd-docker
|
|
||||||
|
|
||||||
# Install necessary packages
|
# Backend
|
||||||
RUN apt update && \
|
COPY ./deb-files/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb /opt/backend.deb
|
||||||
apt install -y wget gnupg2 software-properties-common unzip
|
COPY ./deb-files/blockbook-flo_0.4.0_amd64.deb /opt/blockbook.deb
|
||||||
|
|
||||||
# Download deb files
|
RUN apt update && apt install -y /opt/backend.deb /opt/blockbook.deb curl && \
|
||||||
RUN wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip
|
sed -i 's/daemon=1/daemon=0/' /opt/coins/nodes/flo/flo.conf && \
|
||||||
RUN cd blockbook-docker-main && sudo apt install -y ./deb-files/dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./deb-files/dind_blockbook-flo_0.4.0_amd64.deb
|
sed -i '/rpcport=8066/a rpcallowip=0.0.0.0/0' /opt/coins/nodes/flo/flo.conf && \
|
||||||
|
echo "addnode=ramanujam.ranchimall.net" >> /opt/coins/nodes/flo/flo.conf && \
|
||||||
|
echo "addnode=turing.ranchimall.net" >> /opt/coins/nodes/flo/flo.conf && \
|
||||||
|
echo "addnode=stevejobs.ranchimall.net" >> /opt/coins/nodes/flo/flo.conf && \
|
||||||
|
echo "addnode=brahmagupta.ranchimall.net" >> /opt/coins/nodes/flo/flo.conf && \
|
||||||
|
echo "addnode=feynman.ranchimall.net" >> /opt/coins/nodes/flo/flo.conf
|
||||||
|
|
||||||
# Expose ports
|
WORKDIR /opt/coins/blockbook/flo
|
||||||
EXPOSE 22 80 9166
|
|
||||||
|
|
||||||
# Start your applications (Uncomment and replace with your application start commands)
|
# Execution
|
||||||
CMD ["/lib/systemd/systemd"]
|
COPY ./entrypoint.sh /opt/entrypoint.sh
|
||||||
|
RUN chmod +x /opt/entrypoint.sh
|
||||||
|
ENTRYPOINT ["/opt/entrypoint.sh"]
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
# Use a base image
|
|
||||||
FROM cruizba/ubuntu-dind:latest
|
|
||||||
|
|
||||||
# Install necessary packages
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y wget gnupg2 software-properties-common supervisor make git sudo
|
|
||||||
|
|
||||||
# Mount the Docker socket from the host into the container
|
|
||||||
# VOLUME /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
|
|
||||||
# Build app (You can add your application build steps here)
|
|
||||||
RUN git clone https://github.com/ranchimall/blockbook
|
|
||||||
# WORKDIR /blockbook
|
|
||||||
# RUN sudo make all-flo
|
|
||||||
|
|
||||||
# Install deb files
|
|
||||||
# RUN sudo apt install -y ./build/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && \
|
|
||||||
# sudo apt install -y ./build/blockbook-flo_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
# Download deb files
|
|
||||||
# RUN wget https://github.com/ranchimall/blockbook/releases/download/flo-v0.4.0-ubuntu/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb \
|
|
||||||
# https://github.com/ranchimall/blockbook/releases/download/flo-v0.4.0-ubuntu/blockbook-flo_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
# Create run flo directory
|
|
||||||
# RUN mkdir -p /run/flo
|
|
||||||
|
|
||||||
# # Create a common group (e.g., flo-group) and set permissions
|
|
||||||
# RUN groupadd flo-group && \
|
|
||||||
# usermod -aG flo-group flo && \
|
|
||||||
# usermod -aG flo-group blockbook-flo && \
|
|
||||||
# chown :flo-group /run/flo && \
|
|
||||||
# chmod 777 /run/flo
|
|
||||||
|
|
||||||
# Setting up supervisor configurations (Uncomment and add your configuration files)
|
|
||||||
COPY alt-helper.sh /
|
|
||||||
# COPY blockbook-flo.conf /etc/supervisor/conf.d/
|
|
||||||
# COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
|
|
||||||
# Create log files
|
|
||||||
# RUN touch /var/log/backend-flo-error.log && \
|
|
||||||
# touch /var/log/backend-flo.log && \
|
|
||||||
# touch /var/log/blockbook-flo-error.log && \
|
|
||||||
# touch /var/log/blockbook-flo.log
|
|
||||||
|
|
||||||
# Expose ports
|
|
||||||
EXPOSE 22 80 9166
|
|
||||||
|
|
||||||
# Start supervisord (Uncomment this line)
|
|
||||||
# CMD ["/usr/bin/supervisord"]
|
|
||||||
|
|
||||||
# Start your applications (Uncomment and replace with your application start commands)
|
|
||||||
CMD ["/usr/bin/bash", "/alt-helper.sh"]
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1.3-labs
|
|
||||||
# Use a base image
|
|
||||||
FROM cruizba/ubuntu-dind:focal-24.0.6
|
|
||||||
|
|
||||||
# Install necessary packages
|
|
||||||
RUN apt update && \
|
|
||||||
apt install -y wget gnupg2 software-properties-common supervisor sudo unzip
|
|
||||||
|
|
||||||
# Mount the Docker socket from the host into the container
|
|
||||||
# VOLUME /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
|
|
||||||
# # Build app (You can add your application build steps here)
|
|
||||||
# RUN git clone https://github.com/ranchimall/blockbook
|
|
||||||
# WORKDIR /blockbook
|
|
||||||
# RUN --security=insecure cd /blockbook && make all-flo
|
|
||||||
|
|
||||||
# # Install deb files
|
|
||||||
# RUN sudo apt install -y ./build/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb && \
|
|
||||||
# sudo apt install -y ./build/blockbook-flo_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Create run flo directory
|
|
||||||
RUN mkdir -p /run/flo
|
|
||||||
|
|
||||||
# # Create a common group (e.g., flo-group) and set permissions
|
|
||||||
RUN groupadd flo-group && \
|
|
||||||
usermod -aG flo-group flo && \
|
|
||||||
usermod -aG flo-group blockbook-flo && \
|
|
||||||
chown :flo-group /run/flo && \
|
|
||||||
chmod 777 /run/flo
|
|
||||||
|
|
||||||
# Setting up supervisor configurations (Uncomment and add your configuration files)
|
|
||||||
# COPY alt-helper.sh /
|
|
||||||
# COPY blockbook-flo.conf /etc/supervisor/conf.d/
|
|
||||||
# COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
|
|
||||||
# Create log files
|
|
||||||
# RUN touch /var/log/backend-flo-error.log && \
|
|
||||||
# touch /var/log/backend-flo.log && \
|
|
||||||
# touch /var/log/blockbook-flo-error.log && \
|
|
||||||
# touch /var/log/blockbook-flo.log
|
|
||||||
|
|
||||||
COPY prebuilt-helper.sh /
|
|
||||||
|
|
||||||
# Expose ports
|
|
||||||
EXPOSE 22 80 9166
|
|
||||||
|
|
||||||
# Start supervisord (Uncomment this line)
|
|
||||||
# CMD ["/usr/bin/supervisord"]
|
|
||||||
|
|
||||||
# Start your applications (Uncomment and replace with your application start commands)
|
|
||||||
CMD ["/usr/bin/bash", "/prebuilt-helper.sh"]
|
|
||||||
@ -1,16 +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
|
|
||||||
RUN wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip
|
|
||||||
RUN cd blockbook-docker-main && sudo apt install -y ./deb-files/backend-flo-testnet_0.15.1.1-satoshilabs-1_amd64.deb && sudo apt install -y ./deb-files/blockbook-flo-testnet_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
# Expose ports
|
|
||||||
EXPOSE 22 80 19166
|
|
||||||
|
|
||||||
# Start your applications (Uncomment and replace with your application start commands)
|
|
||||||
CMD ["/lib/systemd/systemd"]
|
|
||||||
57
README.md
57
README.md
@ -1,35 +1,48 @@
|
|||||||
# Blockbook docker
|
# Blockbook docker
|
||||||
|
|
||||||
## Pre-requisites
|
## Roadmap for upgrade
|
||||||
Should have [sysbox installed on your machine](https://github.com/nestybox/sysbox/blob/master/docs/developers-guide/build.md)
|
|
||||||
|
|
||||||
## Main commands
|
- [ ] How to set this up in production
|
||||||
```
|
- [ ] Think of how Blockbook container will detect the status of backend container
|
||||||
sudo docker run -d --runtime=sysbox-runc -P -p <hostport>:9166 --name blockbook ranchimallfze/blockbook:1.0.0
|
- [ ] Figure out if multiple volume path need to be mounted
|
||||||
```
|
- [ ] See if creating a new network for both the containers will be a good option.
|
||||||
|
---
|
||||||
|
- [X] [Unable to build frontend separately since having backend package installed is a dependency] Create separate images for both backend and blockbook.
|
||||||
|
- [X] Attach the same volume to both the running containers of the images.
|
||||||
|
|
||||||
## Testing
|
## Quickstart
|
||||||
|
|
||||||
The code and steps required to run Docker version of Blockbook block explorer
|
To run the services using this file create a .env file using .env.example file, fill info and run the following command in the same directory:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo docker build -t blockbook-althelper -f Dockerfile-althelper .
|
sudo docker-compose up -d
|
||||||
sudo docker run -d --privileged -p 9166:9166 d5e56e218acd
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
## Running blockbook manually
|
||||||
docker buildx create --driver-opt image=moby/buildkit:master --use --name insecure-builder --buildkitd-flags '--allow-insecure-entitlement security.insecure'
|
|
||||||
docker buildx use insecure-builder
|
|
||||||
docker buildx build --allow security.insecure ...(other build args)...
|
|
||||||
sudo docker buildx build --allow security.insecure -t blockbook .
|
|
||||||
docker buildx rm insecure-builder
|
|
||||||
|
|
||||||
|
|
||||||
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
|
docker volume create blockbook
|
||||||
|
|
||||||
|
docker network create blockbook
|
||||||
|
|
||||||
|
# Run backend in "it" mode for testing
|
||||||
|
docker run -it --name blockbook-backend --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 --network=blockbook vivekteega/blockbook:1.0.0 backend
|
||||||
|
|
||||||
|
# Run backend in daemon mode for production
|
||||||
|
docker run -d --name blockbook-backend --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 --network=blockbook vivekteega/blockbook:1.0.0 backend
|
||||||
|
|
||||||
|
# Run backend in daemon mode for production with Bootstrap
|
||||||
|
docker run -d --name blockbook-backend --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 --network=blockbook --env BOOTSTRAP_URL=https://bootstrap.ranchimall.net/blockbook-flo-backend1.tar.gz vivekteega/blockbook:1.0.0 backend
|
||||||
|
|
||||||
|
|
||||||
|
# Run frontend in "it" mode for testing
|
||||||
|
docker run -it --name blockbook-frontend --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 --network=blockbook vivekteega/blockbook:1.0.0 frontend 172.20.0.2
|
||||||
|
|
||||||
|
# Run frontend in daemon mode for production
|
||||||
|
docker run -d --name blockbook-frontend --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 --network=blockbook vivekteega/blockbook:1.0.0 frontend 172.20.0.2
|
||||||
|
|
||||||
|
# Bootstrap
|
||||||
|
docker run -d --name blockbook-frontend --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 --network=blockbook --env BOOTSTRAP_URL=https://bootstrap.ranchimall.net/blockbook-flo-frontend.tar.gz vivekteega/blockbook:1.0.0 frontend 172.20.0.2
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -1,28 +0,0 @@
|
|||||||
cd /blockbook && sudo make all-flo
|
|
||||||
|
|
||||||
#1. Install deb files
|
|
||||||
cd /blockbook/build && sudo apt install -y ./backend-flo_0.15.1.1-satoshilabs-1_amd64.deb
|
|
||||||
cd /blockbook/build && sudo apt install -y ./blockbook-flo_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
#2. create run flo dir
|
|
||||||
mkdir -p /run/flo
|
|
||||||
|
|
||||||
#3. create a group and add flo and blockbook-flo & set permission for dir
|
|
||||||
# Create a common group (e.g., flo-group)
|
|
||||||
groupadd flo-group
|
|
||||||
|
|
||||||
# Add users to the common group
|
|
||||||
usermod -aG flo-group flo
|
|
||||||
usermod -aG flo-group blockbook-flo
|
|
||||||
|
|
||||||
# Set the common group ownership on the directory
|
|
||||||
chown :flo-group /run/flo
|
|
||||||
|
|
||||||
# Give the group read-write permissions on the directory
|
|
||||||
chmod 777 /run/flo
|
|
||||||
|
|
||||||
# 4. run main commands as user
|
|
||||||
|
|
||||||
su -s /bin/bash -c "/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid" flo
|
|
||||||
|
|
||||||
su -s /bin/bash -c "cd /opt/coins/blockbook/flo && /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" blockbook-flo
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
[program:backend-flo]
|
|
||||||
command=/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
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
redirect_stderr=true
|
|
||||||
stdout_logfile=/var/log/backend-flo.log
|
|
||||||
stderr_logfile=/var/log/backend-flo-error.log
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
[program:blockbook-flo]
|
|
||||||
command=/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=root
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
redirect_stderr=true
|
|
||||||
stdout_logfile=/var/log/blockbook-flo.log
|
|
||||||
stderr_logfile=/var/log/blockbook-flo-error.log
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
|
|
||||||
# Install make and git
|
|
||||||
apt install -y make git sudo
|
|
||||||
|
|
||||||
|
|
||||||
wget https://github.com/ranchimall/blockbook/releases/download/flo-v0.4.0-ubuntu/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb
|
|
||||||
wget https://github.com/ranchimall/blockbook/releases/download/flo-v0.4.0-ubuntu/blockbook-flo_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
#1. Install deb files
|
|
||||||
apt install sudo
|
|
||||||
sudo apt install -y /opt/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb
|
|
||||||
sudo apt install -y /opt/blockbook-flo_0.4.0_amd64.deb
|
|
||||||
|
|
||||||
#2. create run flo dir
|
|
||||||
mkdir -p /run/flo
|
|
||||||
|
|
||||||
#3. create a group and add flo and blockbook-flo & set permission for dir
|
|
||||||
# Create a common group (e.g., flo-group)
|
|
||||||
groupadd flo-group
|
|
||||||
|
|
||||||
# Add users to the common group
|
|
||||||
usermod -aG flo-group flo
|
|
||||||
usermod -aG flo-group blockbook-flo
|
|
||||||
|
|
||||||
# Set the common group ownership on the directory
|
|
||||||
chown :flo-group /run/flo
|
|
||||||
|
|
||||||
# Give the group read-write permissions on the directory
|
|
||||||
chmod 777 /run/flo
|
|
||||||
|
|
||||||
# 4. run main commands as user
|
|
||||||
|
|
||||||
# su -s /bin/bash -c "/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid" flo
|
|
||||||
|
|
||||||
# su -s /bin/bash -c "/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" blockbook-flo
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
# Use the official Ubuntu 22.04 as the base image
|
|
||||||
FROM ubuntu:22.04
|
|
||||||
|
|
||||||
# Set the DEBIAN_FRONTEND environment variable to noninteractive to avoid prompts during package installation
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
# Update the package list and clean up the apt cache to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
#apt-get install -y supervisor && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy the .deb package for backend-flo into the container
|
|
||||||
COPY dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb /tmp/backend-flo.deb
|
|
||||||
|
|
||||||
# Update the package list, install the .deb package, and remove the .deb file to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y /tmp/backend-flo.deb && \
|
|
||||||
rm /tmp/backend-flo.deb
|
|
||||||
|
|
||||||
# Expose the RPC port for the backend
|
|
||||||
EXPOSE 8066
|
|
||||||
|
|
||||||
# Copy the .deb package for blockbook-flo into the container
|
|
||||||
COPY dind_blockbook-flo_0.4.0_amd64.deb /tmp/blockbook-flo.deb
|
|
||||||
|
|
||||||
# Update the package list, install the .deb package, and remove the .deb file to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y /tmp/blockbook-flo.deb && \
|
|
||||||
rm /tmp/blockbook-flo.deb
|
|
||||||
|
|
||||||
# Expose ports for the frontend
|
|
||||||
EXPOSE 9166
|
|
||||||
EXPOSE 9066
|
|
||||||
|
|
||||||
# Copy supervisor configuration
|
|
||||||
#COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
|
|
||||||
# Declare volumes for persistence
|
|
||||||
VOLUME /opt/coins
|
|
||||||
|
|
||||||
# Start the service and keep the container running by tailing the log file
|
|
||||||
#CMD /bin/bash -c "/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid && tail -f /opt/coins/data/flo/backend/debug.log && /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"
|
|
||||||
|
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
|
||||||
# Start supervisor
|
|
||||||
#CMD ["/usr/bin/supervisord"]
|
|
||||||
|
|
||||||
|
|
||||||
# check logs of the services
|
|
||||||
# tail -f /opt/coins/data/flo/backend/debug.log
|
|
||||||
# tail -f /opt/coins/blockbook/flo/logs/blockbook.INFO
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
# Use the official Ubuntu 22.04 as the base image
|
|
||||||
FROM ubuntu:22.04
|
|
||||||
|
|
||||||
# Set the DEBIAN_FRONTEND environment variable to noninteractive to avoid prompts during package installation
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
# Update the package list and clean up the apt cache to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy the .deb package for backend-flo into the container
|
|
||||||
COPY dind_backend-flo_0.15.1.1-satoshilabs-1_amd64.deb /tmp/backend-flo.deb
|
|
||||||
|
|
||||||
# Update the package list, install the .deb package, and remove the .deb file to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y /tmp/backend-flo.deb && \
|
|
||||||
rm /tmp/backend-flo.deb
|
|
||||||
|
|
||||||
# Expose the RPC port for the backend
|
|
||||||
EXPOSE 8066
|
|
||||||
|
|
||||||
# Start the service and keep the container running by tailing the log file
|
|
||||||
#CMD ["/bin/bash", "-c", "/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid"]
|
|
||||||
# & tail -f /opt/coins/data/flo/backend/debug.log
|
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
# Use the official Ubuntu 22.04 as the base image
|
|
||||||
FROM ubuntu:22.04
|
|
||||||
|
|
||||||
# Set the DEBIAN_FRONTEND environment variable to noninteractive to avoid prompts during package installation
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
# Update the package list and clean up the apt cache to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy the .deb package for blockbook-flo into the container
|
|
||||||
COPY dind_blockbook-flo_0.4.0_amd64.deb /tmp/blockbook-flo.deb
|
|
||||||
|
|
||||||
# Update the package list, install the .deb package, and remove the .deb file to reduce image size
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y /tmp/blockbook-flo.deb && \
|
|
||||||
rm /tmp/blockbook-flo.deb
|
|
||||||
|
|
||||||
# Expose ports for the frontend
|
|
||||||
EXPOSE 9166
|
|
||||||
EXPOSE 9066
|
|
||||||
|
|
||||||
VOLUME /opt/coins
|
|
||||||
|
|
||||||
# Start the service and keep the container running by tailing the log file
|
|
||||||
#CMD ["/bin/bash", "-c", "/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 & tail -f /opt/coins/blockbook/flo/logs/blockbook.INFO"]
|
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,31 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile.backend
|
|
||||||
ports:
|
|
||||||
- "8066:8066"
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
|
|
||||||
frontend:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile.blockbook
|
|
||||||
ports:
|
|
||||||
- "9166:9166"
|
|
||||||
- "9066:9066"
|
|
||||||
depends_on:
|
|
||||||
- backend
|
|
||||||
environment:
|
|
||||||
- BACKEND_HOST=backend
|
|
||||||
- BACKEND_PORT=8066
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
|
|
||||||
networks:
|
|
||||||
app-network:
|
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
FROM ubuntu:22.04
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y wget && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
COPY backend-flo_0.15.1.1-satoshilabs-1_amd64.deb /tmp/backend-flo.deb
|
|
||||||
COPY blockbook-flo_0.4.0_amd64.deb /tmp/blockbook-flo.deb
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y /tmp/backend-flo.deb && \
|
|
||||||
rm /tmp/backend-flo.deb
|
|
||||||
#/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid
|
|
||||||
# tail -f /opt/coins/data/flo/backend/debug.log
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y /tmp/blockbook-flo.deb && \
|
|
||||||
rm /tmp/blockbook-flo.deb
|
|
||||||
#/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
|
|
||||||
|
|
||||||
# tail -f /opt/coins/blockbook/flo/logs/blockbook.INFO
|
|
||||||
|
|
||||||
EXPOSE 9166
|
|
||||||
|
|
||||||
#CMD ["/usr/sbin/service", "blockbook-flo", "start"]
|
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
|
||||||
#CMD /bin/bash -c "/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid && /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"
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
|
|
||||||
[program:flod]
|
|
||||||
command=/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
|
|
||||||
autostart=false
|
|
||||||
autorestart=false
|
|
||||||
redirect_stderr=true
|
|
||||||
stdout_logfile=/var/log/backend-flo.log
|
|
||||||
stderr_logfile=/var/log/backend-flo-error.log
|
|
||||||
|
|
||||||
[program:blockbook]
|
|
||||||
command=/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
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/var/log/blockbook-flo.log
|
|
||||||
stderr_logfile=/var/log/blockbook-flo-error.log
|
|
||||||
45
docker-compose.yml
Normal file
45
docker-compose.yml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
blockbook-backend:
|
||||||
|
image: ${BACKEND_IMAGE}
|
||||||
|
container_name: ${BACKEND_CONTAINER_NAME}
|
||||||
|
networks:
|
||||||
|
- blockbook
|
||||||
|
volumes:
|
||||||
|
- blockbook:/opt
|
||||||
|
- ${BACKEND_BOOTSTRAP_FILE:-/dev/null}:/local-bootstrap/bootstrap-blockbook-flo-mainnet-backend.tar.gz # Use /dev/null if no file
|
||||||
|
ports:
|
||||||
|
- "${BACKEND_PORT_1}:38366"
|
||||||
|
- "${BACKEND_PORT_2}:8066"
|
||||||
|
command: backend
|
||||||
|
environment:
|
||||||
|
- BOOTSTRAP_FILE=/local-bootstrap/bootstrap-blockbook-flo-mainnet-backend.tar.gz # Set to empty string if not provided
|
||||||
|
- BOOTSTRAP_URL=${BACKEND_BOOTSTRAP_URL:-} # Set to empty string if not provided
|
||||||
|
|
||||||
|
blockbook-frontend:
|
||||||
|
image: ${FRONTEND_IMAGE}
|
||||||
|
container_name: ${FRONTEND_CONTAINER_NAME}
|
||||||
|
networks:
|
||||||
|
- blockbook
|
||||||
|
volumes:
|
||||||
|
- blockbook:/opt
|
||||||
|
- ${FRONTEND_BOOTSTRAP_FILE:-/dev/null}:/local-bootstrap/bootstrap-blockbook-flo-mainnet-frontend.tar.gz # Use /dev/null if no file
|
||||||
|
ports:
|
||||||
|
- "${FRONTEND_PORT_1}:9166"
|
||||||
|
- "${FRONTEND_PORT_2}:9066"
|
||||||
|
depends_on:
|
||||||
|
- blockbook-backend
|
||||||
|
entrypoint: /bin/sh -c
|
||||||
|
command: >
|
||||||
|
"/opt/entrypoint.sh frontend $(getent hosts blockbook-backend | awk '{ print $1 }')"
|
||||||
|
environment:
|
||||||
|
- BOOTSTRAP_FILE=/local-bootstrap/bootstrap-blockbook-flo-mainnet-frontend.tar.gz # Set to empty string if not provided
|
||||||
|
- BOOTSTRAP_URL=${FRONTEND_BOOTSTRAP_URL:-} # Set to empty string if not provided
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
blockbook:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
blockbook:
|
||||||
|
driver: bridge
|
||||||
131
entrypoint.sh
Normal file
131
entrypoint.sh
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Paths for frontend bootstrap files
|
||||||
|
FRONTEND_BOOTSTRAP_URL_FILE="/opt/coins/data/flo/blockbook/bootstrap-url.txt"
|
||||||
|
FRONTEND_BOOTSTRAP_FILE_HASH_FILE="/opt/coins/data/flo/blockbook/bootstrap-file-hash.txt"
|
||||||
|
|
||||||
|
# Paths for backend bootstrap files
|
||||||
|
BACKEND_BOOTSTRAP_URL_FILE="/opt/coins/data/flo/backend/bootstrap-url.txt"
|
||||||
|
BACKEND_BOOTSTRAP_FILE_HASH_FILE="/opt/coins/data/flo/backend/bootstrap-file-hash.txt"
|
||||||
|
|
||||||
|
# Function to calculate the hash of a file
|
||||||
|
calculate_file_hash() {
|
||||||
|
local file=$1
|
||||||
|
sha256sum "$file" | awk '{print $1}'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to update config file
|
||||||
|
update_config_file() {
|
||||||
|
local config_path=$1
|
||||||
|
local new_ip=$2
|
||||||
|
if [ -n "$new_ip" ]; then
|
||||||
|
echo "Updating config file: $config_path with IP: $new_ip"
|
||||||
|
if ! sed -i "s/127.0.0.1/$new_ip/g" "$config_path"; then
|
||||||
|
echo "Failed to update config file: $config_path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle bootstrap from URL
|
||||||
|
handle_bootstrap_url() {
|
||||||
|
local bootstrap_url=$1
|
||||||
|
local destination_dir=$2
|
||||||
|
local url_file=$3
|
||||||
|
local bootstrap_file=$4
|
||||||
|
|
||||||
|
if [ -z "$bootstrap_url" ]; then
|
||||||
|
echo "No bootstrap URL provided, skipping download."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$url_file" ]; then
|
||||||
|
local existing_url
|
||||||
|
existing_url=$(cat "$url_file")
|
||||||
|
if [ "$existing_url" = "$bootstrap_url" ]; then
|
||||||
|
echo "Bootstrap URL already processed, skipping download and extraction."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Downloading bootstrap file from: $bootstrap_url"
|
||||||
|
curl -L -o "/tmp/$bootstrap_file" "$bootstrap_url"
|
||||||
|
echo "Cleaning and extracting bootstrap file to: $destination_dir"
|
||||||
|
mkdir -p "$destination_dir"
|
||||||
|
rm -rf "$destination_dir"/*
|
||||||
|
tar -xzvf "/tmp/$bootstrap_file" -C "$destination_dir"
|
||||||
|
rm "/tmp/$bootstrap_file"
|
||||||
|
|
||||||
|
echo "$bootstrap_url" > "$url_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle bootstrap from file
|
||||||
|
handle_bootstrap_file() {
|
||||||
|
local bootstrap_file=$1
|
||||||
|
local destination_dir=$2
|
||||||
|
local hash_file=$3
|
||||||
|
|
||||||
|
if [ -z "$bootstrap_file" ] || [ ! -f "$bootstrap_file" ]; then
|
||||||
|
echo "No valid bootstrap file provided, skipping extraction."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local new_hash
|
||||||
|
new_hash=$(calculate_file_hash "$bootstrap_file")
|
||||||
|
|
||||||
|
if [ -f "$hash_file" ]; then
|
||||||
|
local existing_hash
|
||||||
|
existing_hash=$(cat "$hash_file")
|
||||||
|
if [ "$existing_hash" = "$new_hash" ]; then
|
||||||
|
echo "Bootstrap file already processed, skipping extraction."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using bootstrap file: $bootstrap_file"
|
||||||
|
echo "Cleaning and extracting bootstrap file to: $destination_dir"
|
||||||
|
mkdir -p "$destination_dir"
|
||||||
|
rm -rf "$destination_dir"/*
|
||||||
|
tar -xzf "$bootstrap_file" -C "$destination_dir"
|
||||||
|
|
||||||
|
echo "$new_hash" > "$hash_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"frontend")
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
echo "Missing parameter: new_ip for frontend"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
new_ip=$2
|
||||||
|
echo "Running frontend command with IP: $new_ip"
|
||||||
|
|
||||||
|
if [ -n "$BOOTSTRAP_FILE" ] && [ -f "$BOOTSTRAP_FILE" ]; then
|
||||||
|
handle_bootstrap_file "$BOOTSTRAP_FILE" "/opt/coins/data/flo/blockbook" "$FRONTEND_BOOTSTRAP_FILE_HASH_FILE"
|
||||||
|
elif [ -n "$BOOTSTRAP_URL" ]; then
|
||||||
|
handle_bootstrap_url "$BOOTSTRAP_URL" "/opt/coins/data/flo/blockbook" "$FRONTEND_BOOTSTRAP_URL_FILE" "bootstrap-frontend.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
update_config_file "/opt/coins/blockbook/flo/config/blockchaincfg.json" "$new_ip"
|
||||||
|
cd /opt/coins/blockbook/flo
|
||||||
|
exec /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
|
||||||
|
;;
|
||||||
|
"backend")
|
||||||
|
echo "Running backend command"
|
||||||
|
|
||||||
|
if [ -n "$BOOTSTRAP_FILE" ] && [ -f "$BOOTSTRAP_FILE" ]; then
|
||||||
|
handle_bootstrap_file "$BOOTSTRAP_FILE" "/opt/coins/data/flo/backend" "$BACKEND_BOOTSTRAP_FILE_HASH_FILE"
|
||||||
|
elif [ -n "$BOOTSTRAP_URL" ]; then
|
||||||
|
handle_bootstrap_url "$BOOTSTRAP_URL" "/opt/coins/data/flo/backend" "$BACKEND_BOOTSTRAP_URL_FILE" "bootstrap-backend.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /opt/coins/nodes/flo
|
||||||
|
exec /opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid option: $1"
|
||||||
|
echo "Usage: $0 {frontend new_ip|backend}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@ -1,3 +0,0 @@
|
|||||||
sudo systemctl start backend-flo.service
|
|
||||||
|
|
||||||
sudo systemctl start blockbook-flo.service
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
su -s /bin/bash -c "/opt/coins/nodes/flo/bin/flod -datadir=/opt/coins/data/flo/backend -conf=/opt/coins/nodes/flo/flo.conf -pid=/run/flo/flo.pid" flo
|
|
||||||
|
|
||||||
su -s /bin/bash -c "cd /opt/coins/blockbook/flo && /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" blockbook-flo
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
|
|
||||||
[program:backend-flo]
|
|
||||||
command=/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
|
|
||||||
autostart=false
|
|
||||||
autorestart=false
|
|
||||||
redirect_stderr=true
|
|
||||||
stdout_logfile=/var/log/backend-flo.log
|
|
||||||
stderr_logfile=/var/log/backend-flo-error.log
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user