Skip to content

Sites CLI Documentation

Complete command reference for the Sites Command Line Interface (CLI).

Table of Contents

Overview

The Sites CLI (SitesCTL) is a command-line tool for managing sites and their content on the ECMWF Sites platform. It provides comprehensive functionality for:

  • Site lifecycle management (create, update, delete)
  • Content management (upload, download, list, delete files)
  • Access control and authentication
  • Token management
  • Signed URLs for sharing
  • Configuration management

Token lifecycle note: Rotating or revoking a site's master token invalidates all HTTP access tokens and signed URLs derived from it.

Getting Started

Installation

Download the CLI from the ECMWF repository:

Linux:

curl -L https://get.ecmwf.int/repository/sites-cli/linux/sites-linux-amd64-20260331.1126 --output sitesctl
chmod +x sitesctl
sudo mv sitesctl /usr/local/bin/sitesctl

macOS:

curl -L https://get.ecmwf.int/repository/sites-cli/darwin/sites-darwin-amd64-20260331.1126 --output sitesctl
chmod +x sitesctl
sudo mv sitesctl /usr/local/bin/sitesctl

First Steps

  1. Login:

    sitesctl auth login --username your-username
    

  2. List your sites:

    sitesctl list --owner your-username
    

  3. Create a site:

    sitesctl create --name mysite --template iver
    

  4. Upload content:

    sitesctl site --space myspace --name mysite content upload --source ./myfiles
    

Configuration

Configure CLI defaults:

sitesctl config show                          # View current config
sitesctl config output --value json           # Set default output format
sitesctl config auto-upgrade --value true     # Enable auto-upgrade checks

Command Reference

Authentication & Configuration

Command Description Documentation
sitesctl auth login Login with ECMWF credentials auth.md
sitesctl auth logout Revoke current token auth.md
sitesctl auth whoami Show current user info auth.md
sitesctl auth hub-token Store platform hub token auth.md
sitesctl auth site-token Store site-specific token auth.md
sitesctl config show Display configuration config.md
sitesctl config base-url Set base URL config.md
sitesctl config output Set output format config.md
sitesctl config auto-upgrade Configure auto-upgrade config.md

Full Documentation: - Authentication Commands - Configuration Commands


Site Management

Command Description Documentation
sitesctl list List all accessible sites list.md
sitesctl list health Check site health list.md
sitesctl create Create a new site create.md
sitesctl delete Delete a site delete.md

Full Documentation: - List Sites - Browse and filter sites - Create Site - Create new sites - Delete Site - Remove sites


Content Management

Command Description Documentation
sitesctl site content upload Upload files to site site-content.md
sitesctl site content download Download files from site site-content.md
sitesctl site content list List files in site site-content.md
sitesctl site content delete Delete files from site site-content.md
sitesctl site content checksum Show remote file checksum site-content.md
sitesctl site content symlink create Create symbolic link site-content.md
sitesctl site content symlink check Check symlink info site-content.md
sitesctl site content symlink delete Delete symbolic link site-content.md
sitesctl site health Check site health site-content.md

Full Documentation: - Site Content Commands - Complete file management guide


Site Configuration Updates

Command Description Documentation
sitesctl site update set:all Update from YAML file site-update.md
sitesctl site update set:name Update site name site-update.md
sitesctl site update set:space Update site space site-update.md
sitesctl site update set:owner Update site owner site-update.md
sitesctl site update set:description Update description site-update.md
sitesctl site update set:retentiondate Update retention date site-update.md
sitesctl site update set:toggle Archive/unarchive site site-update.md
sitesctl site update set:share:accessusers Set access users site-update.md
sitesctl site update set:share:accessgroups Set access groups site-update.md
sitesctl site update set:share:adminusers Set admin users site-update.md
sitesctl site update set:share:admingroups Set admin groups site-update.md
sitesctl site update set:customimage Set custom application image site-update.md
sitesctl site update set:customcontextroot Set context root site-update.md
sitesctl site update set:customproxy Set proxy type site-update.md
sitesctl site update set:customenv Set environment variables site-update.md
sitesctl site update restart Restart site site-update.md
sitesctl site update upgrade Upgrade site components site-update.md
sitesctl site update publish Request publishing site-update.md

Full Documentation: - Site Update Commands - Comprehensive configuration management


Token Management

Command Description Documentation
sitesctl site tokens master-token show Show master token site-tokens.md
sitesctl site tokens master-token rotate Rotate master token site-tokens.md
sitesctl site tokens access-token create Create HTTP access token site-tokens.md
sitesctl site tokens access-token decode Decode HTTP access token site-tokens.md
sitesctl site tokens access-token revoke Revoke HTTP access token site-tokens.md
sitesctl site tokens access-token history list List token history entries site-tokens.md
sitesctl site tokens access-token history delete Delete token history entry site-tokens.md
sitesctl site tokens access-token history backup Backup token history site-tokens.md
sitesctl site tokens access-token history restore Restore token history from backup site-tokens.md

Full Documentation: - Site Token Management - Master tokens, HTTP access tokens, revocation, and token history


Signed URLs

Command Description Documentation
sitesctl site signed-urls create Create signed URL site-signed-urls.md
sitesctl site signed-urls verify Verify signed URL site-signed-urls.md

Full Documentation: - Signed URLs - Time-limited file access


Utility Commands

Command Description Documentation
sitesctl upgrade-cli Upgrade CLI to latest version upgrade-cli.md
sitesctl misc htpasswd Generate .htpasswd entry misc.md

Full Documentation: - CLI Upgrade - Keeping the CLI up to date - Miscellaneous Commands - Utility functions


By Task

I want to...

