Deployment
Deploying your project to Motia Cloud
There are two ways to deploy your project to Motia Cloud:
- Using the CLI
- Using the Web interface
Using the Motia CLI for Deployment
Required Options
Option | Alias | Description | Environment Variable |
---|---|---|---|
--api-key | -k | API key for authentication | MOTIA_API_KEY |
--version-name | -v | Version tag for the deployment | None |
Optional Options
Option | Alias | Description | Environment Variable |
---|---|---|---|
--environment-id | -s | Environment ID | MOTIA_ENVIRONMENT_ID |
--version-description | -d | Version description for the deployment | None |
--env-file | -e | Path to environment file | None |
Note: Command-line options take precedence over environment variables. If both are provided, the command-line value will be used.
Deploy with a specific version:
Deploy to a specific environment with environment variables:
Using Web interface
Through the web interface, you can deploy your project from workbench to a live environment with one click.
Steps to deploy from web interface:
- Have your local project running (make sure your Motia version is 0.6.4 or higher)
- Go to import from workbench on Motia Cloud
- Select the port your local project is running on
- Choose the project and environment name
- Add any environment variables you need (you can upload from .env file or paste the content to auto-fill)
- Click Deploy
- Watch the magic happen
Adding static files to the bundle
Sometimes we need to use local files when creating our backend logic. For example, creating templates. Running binary files, etc. To do this, we can add them to steps as static files.
Adding them to Steps as static files, you need to add includeFiles
to the step config. The path
should be relative to the step file.
Adding binary files to the bundle
Binary files are also supported, but the entire bundle size must not exceed 100MB. The binary architecture should be linux_amd64.
Troubleshooting Build Outputs
When adding static files, it's important to check the build output to make sure the files are included.
For example, in this project, there are a few steps that include static files.
When running npx motia build
, it will generate the following output in dist
folder:
If you check the content of content-outliner.step.zip
, it should have this
Now you made sure the static file called content-outliner.mustache
is included in the bundle.