Compare commits

...

13 Commits

Author SHA1 Message Date
Vivek Teega
90b55f5462
Merge pull request #11 from asif158/upgrade/sysbox-independant
Clarify: Docker build and run commands
2024-07-03 22:03:20 +05:30
Asif Rahman
61f3e95e9b
Merge branch 'ranchimall:upgrade/sysbox-independant' into upgrade/sysbox-independant 2024-07-03 10:42:28 +05:30
asif158
54c07cf30f Add: bootstrap script for fast syncing 2024-07-03 10:27:36 +05:30
asif158
d2813c3b6f Clarify: Docker build and run commands 2024-06-21 12:30:50 +05:30
Vivek Teega
f82522b114
Merge pull request #10 from asif158/upgrade/sysbox-independant
Restructure code folder structure
2024-06-21 09:42:07 +05:30
asif158
34223a550a change: variable names to default names 2024-06-15 15:25:46 +05:30
asif158
34eb02d070 Restructure: code folder structure 2024-06-14 18:57:50 +05:30
asif158
c2dc3bd3cb Fix: Spelling errors 2024-06-14 11:09:41 +05:30
asif158
69c4721f19 Update: Readme and reduce image size 2024-06-14 11:01:03 +05:30
asif158
93be49b7a7 Add: supervisor for mainnet and testnet. 2024-06-13 23:54:11 +05:30
asif158
48ca59d104 Fix: supervisord retrying issue 2024-06-13 23:05:34 +05:30
asif158
eb8fb57863 Add: Testnet and supervisor 2024-06-13 14:54:19 +05:30
Vivek Teega
76a911542b
Merge pull request #7 from asif158/upgrade/sysbox-independent
Initial changes for removing sysbox dependency
2024-06-03 15:16:45 +05:30
29 changed files with 348 additions and 411 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

48
Dockerfile Normal file → Executable file
View File

