Files
thrillwiki_django_no_react/scripts/unraid/README-NON-INTERACTIVE.md
pacnpal c26414ff74 Add comprehensive tests for Parks API and models
- Implemented extensive test cases for the Parks API, covering endpoints for listing, retrieving, creating, updating, and deleting parks.
- Added tests for filtering, searching, and ordering parks in the API.
- Created tests for error handling in the API, including malformed JSON and unsupported methods.
- Developed model tests for Park, ParkArea, Company, and ParkReview models, ensuring validation and constraints are enforced.
- Introduced utility mixins for API and model testing to streamline assertions and enhance test readability.
- Included integration tests to validate complete workflows involving park creation, retrieval, updating, and deletion.
2025-08-17 19:36:20 -04:00

4.3 KiB

Non-Interactive Mode for ThrillWiki Automation

The ThrillWiki automation script supports a non-interactive mode (-y flag) that allows you to run the entire setup process without any user prompts. This is perfect for:

  • CI/CD pipelines
  • Automated deployments
  • Scripted environments
  • Remote execution

Prerequisites

  1. Saved Configuration: You must have run the script interactively at least once to create the saved configuration file (.thrillwiki-config).

  2. Environment Variables: Set the required environment variables for sensitive credentials that aren't saved to disk.

Required Environment Variables

Always Required

  • UNRAID_PASSWORD - Your Unraid server password

Required if GitHub API is enabled

  • GITHUB_TOKEN - Your GitHub personal access token (if using token auth method)

Required if Webhooks are enabled

  • WEBHOOK_SECRET - Your GitHub webhook secret

Usage Examples

Basic Non-Interactive Setup

# Set required credentials
export UNRAID_PASSWORD="your_unraid_password"
export GITHUB_TOKEN="your_github_token"  
export WEBHOOK_SECRET="your_webhook_secret"

# Run in non-interactive mode
./setup-complete-automation.sh -y

CI/CD Pipeline Example

#!/bin/bash
set -e

# Load credentials from secure environment
export UNRAID_PASSWORD="$UNRAID_CREDS_PASSWORD"
export GITHUB_TOKEN="$GITHUB_API_TOKEN"
export WEBHOOK_SECRET="$WEBHOOK_SECRET_KEY"

# Deploy with no user interaction
cd scripts/unraid
./setup-complete-automation.sh -y

Docker/Container Example

# Run from container with environment file
docker run --env-file ***REMOVED***.secrets \
  -v $(pwd):/workspace \
  your-automation-container \
  /workspace/scripts/unraid/setup-complete-automation.sh -y

Error Handling

The script will exit with clear error messages if:

  • No saved configuration is found
  • Required environment variables are missing
  • OAuth tokens have expired (non-interactive mode cannot refresh them)

Common Issues

No saved configuration

[ERROR] No saved configuration found. Cannot run in non-interactive mode.
[ERROR] Please run the script without -y flag first to create initial configuration.

Solution: Run ./setup-complete-automation.sh interactively first.

Missing password

[ERROR] UNRAID_PASSWORD environment variable not set.
[ERROR] For non-interactive mode, set: export UNRAID_PASSWORD='your_password'

Solution: Set the UNRAID_PASSWORD environment variable.

Expired OAuth token

[ERROR] OAuth token expired and cannot refresh in non-interactive mode
[ERROR] Please run without -y flag to re-authenticate with GitHub

Solution: Run interactively to refresh OAuth token, or switch to personal access token method.

Security Best Practices

  1. Never commit credentials to version control
  2. Use secure environment variable storage (CI/CD secret stores, etc.)
  3. Rotate credentials regularly
  4. Use minimal required permissions for tokens
  5. Clear environment variables after use if needed:
    unset UNRAID_PASSWORD GITHUB_TOKEN WEBHOOK_SECRET
    

Advanced Usage

Combining with Reset Modes

# Reset VM only and redeploy non-interactively
export UNRAID_PASSWORD="password"
./setup-complete-automation.sh --reset-vm -y

Using with Different Authentication Methods

# For OAuth method (no GITHUB_TOKEN needed if valid)
export UNRAID_PASSWORD="password"
export WEBHOOK_SECRET="secret"
./setup-complete-automation.sh -y

# For personal access token method
export UNRAID_PASSWORD="password" 
export GITHUB_TOKEN="ghp_xxxx"
export WEBHOOK_SECRET="secret"
./setup-complete-automation.sh -y

Environment File Pattern

# Create ***REMOVED***.automation (don't commit this!)
cat > ***REMOVED***.automation << EOF
UNRAID_PASSWORD=your_password_here
GITHUB_TOKEN=your_token_here
WEBHOOK_SECRET=your_secret_here
EOF

# Use it
source ***REMOVED***.automation
./setup-complete-automation.sh -y

# Clean up
rm ***REMOVED***.automation

Integration Examples

See example-non-interactive.sh for a complete working example that you can customize for your needs.

The non-interactive mode makes it easy to integrate ThrillWiki deployment into your existing automation workflows while maintaining security and reliability.