Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ MANIFEST
venv*/

# User configuration with secrets
config.yml
/config.yml
node-secret.key
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ MANIFEST
venv*/

# Secret files
config.yml
/config.yml
node-secret.key
keys/
80 changes: 80 additions & 0 deletions deployment/docker-build/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
FROM ubuntu:22.04 as base

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get -y upgrade && apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa

# Runtime + build packages
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
git \
libgmp-dev \
libpq5 \
python3.12

FROM base as builder

RUN openssl version
RUN cat /etc/ssl/openssl.cnf
RUN echo "$OPENSSL_CONF"

# Build-only packages
RUN apt-get update && apt-get install -y \
build-essential \
curl \
pkg-config \
python3.12-dev \
python3.12-venv \
libpq-dev \
software-properties-common

# Install Rust to build Python packages
RUN curl https://sh.rustup.rs > rustup-installer.sh
RUN sh rustup-installer.sh -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Some packages (py-ed25519-bindings, required by substrate-interface) need the nightly
# Rust toolchain to be built at this time
RUN rustup default nightly

# Create virtualenv
RUN python3.12 -m venv /opt/venv

# Install pip
ENV PIP_NO_CACHE_DIR yes
RUN /opt/venv/bin/python3.12 -m pip install --upgrade pip wheel
ENV PATH="/opt/venv/bin:${PATH}"

WORKDIR /opt/pyaleph
COPY alembic.ini pyproject.toml ./
COPY LICENSE.txt README.md ./
COPY deployment/migrations ./deployment/migrations
COPY deployment/scripts ./deployment/scripts
COPY .git ./.git
COPY src ./src

RUN pip install -e .[linting]
RUN pip install hatch

FROM base

COPY --from=builder /opt/venv /opt/venv
COPY --from=builder /opt/pyaleph /opt/pyaleph

RUN apt-get update && apt-get install -y \
libsodium23 \
libsodium-dev \
libgmp-dev

# OpenSSL 3 disabled some hash algorithms by default. They must be reenabled
# by enabling the "legacy" providers in /etc/ssl/openssl.cnf.
COPY ./deployment/docker-build/openssl.cnf.patch /etc/ssl/openssl.cnf.patch
RUN patch /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.patch

RUN mkdir /var/lib/pyaleph

ENV PATH="/opt/venv/bin:${PATH}"
WORKDIR /opt/pyaleph

RUN hatch build
ENTRYPOINT ["bash", "deployment/scripts/run_aleph_ccn.sh"]
65 changes: 65 additions & 0 deletions deployment/docker-build/dev/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
nuls2:
chain_id: 1
enabled: false
packing_node: false
sync_address: NULSd6HgUkssMi6oSjwEn3puNSijLKnyiRV7H
api_url: https://apiserver.nuls.io/
explorer_url: https://nuls.world/
token_contract: NULSd6Hh1FjbnAktH1FFvFnTzfgFnZtgAhYut


ethereum:
enabled: true
# api_url: {{ ALEPH_ETHEREUM_URL }}
chain_id: 1
packing_node: false
sync_contract: "0x166fd4299364B21c7567e163d85D78d2fb2f8Ad5"
start_height: 21614811
token_contract: "0x27702a26126e0B3702af63Ee09aC4d1A084EF628"
token_start_height: 21614792


postgres:
host: postgres
port: 5432
user: aleph
password: decentralize-everything
name: aleph-test


storage:
store_files: true
engine: filesystem
folder: /var/lib/pyaleph


ipfs:
enabled: true
host: ipfs
port: 5001
gateway_port: 8080


aleph:
queue_topic: ALEPH-TEST


p2p:
daemon_host: p2p-service
http_port: 4024
port: 4025
control_port: 4030
listen_port: 4031
reconnect_delay: 60


rabbitmq:
host: rabbitmq
port: 5672
username: aleph-p2p
password: decentralize-everything


sentry:
dsn: ""
133 changes: 133 additions & 0 deletions deployment/docker-build/dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---

volumes:
pyaleph-ipfs:
pyaleph-local-storage:
pyaleph-postgres:


services:
pyaleph:
# platform: linux/amd64
restart: always
# image: alephim/pyaleph-node:0.5.8
image: localhost/alephim/pyaleph-node-dev:build
build:
dockerfile: ./deployment/docker-build/dev/Dockerfile
context: ../../..
command: --config /opt/pyaleph/config.yml --key-dir /opt/pyaleph/keys -v
volumes:
- pyaleph-local-storage:/var/lib/pyaleph
- ./config.yml:/opt/pyaleph/config.yml
- ./keys:/opt/pyaleph/keys
- ../../..:/opt/pyaleph
depends_on:
- postgres
- ipfs
- p2p-service
- redis
networks:
- pyaleph
logging:
options:
max-size: 50m

