Delete Site Command¶
The delete command permanently removes a site and all its content from the Sites platform.
Overview¶
The delete command allows you to: - Permanently delete a site - Remove all site content and configuration - Free up space and resources
⚠️ Warning: Deletion is permanent and cannot be undone. All site content will be lost.
Global Flags¶
All commands support these global flags:
--debug,-d,--verbose- Show debug information--insecure,-k- Skip TLS certificate verification (insecure)--force,-f,-y,--yes- Force operations without prompting--output,-o- Output format:json,yaml, ortable(default:table)
Command¶
sitesctl delete¶
Permanently delete a site and all its content.
Usage:
Flags:
--space(required) - Site space identifier--name(required) - Site name
Examples:
# Delete a site (will prompt for confirmation)
sitesctl delete --space myspace --name mysite
# Delete without confirmation prompt
sitesctl delete --space myspace --name mysite --force
# Delete with debug output
sitesctl delete --space myspace --name mysite --debug
# Delete with JSON output
sitesctl delete --space myspace --name mysite --output json
What it does:
- Validates the site exists
- Prompts for confirmation (unless --force is used)
- Deletes all site content from storage
- Removes the site configuration
- Deprovisions web service
- Removes the site from the Sites Hub
Confirmation Prompt:
Typey or yes to proceed with deletion.
Important Considerations¶
⚠️ Data Loss Warning¶
Deletion is permanent and irreversible: - All files and directories are removed - Site configuration is lost - Master tokens become invalid - The site URL becomes unavailable - There is no recovery option
Before Deleting¶
Create backups if needed:
# Download all site content
sitesctl site --space myspace --name mysite \
content download --path / --recursive --archive zip
# Save site configuration
sitesctl list --space myspace --name mysite --output yaml > mysite-backup.yaml
Verify you're deleting the correct site:
# Check site details before deleting
sitesctl list --space myspace --name mysite
# Check site content
sitesctl site --space myspace --name mysite content list --path /
Permissions Required¶
You can delete a site if you are: - The site owner - Listed as an admin user for the site - Member of an admin group for the site - A hub administrator
If you don't have permission, you'll receive an authorization error.
Deletion Process¶
The deletion happens in these stages:
- Validation - Confirms the site exists and you have permission
- Confirmation - Prompts for user confirmation (unless
--force) - Content Removal - Deletes all files from storage
- Service Deprovisioning - Stops and removes the web service
- Hub Cleanup - Removes site from the Sites Hub database
Typical deletion time: A few seconds to a few minutes depending on content size.
Return Status¶
- Success: Exit code 0, site deleted successfully
- Authentication Error: Exit code 1, check your credentials
- Permission Denied: Exit code 1, you don't have permission to delete this site
- Site Not Found: Exit code 1, the specified site doesn't exist
- API Error: Exit code 1, check connectivity and try again
Alternatives to Deletion¶
Consider these alternatives before deleting:
Archive Instead of Delete¶
Archive the site to disable it without losing data:
Archived sites: - No longer accessible via web - Retain all content and configuration - Can be unarchived later
Transfer Ownership¶
Transfer the site to another user:
Remove Content But Keep Site¶
Delete content while keeping the site structure:
# Delete all content
sitesctl site --space myspace --name mysite \
content delete --path / --recursive
Recovery Options¶
There is no built-in recovery for deleted sites. However:
If You Have Backups¶
If you previously downloaded site content:
# Create a new site with the same name
sitesctl create --name mysite --space myspace --template iver
# Upload backed-up content
sitesctl site --space myspace --name mysite \
content upload --source ./mysite-backup
Contact Support¶
In exceptional cases, contact ECMWF support immediately: - Sites may be recoverable for a short period after deletion - No guarantees - deletion is designed to be permanent - Recovery may take significant time
Scripting Examples¶
Safe Delete with Backup¶
#!/bin/bash
# Backup and delete a site
space="myspace"
name="mysite"
backup_dir="./backups/${space}-${name}-$(date +%Y%m%d)"
# Create backup directory
mkdir -p "$backup_dir"
# Download all content
echo "Creating backup..."
sitesctl site --space "$space" --name "$name" \
content download --path / --recursive --archive zip
# Move downloaded content to backup directory
mv "${space}/${name}" "$backup_dir/"
# Save site configuration
sitesctl list --space "$space" --name "$name" --output yaml \
> "$backup_dir/site-config.yaml"
echo "Backup complete: $backup_dir"
# Delete the site
echo "Deleting site..."
sitesctl delete --space "$space" --name "$name" --force
echo "Site deleted"
Batch Delete¶
#!/bin/bash
# Delete multiple sites
sites_to_delete=(
"myspace:oldsite1"
"myspace:oldsite2"
"testspace:testsite"
)
for site in "${sites_to_delete[@]}"; do
IFS=':' read -r space name <<< "$site"
echo "Deleting ${space}/${name}..."
sitesctl delete --space "$space" --name "$name" --force
done
Conditional Delete¶
#!/bin/bash
# Delete sites older than retention date
current_date=$(date +%s)
# Get all sites as JSON
sitesctl list --output json | jq -r '.[] | "\(.space):\(.name):\(.retention_date)"' | \
while IFS=':' read -r space name retention_date; do
retention_epoch=$(date -d "$retention_date" +%s)
if [ "$retention_epoch" -lt "$current_date" ]; then
echo "Deleting expired site: ${space}/${name} (expired ${retention_date})"
sitesctl delete --space "$space" --name "$name" --force
fi
done
Troubleshooting¶
Permission Denied¶
Solutions: - Verify you're the owner:sitesctl list --space X --name Y
- Ask the owner to add you as an admin
- Contact a hub administrator
Site Not Found¶
Solutions: - Verify the space and name are correct - Check spelling and case sensitivity - Usesitesctl list to confirm the site exists
Authentication Required¶
Solution: Login first withsitesctl auth login --username <username>
Deletion Fails¶
Solutions: - Wait a moment and try again - Check your network connection - Try with--debug flag to see detailed error
- Contact support if the problem persists
Best Practices¶
- Always create backups before deleting important sites
- Use
--forcecarefully - double-check space/name before using it - Prefer archiving for temporary disabling over deletion
- Document deletions in your team's procedures
- Clean up systematically rather than deleting many sites at once without verification
- Test deletion on test sites first if scripting batch deletions
- Communicate with team before deleting shared sites
- Verify site details with
sitesctl listbefore the delete command
See Also¶
- List Sites Command - Viewing sites before deletion
- Create Site Command - Creating replacement sites
- Site Update Commands - Archiving as an alternative to deletion
- Site Content Commands - Backing up content before deletion