Added initial caddy app

This commit is contained in:
b0xxer 2024-02-19 10:51:38 -06:00
parent c6d2270cfa
commit 81485f1685
6 changed files with 80 additions and 2 deletions

3
hosts
View File

@ -22,7 +22,7 @@ zerotier_network=
[n0xb0x:vars] [n0xb0x:vars]
hostname=n0xb0x hostname=n0xb0x
app_list=['bitcoin.yml','electrs.yml','clightning.yml','lnbits.yml','rtl.yml', 'docs.yml'] app_list=['caddy.yml','bitcoin.yml','electrs.yml','clightning.yml','lnbits.yml','rtl.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/
@ -30,6 +30,7 @@ registry_url=localhost
registry_user= registry_user=
registry_pass= registry_pass=
bitcoin_version=26.0 bitcoin_version=26.0
caddy_version=2.7.6
clightning_version=23.11.2 clightning_version=23.11.2
clightning_platform=Fedora-28-amd64 clightning_platform=Fedora-28-amd64
bitcoin_rpcuser=n0xb0x bitcoin_rpcuser=n0xb0x

View File

@ -0,0 +1,32 @@
- name: Create containers/caddy dir
ansible.builtin.file:
path: ~/containers/caddy
state: directory
- name: Create ~/vol/caddy dir
ansible.builtin.file:
path: ~/vol/caddy
state: directory
- name: Copy Containerfile
ansible.builtin.template:
path: caddy/Containerfile.j2
dest: ~/containers/caddy/Containerfile
- name: Copy caddy-node.container
ansible.builtin.template:
path: caddy/caddy-node.container.j2
dest: ~/containers/caddy/caddy-node.container
- name: Copy build.sh
ansible.builtin.template:
path: caddy/build.sh.j2
dest: ~/containers/caddy/build.sh
- name: Link caddy-node to .config/containers/systemd
ansible.builtin.file:
src: ~/conttainers/caddy/caddy-node.container
dest: ~/.config/containers/systemd/caddy-node.container
state: link
force: true

View File

@ -0,0 +1,20 @@
FROM docker.io/almalinux/9-minimal:latest AS builder
ARG VERSION={{caddy_version}}
WORKDIR /app
RUN dnf update -y \
&& dnf install -y wget tar gzip \
&& wget https://github.com/caddyserver/caddy/releases/download/v2.7.6/caddy_${VERSION}_linux_amd64.tar.gz \
&& wget https://github.com/caddyserver/caddy/releases/download/v2.7.6/caddy_${VERSION}_checksums.txt \
&& sha512sum --ignore-missing --check caddy_${VERSION}_checksums.txt \
&& tar xf caddy_${VERSION}_linux_amd64.tar.gz \
&& rm -f caddy_${VERSION}_linux.amd64.tar.gz LICENSE README.md caddy_${VERSION}_checksums.txt \
&& rm -rf /var/cache/* /var/log* /tmp/*
RUN chmod +x ./caddy
EXPOSE 8080 8443
ENTRYPOINT ["/app/caddy run --config /app/data/caddy.json"]

View File

@ -0,0 +1,4 @@
#!/bin/sh
#Build command to make container
buildah build -t caddy:{{ caddy_version }} --build-arg VERSION={{ caddy_version }} -f Containerfile

View File

@ -0,0 +1,22 @@
[Unit]
Description=Caddy Node
[Container]
# Use the centos image
Image={{ registry_url }}/caddy:{{ caddy_version }}
#Environment=RPCAUTH={{ bitcoin_rpcauth }}
# Use volume
Volume=/home/{{ansible_user}}/vol/caddy:/data: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

View File

@ -44,7 +44,6 @@
- zerotier-one - zerotier-one
- python3-pip - python3-pip
- smartmontools - smartmontools
- caddy
tags: install tags: install
- name: Install local tools - name: Install local tools