pyaleph-api:
# platform: linux/amd64
restart: always
# image: alephim/pyaleph-node:0.5.8
image: localhost/alephim/pyaleph-node:build
build:
dockerfile: ./deployment/docker-build/dev/Dockerfile
context: ../../..
command: --config /opt/pyaleph/config.yml --key-dir /opt/pyaleph/keys -v
entrypoint: ["bash", "deployment/scripts/run_aleph_ccn_api.sh"]
ports:
- "4024:4024/tcp"
volumes:
- pyaleph-local-storage:/var/lib/pyaleph
- ./config.yml:/opt/pyaleph/config.yml
- ../../..:/opt/pyaleph
environment:
CCN_CONFIG_API_PORT: 4024
CCN_CONFIG_API_NB_WORKERS: 8
depends_on:
- pyaleph
networks:
- pyaleph
logging:
options:
max-size: 50m

p2p-service:
restart: always
image: alephim/p2p-service:0.1.3
networks:
- pyaleph
volumes:
- ./config.yml:/etc/p2p-service/config.yml
- ./keys/node-secret.pkcs8.der:/etc/p2p-service/node-secret.pkcs8.der
depends_on:
- rabbitmq
environment:
RUST_LOG: info
ports:
- "4025:4025"
- "127.0.0.1:4030:4030"
command:
- "--config"
- "/etc/p2p-service/config.yml"
- "--private-key-file"
- "/etc/p2p-service/node-secret.pkcs8.der"

postgres:
restart: always
image: postgres:15.1
ports:
- "127.0.0.1:5432:5432"
volumes:
- pyaleph-postgres:/var/lib/postgresql/data
environment:
POSTGRES_USER: aleph
POSTGRES_PASSWORD: decentralize-everything
POSTGRES_DB: aleph
networks:
- pyaleph
shm_size: "2gb"

rabbitmq:
restart: always
image: rabbitmq:3.11.15-management
networks:
- pyaleph
environment:
RABBITMQ_DEFAULT_USER: aleph-p2p
RABBITMQ_DEFAULT_PASS: decentralize-everything
ports:
- "127.0.0.1:5672:5672"
- "127.0.0.1:15672:15672"

redis:
restart: always
image: redis:7.0.10
networks:
- pyaleph

ipfs:
restart: always
image: ipfs/kubo:v0.15.0
ports:
- "4001:4001"
- "4001:4001/udp"
- "127.0.0.1:5001:5001"
volumes:
- "pyaleph-ipfs:/data/ipfs"
environment:
- IPFS_PROFILE=server
networks:
- pyaleph
command: ["daemon", "--enable-pubsub-experiment", "--migrate"]


networks:
pyaleph:
78 changes: 78 additions & 0 deletions deployment/docker-build/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get -y upgrade && apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa

# Runtime + build packages
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
git \
libgmp-dev \
libpq5 \
python3.12

RUN openssl version
RUN cat /etc/ssl/openssl.cnf
RUN echo "$OPENSSL_CONF"

# Build-only packages
RUN apt-get update && apt-get install -y \
build-essential \
curl \
pkg-config \
python3.12-dev \
python3.12-venv \
libpq-dev \
software-properties-common

# Install Rust to build Python packages
RUN curl https://sh.rustup.rs > rustup-installer.sh
RUN sh rustup-installer.sh -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Some packages (py-ed25519-bindings, required by substrate-interface) need the nightly
# Rust toolchain to be built at this time
RUN rustup default nightly

# Create virtualenv
RUN python3.12 -m venv /opt/venv

# Install pip
ENV PIP_NO_CACHE_DIR yes
RUN /opt/venv/bin/python3.12 -m pip install --upgrade pip wheel
ENV PATH="/opt/venv/bin:${PATH}"

WORKDIR /opt/pyaleph
COPY alembic.ini pyproject.toml ./
COPY LICENSE.txt README.md ./
COPY deployment/migrations ./deployment/migrations
COPY deployment/scripts ./deployment/scripts
COPY .git ./.git
COPY src ./src

# Install project deps and test deps
RUN pip install -e .[testing,docs]
RUN pip install hatch

# Install project test deps
RUN apt-get update && apt-get install -y \
libsodium23 \
libsodium-dev \
libgmp-dev \
postgresql \
redis \
curl

# OpenSSL 3 disabled some hash algorithms by default. They must be reenabled
# by enabling the "legacy" providers in /etc/ssl/openssl.cnf.
COPY ./deployment/docker-build/openssl.cnf.patch /etc/ssl/openssl.cnf.patch
RUN patch /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.patch

RUN mkdir /var/lib/pyaleph
ENV PATH="/opt/venv/bin:${PATH}"
WORKDIR /opt/pyaleph

RUN hatch build
CMD ["hatch", "run", "testing:test"]

12 changes: 12 additions & 0 deletions deployment/docker-build/test/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
postgres:
host: postgres
port: 5432
user: aleph
password: decentralize-everything
database: aleph


redis:
host: redis
port: 6379
Loading
Loading