Deploying Your Application
This guide covers the end-to-end process of deploying applications to CloudNexus infrastructure. Learn how to configure your project, deploy via CLI or API, and manage environments.
cnx CLI installed and authenticated. If not, follow our Installation Guide.
Project Setup
Before deploying, initialize a CloudNexus project in your repository root. This creates a cnx.json configuration file.
cnx init
The command will prompt you for:
- Project name and slug
- Runtime environment (Node, Python, Go, Docker, etc.)
- Build command and start command
- Region selection
Configuration File
Your cnx.json file controls deployment behavior:
{
"name": "my-app",
"runtime": "node-20",
"build": "npm run build",
"start": "npm start",
"regions": ["us-east-1", "eu-west-1"],
"replicas": 3,
"env": {
"NODE_ENV": "production",
"PORT": 3000
}
}
Deploy Command
Deploy your application using the deploy command. By default, it deploys to the production environment.
cnx deploy --env production
Deployment Flags
| Flag | Description | Default |
|---|---|---|
--env |
Target environment name | production |
--region |
Override region from config | Config value |
--wait |
Wait for deployment to complete | true |
--dry-run |
Validate without deploying | false |
Docker Deployments
For containerized applications, set runtime: docker and provide a Dockerfile.
{
"runtime": "docker",
"dockerfilePath": "./Dockerfile",
"resources": {
"cpu": "2 vCPU",
"memory": "4GB"
}
}
Deploying via API
Use the REST API for CI/CD pipelines or programmatic deployments.
POST /v1/projects/{projectId}/deployments
Authorization: Bearer ${CNX_TOKEN}
Content-Type: application/json
{
"gitProvider": "github",
"repo": "owner/repo",
"branch": "main",
"env": "production"
}
Verifying Deployment
After deployment, verify status using the CLI or dashboard.
cnx status --env production
# Output:
# â Environment: production
# â Region: us-east-1
# â Replicas: 3/3 healthy
# â URL: https://my-app.cloudnexus.app
Troubleshooting
Common deployment issues and solutions:
- Build Failed: Check build logs with
cnx logs --build - Health Check Failed: Ensure your app responds on the configured port
- Out of Memory: Increase resource limits in
cnx.json
Was this page helpful?