Some checks failed
Test / test (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
226 lines
6.5 KiB
Markdown
226 lines
6.5 KiB
Markdown
# Scripts Directory
|
|
|
|
This directory contains all automation scripts for the Azure Stack HCI project. Scripts are organized by function for easy navigation and maintenance.
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
scripts/
|
|
├── deploy/ # Deployment scripts
|
|
├── infrastructure/ # Infrastructure setup scripts
|
|
├── maintenance/ # Maintenance scripts
|
|
│ ├── backup/ # Backup scripts
|
|
│ ├── update/ # Update scripts
|
|
│ └── cleanup/ # Cleanup scripts
|
|
├── vm-management/ # VM management scripts
|
|
│ ├── create/ # VM creation scripts
|
|
│ ├── configure/ # VM configuration scripts
|
|
│ └── monitor/ # VM monitoring scripts
|
|
├── testing/ # Testing scripts
|
|
├── health/ # Health check scripts
|
|
├── validate/ # Validation scripts
|
|
├── recovery/ # Recovery scripts
|
|
├── monitoring/ # Monitoring scripts
|
|
├── quality/ # Quality assurance scripts
|
|
├── docs/ # Documentation scripts
|
|
├── utils/ # Utility scripts
|
|
└── azure-arc/ # Azure Arc scripts
|
|
```
|
|
|
|
## Script Categories
|
|
|
|
### Deployment Scripts (`deploy/`)
|
|
|
|
Scripts for deploying the complete infrastructure:
|
|
|
|
- `complete-deployment.sh` - Complete deployment automation
|
|
- `deploy-all-services.sh` - Deploy all HC Stack services
|
|
- `deploy-start.sh` - Start deployment process
|
|
- `deploy-without-azure.sh` - Deploy without Azure integration
|
|
|
|
### Infrastructure Scripts (`infrastructure/`)
|
|
|
|
Scripts for setting up infrastructure components:
|
|
|
|
- `setup-k3s.sh` - Install and configure K3s
|
|
- `setup-git-server.sh` - Deploy Git server (Gitea/GitLab)
|
|
- `setup-cloudflare-tunnel.sh` - Configure Cloudflare Tunnel
|
|
- `setup-observability.sh` - Set up monitoring stack
|
|
- `setup-guest-agent.sh` - Install QEMU guest agent
|
|
- `download-ubuntu-cloud-image.sh` - Download Ubuntu cloud images
|
|
- `verify-proxmox-image.sh` - Verify Proxmox image integrity
|
|
- `fix-corrupted-image.sh` - Fix corrupted images
|
|
- `recreate-vms-from-template.sh` - Recreate VMs from template
|
|
- `auto-complete-template-setup.sh` - Automate template setup
|
|
- `automate-all-setup.sh` - Complete automation script
|
|
|
|
### VM Management Scripts (`vm-management/`)
|
|
|
|
#### Create (`vm-management/create/`)
|
|
|
|
Scripts for creating VMs:
|
|
|
|
- `create-all-vms.sh` - Create all service VMs
|
|
- `create-first-vm.sh` - Create first VM
|
|
- `create-vms-from-iso.sh` - Create VMs from ISO
|
|
- `create-vms-from-template.sh` - Create VMs from template
|
|
- `create-vms-via-ssh.sh` - Create VMs via SSH
|
|
- `create-vm-from-image.sh` - Create VM from disk image
|
|
- `create-vm-template.sh` - Create VM template
|
|
- `create-proxmox-template.sh` - Create Proxmox template
|
|
- `create-template-quick.sh` - Quick template creation
|
|
- `create-template-via-api.sh` - Create template via API
|
|
|
|
#### Configure (`vm-management/configure/`)
|
|
|
|
Scripts for configuring VMs:
|
|
|
|
- `setup-vms-complete.sh` - Complete VM setup
|
|
- `complete-vm-setup.sh` - Finish VM setup
|
|
- `complete-all-vm-tasks.sh` - Complete all VM tasks
|
|
- `apply-install-scripts.sh` - Apply installation scripts
|
|
- `fix-vm-config.sh` - Fix VM configuration
|
|
- `fix-vm-creation.sh` - Fix VM creation issues
|
|
- `fix-all-vm-configs.sh` - Fix all VM configurations
|
|
- `fix-boot-config.sh` - Fix boot configuration
|
|
- `fix-floppy-boot.sh` - Fix floppy boot issues
|
|
- `fix-guest-agent.sh` - Fix guest agent issues
|
|
- `final-vm-config-fix.sh` - Final VM configuration fix
|
|
- `set-boot-order-api.sh` - Set boot order via API
|
|
- `attach-iso-webui-guide.sh` - Guide for attaching ISO
|
|
- `manual-steps-guide.sh` - Manual steps guide
|
|
|
|
#### Monitor (`vm-management/monitor/`)
|
|
|
|
Scripts for monitoring VMs:
|
|
|
|
- `check-vm-status.sh` - Check VM status
|
|
- `check-vm-readiness.sh` - Check VM readiness
|
|
- `check-vm-disk-sizes.sh` - Check VM disk sizes
|
|
- `check-and-recreate.sh` - Check and recreate VMs
|
|
- `monitor-and-complete.sh` - Monitor and complete setup
|
|
|
|
### Utility Scripts (`utils/`)
|
|
|
|
General utility scripts:
|
|
|
|
- `prerequisites-check.sh` - Check system prerequisites
|
|
- `test-proxmox-connection.sh` - Test Proxmox connection
|
|
- `test-cloudflare-connection.sh` - Test Cloudflare connection
|
|
|
|
### Azure Arc Scripts (`azure-arc/`)
|
|
|
|
Scripts for Azure Arc integration:
|
|
|
|
- `onboard-proxmox-hosts.sh` - Onboard Proxmox hosts to Azure Arc
|
|
- `onboard-vms.sh` - Onboard VMs to Azure Arc
|
|
- `resource-bridge-setup.sh` - Set up Azure Arc Resource Bridge
|
|
|
|
### Quality Scripts (`quality/`)
|
|
|
|
Scripts for quality assurance:
|
|
|
|
- `lint-scripts.sh` - Lint all scripts with shellcheck
|
|
- `validate-scripts.sh` - Validate script syntax and dependencies
|
|
|
|
### Documentation Scripts (`docs/`)
|
|
|
|
Scripts for documentation management:
|
|
|
|
- `generate-docs-index.sh` - Generate documentation index
|
|
- `validate-docs.sh` - Validate documentation
|
|
- `update-diagrams.sh` - Update diagrams
|
|
|
|
## Script Standards
|
|
|
|
All scripts should follow these standards:
|
|
|
|
1. **Shebang**: `#!/bin/bash`
|
|
2. **Error Handling**: `set -e` for immediate exit on error
|
|
3. **Logging**: Use consistent logging functions
|
|
4. **Documentation**: Include header with description and usage
|
|
5. **Parameters**: Use consistent parameter handling
|
|
6. **Versioning**: Include version information
|
|
|
|
## Running Scripts
|
|
|
|
### Prerequisites Check
|
|
|
|
Before running any scripts, check prerequisites:
|
|
|
|
```bash
|
|
./scripts/utils/prerequisites-check.sh
|
|
```
|
|
|
|
### Testing Connections
|
|
|
|
Test connections before deployment:
|
|
|
|
```bash
|
|
# Test Proxmox
|
|
./scripts/utils/test-proxmox-connection.sh
|
|
|
|
# Test Cloudflare
|
|
./scripts/utils/test-cloudflare-connection.sh
|
|
```
|
|
|
|
### Deployment
|
|
|
|
Run complete deployment:
|
|
|
|
```bash
|
|
./scripts/deploy/complete-deployment.sh
|
|
```
|
|
|
|
### VM Management
|
|
|
|
Create VMs:
|
|
|
|
```bash
|
|
./scripts/vm-management/create/create-all-vms.sh
|
|
```
|
|
|
|
Monitor VMs:
|
|
|
|
```bash
|
|
./scripts/vm-management/monitor/check-vm-status.sh
|
|
```
|
|
|
|
## Script Dependencies
|
|
|
|
Many scripts depend on:
|
|
|
|
- Environment variables from `.env` file
|
|
- Proxmox API access
|
|
- Azure CLI authentication
|
|
- Network connectivity
|
|
|
|
Ensure these are configured before running scripts.
|
|
|
|
## Troubleshooting Scripts
|
|
|
|
If a script fails:
|
|
|
|
1. Check prerequisites: `./scripts/utils/prerequisites-check.sh`
|
|
2. Verify environment variables: `cat .env`
|
|
3. Check script logs and error messages
|
|
4. Review script documentation in header
|
|
5. Test individual components
|
|
|
|
## Contributing
|
|
|
|
When adding new scripts:
|
|
|
|
1. Place in appropriate directory
|
|
2. Follow script standards
|
|
3. Add to this README
|
|
4. Include documentation header
|
|
5. Test thoroughly
|
|
|
|
## Additional Resources
|
|
|
|
- [Project README](../README.md)
|
|
- [Documentation](../docs/)
|
|
- [Deployment Guide](../docs/deployment/deployment-guide.md)
|
|
|