devicesdk deploy
Deploy device scripts to production
Usage
devicesdk deploy [flags]
Flags
--device <name>- Deploy specific device only--message <text>- Deployment message for version history--dry-run- Preview deployment without actually deploying
Description
The deploy command:
- Builds your device scripts
- Uploads to DeviceSDK
- Creates a new version
- Makes it available to devices
Your code is deployed globally to 300+ edge locations for low-latency device communication.
Deployment Process
When you deploy:
- Build - Code is compiled and optimized
- Upload - Scripts are sent to the edge
- Activate - New version becomes active
- Notify - Connected devices receive update
Examples
Deploy all devices:
devicesdk deploy
Deploy specific device:
devicesdk deploy --device temperature-sensor
Deploy with message:
devicesdk deploy --message "Fix temperature reading bug"
Dry run (preview without deploying):
devicesdk deploy --dry-run
Version History
Each deployment creates a new immutable version. View version history in the dashboard.
Deployment Messages
Add messages to track changes:
devicesdk deploy --message "Add humidity sensor support"
These appear in your version history and help track what changed.
Deployment Strategies
All-at-Once (Default)
All devices get the new version immediately:
devicesdk deploy
Per-Device
Deploy devices independently:
devicesdk deploy --device sensor-1
devicesdk deploy --device sensor-2
Staged Rollout
Deploy to subset of devices first, then expand (via dashboard).
Rollback
Need to revert? Rollback in the dashboard:
- View version history
- Select previous version
- Click “Rollback”
Devices reconnect to the previous version.
CI/CD Integration
GitHub Actions
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Deploy
env:
DEVICESDK_TOKEN: ${{ secrets.DEVICESDK_TOKEN }}
run: npx @devicesdk/cli deploy --message "Deploy from CI"
GitLab CI
deploy:
script:
- npx @devicesdk/cli deploy --message "Deploy from CI"
only:
- main
Environment Variables
Set DEVICESDK_TOKEN for CI/CD:
export DEVICESDK_TOKEN="your-token-here"
devicesdk deploy
Get your token from the dashboard.
Deployment Limits
- Maximum script size: 1MB
- Build timeout: 5 minutes
- Concurrent deployments: 1 per project
Troubleshooting
Authentication failed?
Build fails?
Fix TypeScript errors before deploying:
npm run build
Deployment stuck?
Check dashboard for deployment status and error details.
Need to rollback?
Use the dashboard to revert to a previous version immediately.
Best Practices
- Test locally first - Validate your project before deploying
- Add deployment messages - Track what changed
- Deploy incrementally - Start with one device, expand gradually
- Monitor after deploy - Watch logs in dashboard
- Have a rollback plan - Know how to revert if needed