From 00b2ca2407cae97246978724ae9778248e12cf42 Mon Sep 17 00:00:00 2001 From: asif158 Date: Mon, 3 Jun 2024 15:12:06 +0530 Subject: [PATCH] Initial changes for removing sysbox dependency --- deb-files/Dockerfile | 50 ++++++++++++++++++++++++++++++++++ deb-files/Dockerfile.backend | 24 ++++++++++++++++ deb-files/Dockerfile.blockbook | 26 ++++++++++++++++++ deb-files/docker-compose.yml | 31 +++++++++++++++++++++ deb-files/supervisord.conf | 19 +++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 deb-files/Dockerfile create mode 100755 deb-files/Dockerfile.backend create mode 100644 deb-files/Dockerfile.blockbook create mode 100644 deb-files/docker-compose.yml create mode 100644 deb-files/supervisord.conf diff --git a/deb-files/Dockerfile b/deb-files/Dockerfile new file mode 100644 index 0000000..2df1c42 --- /dev/null +++ b/deb-files/Dockerfile @@ -0,0 +1,50 @@ +# 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 diff --git a/deb-files/Dockerfile.backend b/deb-files/Dockerfile.backend new file mode 100755 index 0000000..3ab8f69 --- /dev/null +++ b/deb-files/Dockerfile.backend @@ -0,0 +1,24 @@ +# 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"] + diff --git a/deb-files/Dockerfile.blockbook b/deb-files/Dockerfile.blockbook new file mode 100644 index 0000000..3941593 --- /dev/null +++ b/deb-files/Dockerfile.blockbook @@ -0,0 +1,26 @@ +# 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"] + + diff --git a/deb-files/docker-compose.yml b/deb-files/docker-compose.yml new file mode 100644 index 0000000..963da27 --- /dev/null +++ b/deb-files/docker-compose.yml @@ -0,0 +1,31 @@ +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 + diff --git a/deb-files/supervisord.conf b/deb-files/supervisord.conf new file mode 100644 index 0000000..7e9e090 --- /dev/null +++ b/deb-files/supervisord.conf @@ -0,0 +1,19 @@ +[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