Bump CLN docker to v23.08 and other fixes

This commit is contained in:
Reckless_Satoshi 2023-09-06 08:22:16 -07:00
parent ae9fdd72c6
commit e0bd9fa59a
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 35 additions and 24 deletions

View File

@ -18,9 +18,9 @@ RUN set -ex \
WORKDIR /opt
RUN wget -qO /opt/tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \
&& echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /opt/tini" | sha256sum -c - \
&& chmod +x /opt/tini
RUN wget -qO /tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \
&& echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /tini" | sha256sum -c - \
&& chmod +x /tini
ARG BITCOIN_VERSION=24.0.1
ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
@ -39,8 +39,7 @@ RUN mkdir /opt/bitcoin && cd /opt/bitcoin \
FROM debian:bullseye-slim as builder
ARG DEBIAN_FRONTEND=noninteractive
ARG LIGHTNINGD_VERSION=v23.05.2
ARG LIGHTNINGD_VERSION=v23.08
RUN apt-get update -qq && \
apt-get install -qq -y --no-install-recommends \
autoconf \
@ -55,13 +54,18 @@ RUN apt-get update -qq && \
libpq-dev \
libtool \
libffi-dev \
pkg-config \
libssl-dev \
protobuf-compiler \
python3 \
python3.9 \
python3-dev \
python3-mako \
python3-pip \
python3-venv \
python3-setuptools \
libev-dev \
libevent-dev \
qemu-user-static \
wget
# RUN apt-get install -y --no-install-recommends \
@ -87,12 +91,12 @@ RUN apt-get install -y --no-install-recommends unzip tclsh \
&& make \
&& make install && cd .. && rm sqlite-src-3290000.zip && rm -rf sqlite-src-3290000
RUN wget -q https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz \
&& tar xvf gmp-6.1.2.tar.xz \
&& cd gmp-6.1.2 \
&& ./configure --disable-assembly \
&& make \
&& make install && cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2
# RUN wget -q https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz \
# && tar xvf gmp-6.1.2.tar.xz \
# && cd gmp-6.1.2 \
# && ./configure --disable-assembly \
# && make \
# && make install && cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2
ENV RUST_PROFILE=release
ENV PATH=$PATH:/root/.cargo/bin/
@ -110,18 +114,21 @@ RUN cd /tmp/cln-grpc-hold \
&& cargo build --release
ENV PYTHON_VERSION=3
RUN curl -sSL https://install.python-poetry.org | python3 - \
&& pip3 install -U pip \
&& pip3 install -U wheel \
&& /root/.local/bin/poetry install
RUN curl -sSL https://install.python-poetry.org | python3 -
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 wheel cryptography
RUN pip3 install grpcio-tools
RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
make DEVELOPER=${DEVELOPER} && \
/root/.local/bin/poetry run make install
FROM debian:bullseye-slim as final
RUN pip3 install -r plugins/clnrest/requirements.txt
COPY --from=downloader /opt/tini /usr/bin/tini
FROM debian:bullseye-slim as final
RUN apt-get update && \
apt-get install -y --no-install-recommends \
@ -132,6 +139,10 @@ RUN apt-get update && \
libpq5 && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install flask gunicorn json5
RUN pip3 install --user flask_restx pyln-client
ENV LIGHTNINGD_DATA=/root/.lightning
ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735
@ -141,8 +152,10 @@ RUN mkdir $LIGHTNINGD_DATA && \
touch $LIGHTNINGD_DATA/config
VOLUME [ "/root/.lightning" ]
COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=builder /usr/local/lib/python3.9/dist-packages/ /usr/local/lib/python3.9/dist-packages/
COPY --from=builder /tmp/cln-grpc-hold/target/release/cln-grpc-hold /tmp/cln-grpc-hold
COPY --from=downloader /opt/bitcoin/bin /usr/bin
COPY --from=downloader "/tini" /usr/bin/tini
COPY config /tmp/config
COPY entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh

View File

@ -6,7 +6,6 @@ from channels.middleware import BaseMiddleware
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User, update_last_login
from django.utils.deprecation import MiddlewareMixin
from django.db import IntegrityError
from rest_framework.authtoken.models import Token
from rest_framework.exceptions import AuthenticationFailed
from robohash import Robohash
@ -31,6 +30,7 @@ class DisableCSRFMiddleware(object):
response = self.get_response(request)
return response
class SplitAuthorizationHeaderMiddleware(MiddlewareMixin):
"""
This middleware splits the HTTP_AUTHORIZATION, leaves on it only the `Token ` and creates
@ -44,12 +44,13 @@ class SplitAuthorizationHeaderMiddleware(MiddlewareMixin):
def process_request(self, request):
auth_header = request.META.get("HTTP_AUTHORIZATION", "")
split_auth = auth_header.split(" | ")
if len(split_auth) == 3:
request.META["HTTP_AUTHORIZATION"] = split_auth[0]
request.META["PUBLIC_KEY"] = split_auth[1]
request.META["ENCRYPTED_PRIVATE_KEY"] = split_auth[2]
class RobotTokenSHA256AuthenticationMiddleWare:
"""
Builds on django-rest-framework Token Authentication.
@ -66,7 +67,6 @@ class RobotTokenSHA256AuthenticationMiddleWare:
self.get_response = get_response
def __call__(self, request):
token_sha256_b91 = request.META.get("HTTP_AUTHORIZATION", "").replace(
"Token ", ""
)
@ -95,7 +95,7 @@ class RobotTokenSHA256AuthenticationMiddleWare:
public_key = ""
encrypted_private_key = ""
public_key = request.META.get("PUBLIC_KEY", "").replace("Public ", "")
encrypted_private_key = request.META.get(
"ENCRYPTED_PRIVATE_KEY", ""
@ -143,7 +143,6 @@ class RobotTokenSHA256AuthenticationMiddleWare:
# Generate avatar. Does not replace if existing.
image_path = avatar_path.joinpath(nickname + ".webp")
if not image_path.exists():
rh = Robohash(hash)
rh.assemble(roboset="set1", bgset="any") # for backgrounds ON
with open(image_path, "wb") as f:

View File

@ -149,7 +149,6 @@ SPECTACULAR_SETTINGS = {
}
MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
"django.middleware.security.SecurityMiddleware",