Files
thrillwiki_django_no_react/shared/scripts/unraid/README-NON-INTERACTIVE.md
pacnpal d504d41de2 feat: complete monorepo structure with frontend and shared resources
- Add complete backend/ directory with full Django application
- Add frontend/ directory with Vite + TypeScript setup ready for Next.js
- Add comprehensive shared/ directory with:
  - Complete documentation and memory-bank archives
  - Media files and avatars (letters, park/ride images)
  - Deployment scripts and automation tools
  - Shared types and utilities
- Add architecture/ directory with migration guides
- Configure pnpm workspace for monorepo development
- Update .gitignore to exclude .django_tailwind_cli/ build artifacts
- Preserve all historical documentation in shared/docs/memory-bank/
- Set up proper structure for full-stack development with shared resources
2025-08-23 18:40:07 -04:00

151 lines
4.3 KiB
Markdown

# 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
```bash
# 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
```bash
#!/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
```bash
# 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:
```bash
unset UNRAID_PASSWORD GITHUB_TOKEN WEBHOOK_SECRET
```
## Advanced Usage
### Combining with Reset Modes
```bash
# Reset VM only and redeploy non-interactively
export UNRAID_PASSWORD="password"
./setup-complete-automation.sh --reset-vm -y
```
### Using with Different Authentication Methods
```bash
# 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
```bash
# 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.