By Role

Site Owner: - Create Sites - Manage Access Control - Token Management - Delete Sites

Content Manager: - Upload Files - Download Files - Manage Files - Create Symlinks

Collaborator: - List Sites - View/Download Content - Use Shared Tokens

Developer: - API Authentication - Signed URLs for Integration - Custom Applications - Automation Scripts


Common Workflows

Initial Setup

# 1. Login
sitesctl auth login --username myuser

# 2. Configure preferences
sitesctl config output --value json
sitesctl config auto-upgrade --value true

# 3. Create a site
sitesctl create --name mysite --template iver --quota 5

# 4. Save the master token
sitesctl auth site-token --space myuser --name mysite --token <token-from-creation>

Daily Content Management

# Upload changes
sitesctl site --space myspace --name mysite \
  content upload --source ./public --recursive

# Check site health
sitesctl site --space myspace --name mysite health

# List files
sitesctl site --space myspace --name mysite \
  content list --path / --recursive

Sharing and Collaboration

# Create time-limited access token
sitesctl site --space myspace --name mysite \
  tokens access-token create \
  --identifier "colleague-temp" \
  --duration 604800 \
  --permission r

# Create signed URL for specific file
sitesctl site --space myspace --name mysite \
  signed-urls create \
  --url https://sites.ecmwf.int/myspace/mysite/report.pdf \
  --duration 86400

Site Maintenance

# Update retention date
sitesctl site --space myspace --name mysite \
  update set:retentiondate --value 2027-12-31

# Restart site
sitesctl site --space myspace --name mysite \
  update restart

# Upgrade components
sitesctl site --space myspace --name mysite \
  update upgrade

Global Flags

All commands support these global flags:

Flag Aliases Description
--debug -d, --verbose Show debug information
--insecure -k Skip TLS certificate verification (not recommended)
--force -f, -y, --yes Skip confirmation prompts
--output -o Output format: json, yaml, or table

Examples:

# Get detailed debug output
sitesctl list --debug

# Skip confirmation prompt
sitesctl delete --space test --name oldsite --force

# Get JSON output for scripting
sitesctl list --output json | jq '.[] | .name'


Environment Variables

The CLI supports these environment variables:

Variable Purpose Used By
ECMWF_USERNAME Default username auth login
ECMWF_PASSWORD Default password auth login
API_AUTHENTICATION_TOKEN Master token Content operations
MASTER_TOKEN Master token (alias) Content operations
HTTP_ACCESS_TOKEN HTTP access token Content operations

Example:

export ECMWF_USERNAME=myuser
export MASTER_TOKEN=abc123...
sitesctl site --space myspace --name mysite content list


Output Formats

The CLI supports three output formats:

Table (default)

Human-readable tabular output:

Owner    Space     Name      Type     Enabled
john     myspace   mysite    private  true

JSON

Machine-readable JSON:

[
  {
    "owner": "john",
    "space": "myspace",
    "name": "mysite",
    "type": "private",
    "enabled": true
  }
]

YAML

Human-readable structured format:

- owner: john
  space: myspace
  name: mysite
  type: private
  enabled: true

Set default:

sitesctl config output --value json

Override per command:

sitesctl list --output yaml


Scripting with the CLI

Best Practices

  1. Use JSON output for easier parsing:

    sitesctl list --output json | jq '.[] | .name'
    

  2. Check exit codes:

    if sitesctl auth whoami; then
      echo "Authenticated"
    else
      echo "Not authenticated"
      exit 1
    fi
    

  3. Use --force in automation:

    sitesctl delete --space test --name temp --force
    

  4. Store credentials securely:

    # Use environment variables
    export MASTER_TOKEN=$(pass sites/mysite/token)
    
    # Or use auth site-token
    sitesctl auth site-token --space myspace --name mysite --token <token>
    

  5. Handle errors:

    if ! sitesctl site --space myspace --name mysite content upload --source ./files; then
      echo "Upload failed" >&2
      exit 1
    fi
    

Example Scripts

See the scripting examples sections in each command documentation: - Content Management Scripts - Token Management Scripts - Update Workflows


Troubleshooting

Common Issues

Authentication Errors:

# Check if logged in
sitesctl auth whoami

# Login if needed
sitesctl auth login --username myuser

Permission Denied: - Verify you have access: sitesctl list --space X --name Y - Check if you're an owner or admin - Ensure token has correct permissions

Command Not Found:

# Check installation
which sitesctl

# Verify PATH
echo $PATH

# Reinstall if needed

Connection Issues: - Check internet connectivity - Verify firewall allows HTTPS - Try with --debug for detailed error messages

Getting Help

Built-in help:

# General help
sitesctl --help

# Command help
sitesctl auth --help
sitesctl site content upload --help

# Version info
sitesctl --version

Documentation: - Command-specific: See individual documentation files - Examples: Each doc file includes examples and common workflows - Troubleshooting: Check troubleshooting sections in relevant docs


Support

Resources

Reporting Issues

When reporting issues, include:

  1. CLI version: sitesctl --version
  2. Command used: Full command line
  3. Error message: Complete error output
  4. Debug output: Run with --debug flag
  5. Environment: OS, shell, network setup

Example:

# Get debug output
sitesctl list --debug > debug.log 2>&1

# Include in support request along with:
# - sitesctl --version
# - Description of expected vs actual behavior


Version Information

Current Documentation Version: 2024-02-27

CLI Updates: Use sitesctl upgrade-cli to get the latest version.

To check your CLI version:

sitesctl --version


Additional Resources


Contributing

Found an error in the documentation? Have a suggestion? Contact ECMWF support at https://support.ecmwf.int