Working on clightning...

This commit is contained in:
barry 2024-02-13 16:09:10 -06:00
parent ca4bb66680
commit 81ba7decf1
7 changed files with 115 additions and 31 deletions

2
hosts
View File

@ -22,7 +22,7 @@ zerotier_network=
[n0xb0x:vars] [n0xb0x:vars]
hostname=n0xb0x hostname=n0xb0x
app_list=['bitcoin.yml','electrs.yml','docs.yml'] app_list=['bitcoin.yml','electrs.yml','clightning.yml','docs.yml']
ansible_user=n0xb0x ansible_user=n0xb0x
ansible_password=n0xb0x ansible_password=n0xb0x
#registry_url=git.boxxy.net/b0xxer/ #registry_url=git.boxxy.net/b0xxer/

View File

@ -17,6 +17,11 @@
chdir: ~/Containers/electrs chdir: ~/Containers/electrs
cmd: ./build.sh cmd: ./build.sh
- name: rebuild_clightning
ansible.builtin.shell:
chdir: ~/Containers/clightning
cmd: ./build.sh
- name: rebuild_docs - name: rebuild_docs
ansible.builtin.shell: ansible.builtin.shell:
chdir: ~/Containers/docs chdir: ~/Containers/docs

View File

@ -0,0 +1,40 @@
---
# tasks file for build
#
- name: clightning - Create .clightning dir
ansible.builtin.file:
path: ~/.clightning
state: directory
- name: clightning - Copy clightning-node.container file
ansible.builtin.template:
src: clightning/clightning-node.container.j2
dest: /home/{{ ansible_user }}/.config/containers/systemd/clightning-node.container
notify: reload_systemctl
- name: clightning - Create Containers/bitcoin Dir
ansible.builtin.file:
path: ~/Containers/clightning
recurse: true
state: directory
notify: rebuild_clightning
- name: clightning - Copy Containerfile Template
ansible.builtin.template:
src: clightning/Containerfile.j2
dest: ~/Containers/clightning/Containerfile
notify: rebuild_clightning
- name: clightning - Copy entrypoint.sh
ansible.builtin.copy:
src: clightning/entrypoint.sh
dest: ~/Containers/clightning/entrypoint.sh
- name: clightning - Copy build script
ansible.builtin.template:
src: clightning/build.sh.j2
dest: ~/Containers/clightning/build.sh
mode: '0700'
notify: rebuild_clightning

View File

@ -1,5 +1,8 @@
--- ---
#- name: Test app-list for exclusions / conflicts
# msg: test
- name: Install apps - name: Install apps
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: "{{ item }}" file: "{{ item }}"

View File

