mid coding commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# Archipelago Alpine Profile
|
||||
|
||||
Custom Alpine Linux mkimage profile for Archipelago Bitcoin Node OS.
|
||||
|
||||
## Profile Structure
|
||||
|
||||
- `mkimg.archipelago.sh` - Main profile definition
|
||||
- `overlay/` - Files to overlay into the image
|
||||
- `etc/` - System configuration files
|
||||
- `etc/systemd/system/` - Systemd service files
|
||||
- `etc/init.d/` - OpenRC init scripts
|
||||
- `etc/local.d/` - Local startup scripts
|
||||
|
||||
## Customization
|
||||
|
||||
To modify the profile:
|
||||
|
||||
1. **Add packages**: Edit `mkimg.archipelago.sh` and add to `apks` variable
|
||||
2. **Add files**: Place files in `overlay/` directory with desired path structure
|
||||
3. **Modify kernel**: Change `kernel_flavors` or `initfs_features`
|
||||
4. **Change bootloader**: Modify `boot_addons`
|
||||
|
||||
## Profile Variables
|
||||
|
||||
- `apks` - List of Alpine packages to install
|
||||
- `kernel_flavors` - Kernel version (lts, edge, etc.)
|
||||
- `boot_addons` - Bootloader components
|
||||
- `initfs_features` - Initramfs features
|
||||
- `initfs_modules` - Kernel modules to include
|
||||
|
||||
## Build Integration
|
||||
|
||||
This profile is automatically copied to Alpine's aports repository during build and used by `mkimage.sh`.
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
# Alpine mkimage profile for Archipelago Bitcoin Node OS
|
||||
# Based on Alpine's standard profile
|
||||
|
||||
# Source the standard profile functions
|
||||
. "$(dirname "$0")/mkimg.standard.sh"
|
||||
|
||||
# Additional packages for Archipelago
|
||||
apks="$apks
|
||||
systemd
|
||||
systemd-openrc
|
||||
podman
|
||||
podman-compose
|
||||
crun
|
||||
fuse-overlayfs
|
||||
slirp4netns
|
||||
networkmanager
|
||||
networkmanager-openrc
|
||||
openssh
|
||||
openssh-openrc
|
||||
nginx
|
||||
nginx-openrc
|
||||
"
|
||||
|
||||
# Kernel flavor
|
||||
kernel_flavors="lts"
|
||||
|
||||
# Bootloader
|
||||
boot_addons="grub-efi"
|
||||
|
||||
# Initfs features
|
||||
initfs_features="base squashfs ext4 usb pcmcia scsi mmc nvme virtio"
|
||||
|
||||
# Initfs modules
|
||||
initfs_modules="loop squashfs"
|
||||
|
||||
# Post-install hook - called after base system is installed
|
||||
profile_apkovl() {
|
||||
local apkovl="$1"
|
||||
local apkroot="$2"
|
||||
|
||||
# Copy overlay files
|
||||
if [ -d "$(dirname "$0")/overlay" ]; then
|
||||
echo "📦 Installing overlay files..."
|
||||
cp -a "$(dirname "$0")/overlay/"* "$apkroot"/
|
||||
fi
|
||||
|
||||
# Install Archipelago APK if available
|
||||
local apk_file="$(dirname "$0")/../../apks/archipelago-backend-"*.apk"
|
||||
if ls $apk_file 1> /dev/null 2>&1; then
|
||||
echo "📦 Installing Archipelago backend APK..."
|
||||
cp $apk_file "$apkroot"/tmp/archipelago-backend.apk
|
||||
fi
|
||||
|
||||
# Create first boot script
|
||||
mkdir -p "$apkroot"/etc/local.d
|
||||
cat > "$apkroot"/etc/local.d/archipelago-install.start <<'INSTALL_EOF'
|
||||
#!/bin/sh
|
||||
# First boot installation script for Archipelago
|
||||
|
||||
# Install backend APK if available
|
||||
if [ -f /tmp/archipelago-backend.apk ]; then
|
||||
apk add --allow-untrusted /tmp/archipelago-backend.apk
|
||||
rm /tmp/archipelago-backend.apk
|
||||
fi
|
||||
|
||||
# Enable services
|
||||
rc-update add archipelago default 2>/dev/null || true
|
||||
systemctl enable archipelago 2>/dev/null || true
|
||||
|
||||
# Create archipelago user if needed
|
||||
if ! id archipelago >/dev/null 2>&1; then
|
||||
adduser -D -s /bin/bash archipelago
|
||||
echo "archipelago ALL=(ALL) NOPASSWD: /usr/bin/podman" >> /etc/sudoers
|
||||
fi
|
||||
|
||||
# Setup Podman for archipelago user
|
||||
mkdir -p /home/archipelago/.config/containers
|
||||
chown -R archipelago:archipelago /home/archipelago
|
||||
|
||||
# Create data directories
|
||||
mkdir -p /var/lib/archipelago/{apps,secrets,logs,backups}
|
||||
chown -R archipelago:archipelago /var/lib/archipelago
|
||||
|
||||
# Start services
|
||||
rc-service archipelago start 2>/dev/null || systemctl start archipelago 2>/dev/null || true
|
||||
INSTALL_EOF
|
||||
chmod +x "$apkroot"/etc/local.d/archipelago-install.start
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
data_dir = "/var/lib/archipelago"
|
||||
bind_host = "0.0.0.0"
|
||||
bind_port = 5959
|
||||
log_level = "info"
|
||||
dev_mode = false
|
||||
container_runtime = "podman"
|
||||
port_offset = 0
|
||||
bitcoin_simulation = "none"
|
||||
@@ -0,0 +1 @@
|
||||
archipelago
|
||||
@@ -0,0 +1,4 @@
|
||||
127.0.0.1 localhost archipelago
|
||||
::1 localhost archipelago ip6-localhost ip6-loopback
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/sbin/openrc-run
|
||||
# Archipelago Bitcoin Node OS Backend
|
||||
|
||||
name="Archipelago"
|
||||
command="/usr/bin/archipelago"
|
||||
command_user="archipelago:archipelago"
|
||||
command_background=true
|
||||
pidfile="/var/run/archipelago.pid"
|
||||
start_stop_daemon_args="--make-pidfile"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use podman
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
# First boot installation script for Archipelago
|
||||
# This script runs on first boot to complete Archipelago setup
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Archipelago first boot setup..."
|
||||
|
||||
# Install backend APK if available
|
||||
if [ -f /tmp/archipelago-backend.apk ]; then
|
||||
echo "📦 Installing Archipelago backend..."
|
||||
apk add --allow-untrusted /tmp/archipelago-backend.apk || true
|
||||
rm -f /tmp/archipelago-backend.apk
|
||||
fi
|
||||
|
||||
# Create archipelago user if needed
|
||||
if ! id archipelago >/dev/null 2>&1; then
|
||||
echo "👤 Creating archipelago user..."
|
||||
adduser -D -s /bin/bash archipelago || true
|
||||
echo "archipelago ALL=(ALL) NOPASSWD: /usr/bin/podman" >> /etc/sudoers || true
|
||||
fi
|
||||
|
||||
# Setup Podman for archipelago user
|
||||
echo "🐳 Configuring Podman..."
|
||||
mkdir -p /home/archipelago/.config/containers
|
||||
chown -R archipelago:archipelago /home/archipelago || true
|
||||
|
||||
# Create data directories
|
||||
echo "📁 Creating data directories..."
|
||||
mkdir -p /var/lib/archipelago/{apps,secrets,logs,backups}
|
||||
chown -R archipelago:archipelago /var/lib/archipelago || true
|
||||
|
||||
# Enable services
|
||||
echo "⚙️ Enabling services..."
|
||||
rc-update add archipelago default 2>/dev/null || true
|
||||
systemctl enable archipelago 2>/dev/null || true
|
||||
|
||||
# Start services
|
||||
echo "🚀 Starting services..."
|
||||
rc-service archipelago start 2>/dev/null || systemctl start archipelago 2>/dev/null || true
|
||||
|
||||
echo "✅ Archipelago setup complete!"
|
||||
echo " Web UI: http://$(hostname -I | awk '{print $1}'):8100"
|
||||
echo " API: http://$(hostname -I | awk '{print $1}'):5959"
|
||||
@@ -0,0 +1,29 @@
|
||||
[Unit]
|
||||
Description=Archipelago Bitcoin Node OS Backend
|
||||
After=network.target podman.service
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=archipelago
|
||||
Group=archipelago
|
||||
WorkingDirectory=/var/lib/archipelago
|
||||
ExecStart=/usr/bin/archipelago
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
# Security
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/archipelago /tmp
|
||||
|
||||
# Environment
|
||||
Environment="RUST_LOG=info"
|
||||
Environment="ARCHIPELAGO_DATA_DIR=/var/lib/archipelago"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user