Core concepts

Apps

An App is an application deployed to a cluster through Deckrun.

It can be written in any language and framework that can be built into a Docker image, such as PHP, Node.js, Python, Go, Ruby, etc.

The app's name is unique and acts as a global identifier within your account.

Initializing an App

The first step before deploying an application is to create it in Deckrun.

To create and initialize a new application, run the following command inside the directory containing your code:

deck init

First, you will need to choose the cluster where the application will be deployed. Next, you must choose a unique name for the application.

Deckrun will try to automatically detect the application type and generate the most suitable Dockerfile to build the application's image.

If the language/framework cannot be detected, you have the option to use your own Dockerfile.

Additionally, a deckrun.toml configuration file in TOML format will be generated, containing the necessary information to perform the deployment.

If you already have a deckrun.toml file from another project, you can use the --load-existing-config flag to load it as a base configuration:

deck init --load-existing-config

Deployment

To deploy the application, run the following command:

deck deploy

This command will perform the following actions:

  1. Builds the Docker image.
  2. Pushes the image to the provider's registry.
  3. Deploys the image to the cluster according to the configuration file.
  4. Waits until the application is successfully deployed.

Every time deck deploy is executed, the application is built and deployed.

By default, deck deploy uses the deckrun.toml file in the current directory. You can specify a different configuration file using the -c or --config flag. This is useful for managing multiple environments, such as staging and production:

deck deploy -c deckrun-staging.toml

Configuration file

The configuration file determines how the application should be deployed and run in the cluster.

Example of a deckrun.toml file:

# deckrun.toml file automatically generated on Sat Mar  1 12:43:05 CET 2025

app = 'laravel'

[env]
APP_DEBUG = 'false'
APP_ENV = 'production'
DB_CONNECTION = 'mysql'
LOG_CHANNEL = 'stderr'
LOG_LEVEL = 'info'

[deploy]
[deploy.pre]
command = 'php artisan migrate --force'

[[processes]]
name = 'app'

[processes.http]
internal_port = 8080

[[processes]]
name = 'worker'
command = 'php artisan queue:work'

[[cronjobs]]
name = 'scheduler'
schedule = '* * * * *'
command = 'php artisan schedule:run'

Best Practices

  • Use clear and unique names: We recommend using a naming convention such as project-environment (e.g., myapi-prd, myapi-stg). This helps to avoid confusion and makes it easier to manage applications in the UI and CLI.

  • Version control your deckrun.toml: We recommend committing the deckrun.toml file to your version control system. This ensures that your deployment configuration is tracked along with your code, making it easier to collaborate and roll back changes if needed.

  • Add custom domains for production: When you are ready to go live, add a custom domain to your application.

  • Use secrets for sensitive data: Use secrets to manage API keys, tokens, or credentials. Secrets are injected as environment variables, but they are stored securely and are not checked into your deckrun.toml file.

  • Keep your Docker images small: Smaller images lead to faster deployments and reduced storage costs. You can optimize your Docker images by using a .dockerignore file to exclude unnecessary files, and by using multi-stage builds to create smaller final images.

Previous
Registries