@ -1,45 +1,48 @@
FROM docker.io/almalinux/9-minimal:latest as build FROM docker.io/almalinux/9-base:latest AS builder
RUN microdnf update -y && microdnf install -y ca-certificates \ ARG BVERSION={{bitcoin_version}}
ARG CLVERSION={{clightning_version}}
ARG BITCOIN_CORE_SIGNATURE=71A3B16735405025D447E8F274810B012346C9A6
# Update and Build clightning
RUN dnf update -y && dnf install -y epel-release \
&& dnf install -y automake autoconf python3-mako libtool clang gettext git \
gmp-devel libsq3-devel python3-devel python3-pip python3-setuptools net-tools valgrind wget zlib-devel libsodium-devel \
&& dnf clean all \
&& git clone https://github.com/ElementsProject/lightning.git && cd lightning && git checkout v$CLVERSION && ./configure && make && make install
# Download and verify bitcoin
RUN mkdir /tmp/bitcoin && cd /tmp/bitcoin
RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys ${BITCOIN_CORE_SIGNATURE} \
&& gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys F4FC70F07310028424EFC20A8E4256593F177720 \
&& wget https://bitcoincore.org/bin/bitcoin-core-${BVERSION}/SHA256SUMS.asc \
&& wget https://bitcoincore.org/bin/bitcoin-core-${BVERSION}/SHA256SUMS \
&& wget https://bitcoincore.org/bin/bitcoin-core-${BVERSION}/bitcoin-${BVERSION}-x86_64-linux-gnu.tar.gz \
&& gpg --verify --status-fd 1 --verify SHA256SUMS.asc SHA256SUMS 2>/dev/null | grep "VALIDSIG" \
&& sha256sum --ignore-missing --check SHA256SUMS \
&& tar -xzvf bitcoin-${BVERSION}-x86_64-linux-gnu.tar.gz --strip=1 -C /usr/local
FROM docker.io/almalinux/9-base:latest
RUN dnf update -y && dnf install -y ca-certificates \
gnupg2 \ gnupg2 \
libatomic \ libatomic \
wget \ wget \
tar \ tar \
gzip \ gzip \
&& microdnf clean all && rm -fr /tmp/* /var/tmp/* shadow-utils \
python3 \
&& dnf clean all && rm -fr /tmp/* /var/tmp/*
ARG BVERSION={{bitcoin_version}}
ARG CLVERSION={{clightning_version}}
ARG CLPLATFORM={{clightning_platform}}
ARG BITCOIN_CORE_SIGNATURE=71A3B16735405025D447E8F274810B012346C9A6
RUN mkdir /tmp/bitcoin && cd /tmp/bitcoin \ COPY --from=builder /usr/local/ /usr/local/
&& gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys ${BITCOIN_CORE_SIGNATURE} \
&& wget https://bitcoincore.org/bin/bitcoin-core-${BVERSION}/SHA256SUMS.asc \
https://bitcoincore.org/bin/bitcoin-core-${BVERSION}/SHA256SUMS \
https://bitcoincore.org/bin/bitcoin-core-${BVERSION}/bitcoin-${BVERSION}-x86_64-linux-gnu.tar.gz \
&& gpg --verify --status-fd 1 --verify SHA256SUMS.asc SHA256SUMS 2>/dev/null | grep "^\[GNUPG:\] VALIDSIG.*${BITCOIN_CORE_SIGNATURE}\$" \
&& sha256sum --ignore-missing --check SHA256SUMS \
&& tar -xzvf bitcoin-${BVERSION}-x86_64-linux-gnu.tar.gz --strip=1 -C / \
&& rm -v /bin/test_bitcoin /bin/bitcoin-qt /bin/bitcoind \
&& mkdir /tmp/clightning && cd /tmp/clightning \
&& wget https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/cdecker.txt \
&& wget https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/rustyrussell.txt \
&& gpg --import cdecker.txt rustyrussell.txt \
&& wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/clightning-v${CLVERSION}-${CLPLATFORM}.tar.gz \
&& wget https://https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/SHA256SUMS \
&& wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/SHA256SUMS.asc \
&& gpg --verify --status-fd 1 --verify SHA256SUMS.asc SHA256SUMS 2>/dev/null | grep "^\[GNUPG:\].VALIDSIG" \
&& sha256sum --ignore-missing --check SHA256SUMS \
&& tar -xzvf clightning-v${CLVERSION}-${CLPLATFORM}.tar.gz -C /
COPY entrypoint.sh /entrypoint.sh COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
EXPOSE 9735 9835 EXPOSE 9735 9835
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["lightningd"]

View File

@ -0,0 +1,10 @@
#! /bin/sh
#
# build.sh
# Copyright (C) 2024 barry <barry@e14>
#
# Distributed under terms of the MIT license.
#
echo 0

View File

@ -0,0 +1,23 @@
[Unit]
Description=Core Lightning Server
[Container]
Image={{ registry_url }}/clightning:{{ clightning_version }}
PodmanArgs=--pod bitcoin-pod
Exec=--rpcuser={{bitcoin_rpcuser}} --rpcpassword={{bitcoin_rpcpassword}}
# Use volume
Volume=/home/{{ansible_user}}/.bitcoin:/data/.bitcoin:ro,Z
Volume=/home/{{ansible_user}}/.lightning:/data/.lightning:Z
[Service]
# Restart service when sleep finishes
Restart=always
# Extend Timeout to allow time to pull the image
TimeoutStartSec=900
# ExecStartPre flag and other systemd commands can go here, see systemd.unit(5) man page.
# ExecStartPre=/usr/share/mincontainer/setup.sh
[Install]
# Start by default on boot
WantedBy=multi-user.target default.target