Deploying Applications
Learn about deploy command
The andasy deploy command builds and deploys your application to the Andasy platform. This command handles the entire deployment process, from building your container image to starting your application on Andasy machines.
The deployment process involves:
- Building your application - Creating a container image from your code and Dockerfile
- Pushing to registry - Uploading the image to Andasy's private container registry
- Deploying to machines - Starting or updating your application on one or more machines
The command supports both remote and local deployment modes, allowing flexibility depending on your workflow and environment.
How Deployment Works
When you run andasy deploy, here's what happens behind the scenes:
- Code Packaging - Your application code is packaged along with the Dockerfile
- Image Building - A container image is built either:
- Remote mode: On Andasy's build servers (default)
- Local mode: On your machine using Docker
- Image Storage - The built image is pushed to Andasy's private container registry, where it's stored securely
- Machine Deployment - Andasy creates or updates machines running your application:
- Reads your
andasy.hclconfiguration - Allocates resources (CPU, memory)
- Starts containers with your image
- Configures networking and routing
- Reads your
- Health Checks - Andasy verifies your application is running and accessible
After deployment completes, your application is live and accessible via its assigned URL (typically https://<app-name>.andasy.dev).
Deployment Modes
Remote Mode (Default)
In remote mode, Andasy builds your container image on its build servers. This is the default and recommended approach because:
- No local Docker installation required
- Consistent build environment
- Faster for CI/CD pipelines
- Builds happen in parallel with other tasks
Local Mode
In local mode, you build the image on your machine using Docker, then upload it to Andasy. Use this mode when:
- You want to test builds locally before deploying
- You need to inspect the built image
- You're working offline or have slow internet
- You want more control over the build process
Usage
andasy deploy <dir> [flags]
<dir> is the path to your application code directory. This is optional if you're already in the project directory.
Flags
-
-a, --app string
Specifies the target Andasy application to deploy. Required ifandasy.hclis not present in the current directory. -
-c, --config string
Path to the application configuration file (default:andasy.hclin the current directory). Use this if your config file is in a different location. -
-h, --help
Displays help information for the deploy command. -
-i, --image-label string
Image label or tag to deploy. Useful for versioning (e.g.,v1.2.3) or when deploying a pre-built image. If not specified, Andasy generates a label automatically. -
-m, --mode string
Sets the deployment mode:remote(default) orlocal. See Deployment Modes above for details.
Examples
Basic Remote Deployment
Deploy from the current directory (uses andasy.hcl if present):
andasy deploy
Deploy with Explicit App Name
When deploying from a different directory or without a config file:
andasy deploy -a my-app-name
Deploy with Custom Directory and Config
Deploy from a specific directory with a custom config file location:
andasy deploy ./my-app-location -a my-app-name -c ./config/andasy.hcl
Deploy Using Local Docker
Build the image locally, then deploy:
andasy deploy ./my-app -a my-app-name -m local
This builds the image on your machine using Docker, then uploads it to Andasy.
Deploy a Specific Image Version
Deploy a pre-built image with a specific label:
andasy deploy -a my-app-name -i v1.2.3
What Happens After Deployment
Once deployment completes successfully:
- Your application is running on one or more machines
- It's accessible via its URL (e.g.,
https://my-app-name.andasy.dev) - Logs are available via
andasy logs - Metrics are collected automatically
- You can SSH into machines using
andasy ssh
If deployment fails, check the error message for details. Common issues include:
- Configuration errors in
andasy.hcl - Build failures (check your Dockerfile)
- Resource allocation issues
- Port conflicts
Related Commands
andasy setup- Initial project setupandasy apps restart- Restart a deployed applicationandasy logs- View application logsandasy machines status- Check machine status