Adding psf-memo-indexer

This commit is contained in:
Chris Troutner
2026-08-26 09:30:44 -07:00
parent 28bde991b5
commit 5a68a42f77
67 changed files with 13681 additions and 1 deletions
@@ -0,0 +1,19 @@
# Environment variables for psf-memo-block-indexer
# Copy this file to .env and modify as needed
PSF_MEMO_DB_URL=http://172.17.0.1:5021
RPC_IP=172.17.0.1
RPC_PORT=8332
ZMQ_PORT=28332
RPC_USER=bitcoin
RPC_PASS=password
TX_REST_API_PORT=5455
TX_REST_API_IP=172.17.0.1
START_BLOCK_HEIGHT=525000
EXIT_ON_MISSING_BACKUP=false
FILTER_CONCURRENCY=20
MEMO_TX_CONCURRENCY=20
DEBUG_LEVEL=0
@@ -0,0 +1,50 @@
# Create a Dockerized block indexer
#
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget zip unzip python3
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
RUN adduser safeuser sudo
#Set password to 'password' change value below if you want a different password
RUN echo safeuser:password | chpasswd
#Set the working directory to be the home directory
WORKDIR /home/safeuser
#Setup NPM for non-root global install
RUN mkdir /home/safeuser/.npm-global
RUN chown -R safeuser .npm-global
RUN echo "export PATH=~/.npm-global/bin:$PATH" >> /home/safeuser/.profile
RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
# Clone the psf-memo-indexer repository
WORKDIR /home/safeuser
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-indexer
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
WORKDIR /home/safeuser/psf-memo-indexer
# For development: switch to unstable branch
#RUN git checkout <branch-name>
# Install dependencies
RUN npm install
# Start the application.
# start-block-indexer.sh is mounted at runtime via docker-compose.
VOLUME start-block-indexer.sh
CMD ["./start-block-indexer.sh"]
@@ -0,0 +1,3 @@
#!/bin/bash
node --max-old-space-size=8192 psf-memo-block-indexer.js
@@ -0,0 +1,61 @@
# Start the service with: docker-compose up -d
services:
memo-db:
build: ./memo-db
container_name: memo-db
logging:
driver: json-file
options:
max-size: 10m
max-file: '10'
ports:
- '5021:5021'
volumes:
- ../data/leveldb:/home/safeuser/psf-memo-db/leveldb
- ./memo-db/start-memo-db.sh:/home/safeuser/psf-memo-db/start-memo-db.sh
- ./memo-db/.env:/home/safeuser/psf-memo-db/.env
restart: always
tx-indexer:
build: ./tx-indexer
image: memo-tx-indexer
container_name: memo-tx-indexer
logging:
driver: json-file
options:
max-size: 10m
max-file: '10'
ports:
- '5455:5455'
volumes:
- ./tx-indexer/start-tx-indexer.sh:/home/safeuser/psf-memo-indexer/start-tx-indexer.sh
- ./tx-indexer/.env:/home/safeuser/psf-memo-indexer/.env
restart: always
block-indexer:
build: ./block-indexer
image: memo-block-indexer
container_name: memo-block-indexer
logging:
driver: json-file
options:
max-size: 10m
max-file: '10'
volumes:
- ./block-indexer/start-block-indexer.sh:/home/safeuser/psf-memo-indexer/start-block-indexer.sh
- ./block-indexer/.env:/home/safeuser/psf-memo-indexer/.env
restart: always
memo-client:
build: ./memo-client
image: memo-client
container_name: memo-client
logging:
driver: json-file
options:
max-size: 10m
max-file: '10'
ports:
- '3000:80'
restart: always
@@ -0,0 +1,9 @@
# psf-memo-db REST API base URL (no trailing slash).
# Baked into the SPA when the memo-client image is built.
# Example: https://api.mydomain.com
#
# Usage:
# cp .env-example .env
# # edit REACT_APP_MEMO_DB_URL
# docker compose build memo-client
REACT_APP_MEMO_DB_URL=http://localhost:5021
@@ -0,0 +1,48 @@
# Create a Dockerized front-end SPA served by nginx
#
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04 as builder
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
#Set the working directory to be the home directory
WORKDIR /home/safeuser
# Clone the psf-memo-client repository
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-client
# Switch to the desired branch. `master` is usually stable,
# and `stage` / `unstable` have the most up-to-date changes.
WORKDIR /home/safeuser/psf-memo-client
# For development: switch to unstable branch
#RUN git checkout unstable
# Install dependencies
RUN npm install
# Create React App reads REACT_APP_* from this .env at build time.
# Edit production/docker/memo-client/.env before building.
COPY .env .env
# Build the site
RUN npm run build
# Load the NGINX image.
FROM nginx
EXPOSE 80
# Copy the files built in the first container to the new NGINX container.
COPY --from=builder /home/safeuser/psf-memo-client/build /usr/share/nginx/html
# Copy the NGINX configuration file.
COPY default.conf /etc/nginx/conf.d/default.conf
@@ -0,0 +1,22 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
@@ -0,0 +1,4 @@
PORT=5021
SVC_ENV=prod
BACKUP_QTY=3
EXIT_ON_MISSING_BACKUP=false
@@ -0,0 +1,56 @@
# Create a Dockerized API server
#
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget zip unzip python3
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
RUN adduser safeuser sudo
#Set password to 'password' change value below if you want a different password
RUN echo safeuser:password | chpasswd
#Set the working directory to be the home directory
WORKDIR /home/safeuser
#Setup NPM for non-root global install
RUN mkdir /home/safeuser/.npm-global
RUN chown -R safeuser .npm-global
RUN echo "export PATH=~/.npm-global/bin:$PATH" >> /home/safeuser/.profile
RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
# Clone the psf-memo-db repository
WORKDIR /home/safeuser
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-db
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
WORKDIR /home/safeuser/psf-memo-db
# For development: switch to unstable branch
#RUN git checkout <branch-name>
# Install dependencies
RUN npm install
# Generate the API docs
RUN npm run docs
# Expose the port the API will be served on.
EXPOSE 5021
# Start the application.
# start-memo-db.sh is mounted at runtime via docker-compose.
VOLUME start-memo-db.sh
CMD ["./start-memo-db.sh"]
@@ -0,0 +1,3 @@
#!/bin/bash
node index.js
@@ -0,0 +1,15 @@
# Environment variables for psf-memo-tx-indexer
# Copy this file to .env and modify as needed
PSF_MEMO_DB_URL=http://172.17.0.1:5021
RPC_IP=172.17.0.1
RPC_PORT=8332
ZMQ_PORT=28332
RPC_USER=bitcoin
RPC_PASS=password
TX_REST_API_PORT=5455
TX_REST_API_IP=172.17.0.1
SEEN_TX_MAX=100000
@@ -0,0 +1,53 @@
# Create a Dockerized tx indexer
#
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget zip unzip python3
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
RUN adduser safeuser sudo
#Set password to 'password' change value below if you want a different password
RUN echo safeuser:password | chpasswd
#Set the working directory to be the home directory
WORKDIR /home/safeuser
#Setup NPM for non-root global install
RUN mkdir /home/safeuser/.npm-global
RUN chown -R safeuser .npm-global
RUN echo "export PATH=~/.npm-global/bin:$PATH" >> /home/safeuser/.profile
RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
# Clone the psf-memo-indexer repository
WORKDIR /home/safeuser
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-indexer
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
WORKDIR /home/safeuser/psf-memo-indexer
# For development: switch to unstable branch
#RUN git checkout <branch-name>
# Install dependencies
RUN npm install
# Expose the port the API will be served on.
EXPOSE 5455
# Start the application.
# start-tx-indexer.sh is mounted at runtime via docker-compose.
VOLUME start-tx-indexer.sh
CMD ["./start-tx-indexer.sh"]
@@ -0,0 +1,3 @@
#!/bin/bash
node --max-old-space-size=4096 psf-memo-tx-indexer.js