@ -1,16 +1,32 @@
# Use a base image FROM ubuntu:22.04
FROM nestybox/ubuntu-focal-systemd-docker
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary packages
RUN apt update && \ # Copying files to the container
apt install -y wget gnupg2 software-properties-common unzip COPY /deb-files-mainnet/backend-flo_0.15.1.1-satoshilabs-1_amd64.deb /tmp/backend-flo.deb
COPY /deb-files-mainnet/blockbook-flo_0.4.0_amd64.deb /tmp/blockbook-flo.deb
# Download deb files
RUN wget https://github.com/ranchimall/blockbook-docker/archive/main.zip && unzip main.zip # Installing Blockbook and Supervisor
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 RUN apt-get update && \
apt-get install -y /tmp/backend-flo.deb /tmp/blockbook-flo.deb supervisor wget && \
# Expose ports rm /tmp/backend-flo.deb /tmp/blockbook-flo.deb && \
EXPOSE 22 80 9166 rm -rf /var/lib/apt/lists/*
# Start your applications (Uncomment and replace with your application start commands) # Copying conf file after installing supervisor to fix scripting error
CMD ["/lib/systemd/systemd"] COPY /deb-files-mainnet/supervisord.conf /etc/supervisor/supervisord.conf
COPY start.sh /tmp
# Configuring backend as forground process under supervisord
RUN sed -i "s/daemon=1/daemon=0/g" /opt/coins/nodes/flo/flo.conf &&\
chmod +x /tmp/start.sh
EXPOSE 9166
VOLUME /opt/coins
# CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
CMD ["/bin/bash", "-c", "/tmp/start.sh"]
# check logs
# tail -f /opt/coins/data/flo/backend/debug.log
# tail -f /opt/coins/blockbook/flo/logs/blockbook.INFO

View File

@ -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"]

View File

@ -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"]

39
Dockerfile-testnet Normal file
View File

@ -0,0 +1,39 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Copying files to the container
# COPY /deb-files-testnet/peers.dat /tmp
COPY /deb-files-testnet/backend-flo-testnet_0.15.1.1-satoshilabs-1_amd64.deb /tmp/backend-flo.deb
COPY /deb-files-testnet/blockbook-flo-testnet_0.4.0_amd64.deb /tmp/blockbook-flo.deb
# Installing Blockbook and Supervisor
RUN apt-get update && \
apt-get install -y /tmp/backend-flo.deb /tmp/blockbook-flo.deb supervisor wget && \
rm /tmp/backend-flo.deb /tmp/blockbook-flo.deb && \
rm -rf /var/lib/apt/lists/*
# Copying conf file after installing supervisor to fix scripting error
COPY /deb-files-testnet/supervisord.conf /etc/supervisor/supervisord.conf
COPY start.sh /tmp
# Configuring backend as forground process and adding nodes to sync backend
RUN sed -i "s/daemon=1/daemon=0/g" /opt/coins/nodes/flo_testnet/flo_testnet.conf && \
sed -i '$a addnode=ramanujam.ranchimall.net\naddnode=turing.ranchimall.net\naddnode=stevejobs.ranchimall.net\naddnode=brahmagupta.ranchimall.net\naddnode=feynman.ranchimall.net' /opt/coins/nodes/flo_testnet/flo_testnet.conf && \
chmod +x /tmp/start.sh
# RUN cd /opt/coins/nodes/flo_testnet && \
# /opt/coins/nodes/flo_testnet/bin/flod --testnet -datadir=/opt/coins/data/flo_testnet/backend -conf=/opt/coins/nodes/flo_testnet/flo_testnet.conf -pid=/run/flo_testnet/flo_testnet.pid
# RUN mv /tmp/peers.dat /opt/coins/data/flo_testnet/backend/testnet4/peers.dat
EXPOSE 19166
VOLUME /opt/coins
# CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
CMD ["/bin/bash", "-c", "/tmp/start.sh"]
# check logs
# tail -f /opt/coins/data/flo_testnet/backend/testnet4/debug.log
# tail -f /opt/coins/blockbook/flo_testnet/logs/blockbook.INFO

View File

@ -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"]

179
README.md
View File

@ -1,35 +1,166 @@
# Blockbook docker # Blockbook Docker (Single Container)
## Pre-requisites This guide will help you build and run the Docker image for Blockbook Mainnet and Testnet, which is based on Ubuntu 22.04 and includes both backend and frontend components in a single container.
Should have [sysbox installed on your machine](https://github.com/nestybox/sysbox/blob/master/docs/developers-guide/build.md)
## Main commands ## Prerequisites
```
sudo docker run -d --runtime=sysbox-runc -P -p <hostport>:9166 --name blockbook ranchimallfze/blockbook:1.0.0 - [Docker installed on your machine](https://docs.docker.com/engine/install/).
- Clone or download the repository to your local machine.
---
# Mainnet
Steps to build the Docker image for Mainnet.
- **Building the Docker Image**
Navigate to the directory where the repository is cloned and build the Docker image:
```sh
git clone https://github.com/ranchimall/blockbook-docker
cd blockbook-docker
docker build -f Dockerfile -t ranchimall/blockbook-mainnet:1.0.0 .
```
- **Running the Docker Container**
Create a named volume for persistent storage:
```sh
docker volume create mainnet
```
Run the Docker container in detached mode and map port `9166` of the container to port `9166` (or any other port) on the host machine (`-p host-port:container-port`):
```sh
docker run -d -e ZIP=false -e NETWORK=mainnet --name blockbook-mainnet -p 9166:9166 --mount source=mainnet,target=/opt/coins ranchimall/blockbook-mainnet:1.0.0
```
- **Accessing the Frontend**
Once the Docker container is running, you can access the frontend of the application by navigating to: [https://localhost:9166](https://localhost:9166) in your web browser.
- **Accessing Logs**
To check the logs, you can access the container shell and use the `tail` command:
```sh
docker exec -it blockbook-mainnet bash
```
To view the logs of the backend and frontend, run:
```sh
# Backend logs
tail -f /opt/coins/data/flo/backend/debug.log
# Frontend logs
tail -f /opt/coins/blockbook/flo/logs/blockbook.INFO
```
---
# Testnet
Steps to build the Docker image for Testnet.
- **Building the Docker Image**
Navigate to the directory where the repository is cloned or downloaded and build the Docker image:
```sh
cd blockbook-docker
docker build -f Dockerfile-testnet -t ranchimall/blockbook-testnet:1.0.0 .
```
- **Running the Docker Container**
Create a named volume for persistent storage:
```sh
docker volume create testnet
```
Run the Docker container in detached mode and map port `19166` of the container to port `19166` (or any other port) on the host machine (`-p host-port:container-port`):
```sh
docker run -d -e ZIP=false -e NETWORK=testnet --name blockbook-testnet -p 19166:19166 --mount source=testnet,target=/opt/coins ranchimall/blockbook-testnet:1.0.0
```
- **Accessing the Frontend**
Once the Docker container is running, you can access the frontend of the application by navigating to: [https://localhost:19166](https://localhost:19166) in your web browser.
- **Accessing Logs**
To check the logs, you can access the container shell and use the `tail` command:
```sh
docker exec -it blockbook-testnet bash
```
To view the logs of the backend and frontend, run:
```sh
# Backend logs
tail -f /opt/coins/data/flo_testnet/backend/testnet4/debug.log
# Frontend logs
tail -f /opt/coins/blockbook/flo_testnet/logs/blockbook.INFO
```
## Environment Variables
Blockbook uses environment variables to allow for configuration settings. You set the environment variables in your Docker run startup command. Here are the config settings offered by this image:
- NETWORK: [mainnet|testnet] The FLO network you wish to run the Blockbook on.
- ZIP: [true|false] To download the bootstrap data or not to speed up the syncing of blocks, which will be reflected in Blockbook.
- TESTNET_ZIP_URL: The URL for Testnet to download the zip for bootstrapping Blockbook (Testnet).
- MAINNET_ZIP_URL: The URL for Mainnet to download the zip for bootstrapping Blockbook (Mainnet).
You can use the `--env-file` flag to pass these environments through a file during runtime. Create a `.env` file in the same directory as your project, using the `.env.example` file as a guide. Then, run your app with the following command to load the environment variables from the file:
```sh
#to run mainnet add mainnet Environment Variables.
docker run -d --env-file .env --name blockbook-mainnet -p 9166:9166 --mount source=mainnet,target=/opt/coins ranchimall/blockbook-mainnet:1.0.0
#to run testnet add testnet Environment Variables.
docker run -d --env-file .env -name blockbook-testnet -p 19166:19166 --mount source=testnet,target=/opt/coins ranchimall/blockbook-testnet:1.0.0
``` ```
## Testing ## Additional Commands
The code and steps required to run Docker version of Blockbook block explorer - **Stopping the Docker Container:**
``` To stop the container, use:
sudo docker build -t blockbook-althelper -f Dockerfile-althelper .
sudo docker run -d --privileged -p 9166:9166 d5e56e218acd
```
``` ```sh
docker buildx create --driver-opt image=moby/buildkit:master --use --name insecure-builder --buildkitd-flags '--allow-insecure-entitlement security.insecure' docker stop <containername>
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
- **Removing the Docker Container:**
sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -ti ubuntu:20.04 To remove the container, use:
```
``` ```sh
sudo docker run -d --runtime=sysbox-runc -P -p 9167:9166 5018bee64419 docker rm <containername>
```
sudo docker run -d --runtime=sysbox-runc --net=host -P 5018bee64419 - **Removing the Docker Image:**
```
To remove the image, use:
```sh
docker rmi <imagename>
```
Replace `<imagename>` and `<containername>` with the actual image name and container name or ID, respectively.
## Troubleshooting
- Ensure that no other application is using port `9166` or `19166` on your host machine.
- If you encounter issues, check the Docker container logs:
```sh
docker logs <containername>
```

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,37 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
# Enable communication to supervised processes
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[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
directory=/opt/coins/nodes/flo
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/supervisor/backend-flo.out.log
stderr_logfile=/var/log/supervisor/backend-flo.err.log
[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
directory=/opt/coins/blockbook/flo
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/supervisor/blockbook-flo.out.log
stderr_logfile=/var/log/supervisor/blockbook-flo.err.log
[include]
files = /etc/supervisor/conf.d/*.conf

BIN
deb-files-testnet/peers.dat Normal file

Binary file not shown.

View File

@ -0,0 +1,37 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
# Enable communication to supervised processes
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:backend-flo-testnet]
command=/opt/coins/nodes/flo_testnet/bin/flod --testnet -datadir=/opt/coins/data/flo_testnet/backend -conf=/opt/coins/nodes/flo_testnet/flo_testnet.conf -pid=/run/flo_testnet/flo_testnet.pid
directory=/opt/coins/nodes/flo_testnet
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/supervisor/backend-flo-testnet.log
stderr_logfile=/var/log/supervisor/backend-flo-testnet.err
[program:blockbook-flo-testnet]
command=/opt/coins/blockbook/flo_testnet/bin/blockbook -blockchaincfg=/opt/coins/blockbook/flo_testnet/config/blockchaincfg.json -datadir=/opt/coins/data/flo_testnet/blockbook/db -sync -internal=:19066 -public=:19166 -certfile=/opt/coins/blockbook/flo_testnet/cert/blockbook -explorer= -log_dir=/opt/coins/blockbook/flo_testnet/logs -dbcache=1073741824
directory=/opt/coins/blockbook/flo_testnet
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/supervisor/blockbook-flo-testnet.log
stderr_logfile=/var/log/supervisor/blockbook-flo-testnet.err
[include]
files = /etc/supervisor/conf.d/*.conf

View File

@ -1,50 +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 /
# 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"
# 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

View File

@ -1,24 +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"]

View File

@ -1,26 +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
# 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"]

View File

@ -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

View File

@ -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

View File

@ -1,3 +0,0 @@
sudo systemctl start backend-flo.service
sudo systemctl start blockbook-flo.service

View File

@ -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

47
start.sh Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
DOWNLOAD_DIR="/tmp"
EXTRACT_DIR="/opt/coins"
ZIP_FILE="${DOWNLOAD_DIR}/data.tar.gz"
SUPERVISOR_CONF="/etc/supervisor/supervisord.conf"
mkdir -p ${DOWNLOAD_DIR}
start_supervisor() {
echo "Starting Supervisor..."
/usr/bin/supervisord -c ${SUPERVISOR_CONF}
}
#setting the zip url to mainnet or testnet (bootstrap)
if [ "${NETWORK}" = "testnet" ]; then
ZIP_URL="${TESTNET_ZIP_URL}"
elif [ "${NETWORK}" = "mainnet" ]; then
ZIP_URL="${MAINNET_ZIP_URL}"
else
echo "Invalid or missing NETWORK variable. Please set NETWORK to 'testnet' or 'mainnet'."
exit 1
fi
#to download bootstrap or not.
if [ "${ZIP}" = "true" ]; then
echo "Downloading ${ZIP_URL}..."
wget -q --show-progress ${ZIP_URL} -O ${ZIP_FILE}
if [ $? -ne 0 ]; then
echo "Failed to download the zip file."
exit 1
fi
echo "Extracting ${ZIP_FILE} to ${EXTRACT_DIR}..."
tar -xzf ${ZIP_FILE} -C ${EXTRACT_DIR}
if [ $? -ne 0 ]; then
echo "Failed to extract the zip file."
exit 1
fi
rm ${ZIP_FILE}
else
echo "Skipping download and extraction of the zip file."
fi
start_supervisor

View File

@ -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