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 WORKDIR /opt
RUN wget -qO /opt/tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \ RUN wget -qO /tini "https://github.com/krallin/tini/releases/download/v0.18.0/tini" \
&& echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /opt/tini" | sha256sum -c - \ && echo "12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855 /tini" | sha256sum -c - \
&& chmod +x /opt/tini && chmod +x /tini
ARG BITCOIN_VERSION=24.0.1 ARG BITCOIN_VERSION=24.0.1
ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz 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 FROM debian:bullseye-slim as builder
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ARG LIGHTNINGD_VERSION=v23.05.2 ARG LIGHTNINGD_VERSION=v23.08
RUN apt-get update -qq && \ RUN apt-get update -qq && \
apt-get install -qq -y --no-install-recommends \ apt-get install -qq -y --no-install-recommends \
autoconf \ autoconf \
@ -55,13 +54,18 @@ RUN apt-get update -qq && \
libpq-dev \ libpq-dev \
libtool \ libtool \
libffi-dev \ libffi-dev \
pkg-config \
libssl-dev \
protobuf-compiler \ protobuf-compiler \
python3 \ python3.9 \
python3-dev \ python3-dev \
python3-mako \ python3-mako \
python3-pip \ python3-pip \
python3-venv \ python3-venv \
python3-setuptools \ python3-setuptools \
libev-dev \
libevent-dev \
qemu-user-static \
wget wget
# RUN apt-get install -y --no-install-recommends \ # RUN apt-get install -y --no-install-recommends \
@ -87,12 +91,12 @@ RUN apt-get install -y --no-install-recommends unzip tclsh \
&& make \ && make \
&& make install && cd .. && rm sqlite-src-3290000.zip && rm -rf sqlite-src-3290000 && 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 \ # RUN wget -q https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz \
&& tar xvf gmp-6.1.2.tar.xz \ # && tar xvf gmp-6.1.2.tar.xz \
&& cd gmp-6.1.2 \ # && cd gmp-6.1.2 \
&& ./configure --disable-assembly \ # && ./configure --disable-assembly \
&& make \ # && make \
&& make install && cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2 # && make install && cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2
ENV RUST_PROFILE=release ENV RUST_PROFILE=release
ENV PATH=$PATH:/root/.cargo/bin/ ENV PATH=$PATH:/root/.cargo/bin/
@ -110,18 +114,21 @@ RUN cd /tmp/cln-grpc-hold \
&& cargo build --release && cargo build --release
ENV PYTHON_VERSION=3 ENV PYTHON_VERSION=3
RUN curl -sSL https://install.python-poetry.org | python3 - \ RUN curl -sSL https://install.python-poetry.org | python3 -
&& pip3 install -U pip \
&& pip3 install -U wheel \ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
&& /root/.local/bin/poetry install
RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 wheel cryptography
RUN pip3 install grpcio-tools
RUN ./configure --prefix=/tmp/lightning_install --enable-static && \ RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
make DEVELOPER=${DEVELOPER} && \ make DEVELOPER=${DEVELOPER} && \
/root/.local/bin/poetry run make install /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 && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
@ -132,6 +139,10 @@ RUN apt-get update && \
libpq5 && \ libpq5 && \
rm -rf /var/lib/apt/lists/* 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_DATA=/root/.lightning
ENV LIGHTNINGD_RPC_PORT=9835 ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735 ENV LIGHTNINGD_PORT=9735
@ -141,8 +152,10 @@ RUN mkdir $LIGHTNINGD_DATA && \
touch $LIGHTNINGD_DATA/config touch $LIGHTNINGD_DATA/config
VOLUME [ "/root/.lightning" ] VOLUME [ "/root/.lightning" ]
COPY --from=builder /tmp/lightning_install/ /usr/local/ 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=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 /opt/bitcoin/bin /usr/bin
COPY --from=downloader "/tini" /usr/bin/tini
COPY config /tmp/config COPY config /tmp/config
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh entrypoint.sh
RUN chmod +x 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.conf import settings
from django.contrib.auth.models import AnonymousUser, User, update_last_login from django.contrib.auth.models import AnonymousUser, User, update_last_login
from django.utils.deprecation import MiddlewareMixin from django.utils.deprecation import MiddlewareMixin
from django.db import IntegrityError
from rest_framework.authtoken.models import Token from rest_framework.authtoken.models import Token
from rest_framework.exceptions import AuthenticationFailed from rest_framework.exceptions import AuthenticationFailed
from robohash import Robohash from robohash import Robohash
@ -31,6 +30,7 @@ class DisableCSRFMiddleware(object):
response = self.get_response(request) response = self.get_response(request)
return response return response
class SplitAuthorizationHeaderMiddleware(MiddlewareMixin): class SplitAuthorizationHeaderMiddleware(MiddlewareMixin):
""" """
This middleware splits the HTTP_AUTHORIZATION, leaves on it only the `Token ` and creates This middleware splits the HTTP_AUTHORIZATION, leaves on it only the `Token ` and creates
@ -50,6 +50,7 @@ class SplitAuthorizationHeaderMiddleware(MiddlewareMixin):
request.META["PUBLIC_KEY"] = split_auth[1] request.META["PUBLIC_KEY"] = split_auth[1]
request.META["ENCRYPTED_PRIVATE_KEY"] = split_auth[2] request.META["ENCRYPTED_PRIVATE_KEY"] = split_auth[2]
class RobotTokenSHA256AuthenticationMiddleWare: class RobotTokenSHA256AuthenticationMiddleWare:
""" """
Builds on django-rest-framework Token Authentication. Builds on django-rest-framework Token Authentication.
@ -66,7 +67,6 @@ class RobotTokenSHA256AuthenticationMiddleWare:
self.get_response = get_response self.get_response = get_response
def __call__(self, request): def __call__(self, request):
token_sha256_b91 = request.META.get("HTTP_AUTHORIZATION", "").replace( token_sha256_b91 = request.META.get("HTTP_AUTHORIZATION", "").replace(
"Token ", "" "Token ", ""
) )
@ -143,7 +143,6 @@ class RobotTokenSHA256AuthenticationMiddleWare:
# Generate avatar. Does not replace if existing. # Generate avatar. Does not replace if existing.
image_path = avatar_path.joinpath(nickname + ".webp") image_path = avatar_path.joinpath(nickname + ".webp")
if not image_path.exists(): if not image_path.exists():
rh = Robohash(hash) rh = Robohash(hash)
rh.assemble(roboset="set1", bgset="any") # for backgrounds ON rh.assemble(roboset="set1", bgset="any") # for backgrounds ON
with open(image_path, "wb") as f: with open(image_path, "wb") as f:

View File

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