Archipelago — open-source initial import
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# Build Scripts
|
||||
|
||||
Helper scripts for building Archipelago OS images.
|
||||
|
||||
## Scripts
|
||||
|
||||
### `build-backend.sh`
|
||||
Compiles the Archipelago Rust backend binary.
|
||||
- Output: `../build/backend/archipelago`
|
||||
- Requires: Rust toolchain (or Docker)
|
||||
- Builds for Linux x86_64
|
||||
|
||||
### `build-frontend.sh`
|
||||
Builds the Vue.js frontend for production.
|
||||
- Output: `../build/frontend/`
|
||||
- Requires: Node.js 18+, npm
|
||||
- Builds static files for serving
|
||||
|
||||
### `convert-iso-to-disk.sh`
|
||||
Converts ISO image to raw disk image.
|
||||
- Input: ISO file
|
||||
- Output: `.img` file ready for `dd`
|
||||
- Creates partition layout (EFI + root)
|
||||
|
||||
### `check-dependencies.sh`
|
||||
Checks if all build dependencies are available.
|
||||
- Checks: Rust, Node.js, Docker, xorriso
|
||||
- Provides installation instructions
|
||||
- Non-blocking (warns but continues)
|
||||
|
||||
### `install-podman.sh`
|
||||
Installs Podman container runtime.
|
||||
- For use inside the target system
|
||||
- Configures rootless Podman
|
||||
|
||||
## Usage
|
||||
|
||||
These scripts are called automatically by the main build process. You can also run them manually for testing:
|
||||
|
||||
```bash
|
||||
# Build just the backend
|
||||
./scripts/build-backend.sh
|
||||
|
||||
# Build just the frontend
|
||||
./scripts/build-frontend.sh
|
||||
|
||||
# Check dependencies
|
||||
./scripts/check-dependencies.sh
|
||||
```
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
# Build Archipelago backend binary for Debian Linux
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
BACKEND_DIR="$PROJECT_ROOT/core/archipelago"
|
||||
OUTPUT_DIR="$SCRIPT_DIR/../build/backend"
|
||||
|
||||
echo "🔨 Building Archipelago backend..."
|
||||
echo " Source: $BACKEND_DIR"
|
||||
echo " Output: $OUTPUT_DIR"
|
||||
echo ""
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Check if we should use Docker
|
||||
USE_DOCKER=false
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
USE_DOCKER=true
|
||||
echo "🍎 macOS detected - using Docker for Linux build"
|
||||
elif ! command -v rustc >/dev/null 2>&1; then
|
||||
USE_DOCKER=true
|
||||
echo "⚠️ Rust not found - using Docker"
|
||||
fi
|
||||
|
||||
if [ "$USE_DOCKER" = true ]; then
|
||||
echo "🐳 Building in Docker container..."
|
||||
docker run --rm \
|
||||
-v "$PROJECT_ROOT:/workspace" \
|
||||
-v "$OUTPUT_DIR:/output" \
|
||||
-w /workspace/core/archipelago \
|
||||
rust:trixie \
|
||||
sh -c '
|
||||
echo "📦 Installing build dependencies..."
|
||||
apt-get update && apt-get install -y pkg-config libssl-dev
|
||||
|
||||
echo "🔨 Building Archipelago backend..."
|
||||
cargo build --release
|
||||
|
||||
echo "📋 Copying binary to output..."
|
||||
cp ../target/release/archipelago /output/
|
||||
|
||||
echo "✅ Build complete!"
|
||||
ls -lh /output/archipelago
|
||||
'
|
||||
else
|
||||
# Native Linux build
|
||||
echo "🐧 Building natively..."
|
||||
cd "$BACKEND_DIR"
|
||||
cargo build --release
|
||||
|
||||
cp "../target/release/archipelago" "$OUTPUT_DIR/archipelago"
|
||||
fi
|
||||
|
||||
# Strip binary for smaller size
|
||||
if [ -f "$OUTPUT_DIR/archipelago" ]; then
|
||||
if command -v strip >/dev/null 2>&1 && [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
strip "$OUTPUT_DIR/archipelago"
|
||||
fi
|
||||
echo ""
|
||||
echo "✅ Backend built: $OUTPUT_DIR/archipelago"
|
||||
ls -lh "$OUTPUT_DIR/archipelago"
|
||||
else
|
||||
echo "❌ Build failed - binary not found"
|
||||
exit 1
|
||||
fi
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# Build Archipelago frontend for production
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
FRONTEND_DIR="$PROJECT_ROOT/neode-ui"
|
||||
OUTPUT_DIR="$SCRIPT_DIR/../build/frontend"
|
||||
|
||||
echo "🎨 Building Archipelago frontend..."
|
||||
echo " Source: $FRONTEND_DIR"
|
||||
echo " Output: $OUTPUT_DIR"
|
||||
echo ""
|
||||
|
||||
# Check if Node.js is installed
|
||||
if ! command -v node >/dev/null 2>&1; then
|
||||
echo "❌ Node.js not found. Please install Node.js 18+"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Install dependencies if needed
|
||||
cd "$FRONTEND_DIR"
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "📦 Installing frontend dependencies..."
|
||||
npm install
|
||||
fi
|
||||
|
||||
# Build frontend
|
||||
echo "🔨 Building frontend..."
|
||||
DOCKER_BUILD=true npm run build || npm run build
|
||||
|
||||
# Copy built files
|
||||
if [ -d "dist" ]; then
|
||||
cp -r dist/* "$OUTPUT_DIR/"
|
||||
elif [ -d "../web/dist/neode-ui" ]; then
|
||||
cp -r ../web/dist/neode-ui/* "$OUTPUT_DIR/"
|
||||
else
|
||||
echo "❌ Build output not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Frontend built: $OUTPUT_DIR"
|
||||
du -sh "$OUTPUT_DIR"
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
# Check build dependencies and provide installation instructions
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Checking build dependencies..."
|
||||
echo ""
|
||||
|
||||
MISSING_DEPS=0
|
||||
|
||||
# Check Rust
|
||||
if command -v rustc >/dev/null 2>&1; then
|
||||
echo "✅ Rust: $(rustc --version)"
|
||||
else
|
||||
echo "❌ Rust: Not found"
|
||||
echo " Install: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
# Check Node.js
|
||||
if command -v node >/dev/null 2>&1; then
|
||||
NODE_VERSION=$(node --version)
|
||||
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1 | tr -d 'v')
|
||||
if [ "$NODE_MAJOR" -ge 18 ]; then
|
||||
echo "✅ Node.js: $NODE_VERSION"
|
||||
else
|
||||
echo "⚠️ Node.js: $NODE_VERSION (need 18+)"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
else
|
||||
echo "❌ Node.js: Not found"
|
||||
echo " Install: https://nodejs.org/"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
# Check Docker
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
if docker info >/dev/null 2>&1; then
|
||||
echo "✅ Docker: $(docker --version)"
|
||||
else
|
||||
echo "⚠️ Docker: Installed but daemon not running"
|
||||
echo " Start Docker Desktop or: sudo systemctl start docker"
|
||||
fi
|
||||
else
|
||||
echo "❌ Docker: Not found"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: https://www.docker.com/products/docker-desktop"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
else
|
||||
echo " Install: https://docs.docker.com/get-docker/"
|
||||
echo " (Optional on Linux if building natively)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check xorriso (for ISO creation)
|
||||
if command -v xorriso >/dev/null 2>&1; then
|
||||
echo "✅ xorriso: Installed"
|
||||
else
|
||||
echo "❌ xorriso: Not found (needed for ISO creation)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: brew install xorriso"
|
||||
else
|
||||
echo " Install: apt-get install xorriso"
|
||||
fi
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
# Check 7z (for ISO extraction)
|
||||
if command -v 7z >/dev/null 2>&1; then
|
||||
echo "✅ 7z: Installed"
|
||||
else
|
||||
echo "❌ 7z: Not found (needed for ISO extraction)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: brew install p7zip"
|
||||
else
|
||||
echo " Install: apt-get install p7zip-full"
|
||||
fi
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [ $MISSING_DEPS -eq 0 ]; then
|
||||
echo "✅ All dependencies satisfied!"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ Missing $MISSING_DEPS dependency/dependencies"
|
||||
echo " Please install missing dependencies before building"
|
||||
exit 1
|
||||
fi
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
# Podman Installation and Configuration Script for Archipelago
|
||||
# Configures Podman for rootless operation
|
||||
|
||||
set -e
|
||||
|
||||
echo "🐳 Configuring Podman for rootless operation..."
|
||||
|
||||
if ! command -v catatonit >/dev/null 2>&1; then
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update || true
|
||||
apt-get install -y catatonit || true
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y catatonit || true
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
apk add catatonit || true
|
||||
fi
|
||||
fi
|
||||
|
||||
command -v catatonit >/dev/null 2>&1 || echo "WARNING: catatonit not installed; Podman init-enabled containers may fail"
|
||||
|
||||
# Ensure archipelago user exists
|
||||
if ! id "archipelago" &>/dev/null; then
|
||||
echo "Creating archipelago user..."
|
||||
adduser -D -s /bin/bash archipelago
|
||||
fi
|
||||
|
||||
# Create Podman configuration directories
|
||||
mkdir -p /home/archipelago/.config/containers
|
||||
mkdir -p /home/archipelago/.local/share/containers/storage
|
||||
|
||||
# Configure storage
|
||||
cat > /home/archipelago/.config/containers/storage.conf <<EOF
|
||||
[storage]
|
||||
driver = "overlay"
|
||||
runroot = "/run/user/$(id -u archipelago)/containers"
|
||||
graphroot = "/home/archipelago/.local/share/containers/storage"
|
||||
EOF
|
||||
|
||||
# Configure registries (use Docker Hub and quay.io)
|
||||
mkdir -p /home/archipelago/.config/containers/registries.conf.d
|
||||
cat > /home/archipelago/.config/containers/registries.conf <<EOF
|
||||
unqualified-search-registries = ["docker.io", "ghcr.io", "quay.io", "146.59.87.168:3000"]
|
||||
|
||||
[[registry]]
|
||||
location = "146.59.87.168:3000"
|
||||
insecure = true
|
||||
EOF
|
||||
|
||||
# Set up subuid and subgid for rootless containers
|
||||
if ! grep -q "^archipelago:" /etc/subuid; then
|
||||
echo "archipelago:100000:65536" >> /etc/subuid
|
||||
fi
|
||||
|
||||
if ! grep -q "^archipelago:" /etc/subgid; then
|
||||
echo "archipelago:100000:65536" >> /etc/subgid
|
||||
fi
|
||||
|
||||
# Create systemd user service directory
|
||||
mkdir -p /home/archipelago/.config/systemd/user
|
||||
|
||||
# Enable lingering for archipelago user (allows user services to run without login)
|
||||
loginctl enable-linger archipelago || true
|
||||
|
||||
# Ensure /run/user/1000 exists for podman socket
|
||||
mkdir -p /run/user/1000
|
||||
chown archipelago:archipelago /run/user/1000
|
||||
chmod 700 /run/user/1000
|
||||
|
||||
# Enable podman API socket for archipelago user (backend connects via this)
|
||||
su - archipelago -c "XDG_RUNTIME_DIR=/run/user/1000 systemctl --user enable podman.socket" || true
|
||||
su - archipelago -c "XDG_RUNTIME_DIR=/run/user/1000 systemctl --user start podman.socket" || true
|
||||
|
||||
# Set proper permissions
|
||||
chown -R archipelago:archipelago /home/archipelago/.config
|
||||
chown -R archipelago:archipelago /home/archipelago/.local
|
||||
|
||||
echo "✅ Podman configuration complete!"
|
||||
Reference in New Issue
Block a user