Skip to main content

Deployment

Our SDK provides you a CLI to deploy.

npx warp deploy

Principle

The deploy command is able to deploy a container

  • from a dockerfile
  • from a nodeJs server
  • from static assets

During the deployment, the platform manages the setup of the endpoints, the creation of HTTPS certificates, the docker image build and storage in a private repository, the deployment of the image and run on the selected runner.

Projects and environments

To deploy you need to indicate in which project and in which environment you want to deploy your containers.

You can use the console or the cli to create projects and environments.

On the cli use

# to create a project
npx warp project create

# to create an environement in a project
npx warp env create

During each deploy you'll be invited to indicate in which project/environment you are deploying.

During a session you can select the project/environment you want to use to avoid to enter it during the deploy command

# to select a project
npx warp project select

# to select an environement in a project
npx warp env select

If during the session you want to check what has been selected, use

# to view selected project/environment
npx warp whereami

You can also use a configuration file warp.config.js configuration file, or use additional parameter to the deploy command

npx warp deploy --project <project> --env <env>

Configuration

The deploy command can be applied on one or multiple directories.

For each directory the command is applied, it searches for a warp.config.js configuration file that indicate how to configure the deployment of container.

If there is no configuration file or deployement configuration, the command identifies automatically the deployment configuration in that way:

  • if there is a Dockerfile, it will deploy from the dockerfile and use the deployment type 'docker'
  • if there is a publicor hosting directory, it will deploy static assets and use the deployment type 'hosting'
  • if there is a scripts.start in a package.json, it will deploy a nodeJs server and use the deployment type 'server'
  • if there is a main in a package.json, it will deploy a nodeJs module and use the deployment type 'module' (see beta module-as-a-service)

First deployment

During the first deployment two additional configurations are required for each container:

  • the runner name to deploy on
  • the url to use to access the container

These infos can also be specified in the configuration file. But if there are missing, you will have to interactively enter your values.

About urls, we provide test urls for testing/dev deployments, but you can also assigned you custom domain on an container see Use custom domains

At last, a name to identify the container that is deployed, and other following deployment will be set. If there is a name specified in the configuration it is used. Otherwise the command line sets automatically a name in that way according to the deployment type:

  • In the case 'server' or 'module', the package name in package.jsonis used.
  • For 'docker' the parent dirname of where is located the Dockerfile is used.
  • For 'hosting' the parent dirname of where is located publicor staticis used.

Deploy one or multiple containers

If no parameter is used, the command will scan inside the directory you run the command.

npx warp deploy

You can also indicate which directory to deploy

npx warp deploy <directory>

To deploy a specific configuration (that can be used for one or multiple container deployment)

npx warp deploy <configuration_file>

To deploy multiple containers at once, indicate the list of directories to deploy, by doing this way, the command will create a global configuration merging all sub configuration

npx warp deploy <directory1> <directory2> <directory3>

In that case you can also use configuration files and directories

npx warp deploy <configuration_file1> <directory1> <directory2> <configuration_file2>

After deployment

After deploying in an environment, you can have info about what has been deployed using

npx warp env info

The command will show you, the url, runners, containers, deployments you done in the environment.