Using Build Tools to Deploy

Build Tools are a great feature of DeployBot. It allows you to compile, compress and minimize your code, build executable files, and run tests on your code, among other things. Just provide us with a script or single command to run, and DeployBot executes it on our servers, inside a protected container.

The Advantage of Build Tools

There are a number of advantages to using DeployBot’s Build Tools:

  1. It provides an efficient process to minify your assets  so the code is smaller and optimized when it actually deploys to a server.
  2. DeployBot creates a secure environment where it executes the commands built as part of the deployment process.
  3. DeployBot makes sure the code is running and actually working before deploying it to the server. DeployBot doesn't even start to deploy the files to the server until the build is confirmed as successful.
Using Build Tools to Deploy Current

How Build Tools Work

DeployBot creates a container where most of needed programs are actually installed.

The build script in the container is executed as part of the deployment process. If the build is successful, files and directories that were changed, added, or removed during the build get deployed to your server.

If the exit code is non-zero, DeployBot cancels the deployment and marks it as failed. For example, when a user deploys directly to a server, he has to run the commands against his code in the server. If something goes wrong, the application stays offline until the user deploys back the last working commit.

Setting Up Build Tools

When you set up a new environment or add a new server you can use the Setup and Build Tools under the “compile compress or minimize your code” section.

There are a number of predefined containers, but you can also choose one from the official Docker registry. If needed, you can create your own container with a specific configuration. If some package or dependency is missing from the container, you can install it in the container so the container can run certain commands against your code.

When installing dependencies in a container it's always a better idea to write those commands in cached build commands. This means that these commands will only be executed once, or when something in the dependencies change. This saves time by not installing the dependencies on every deployment. For example, the cached build commands will be executed again when one of these files change; Gemfile, Gemfile.lock, package.json, gulpfile.js, Gruntfile.js, project.clj, composer.json, or if you specify to execute once a certain file was changed.

Combining Build Tools with atomic deployments means you’ll get zero downtime on every deployment.

Automated doesn’t have to be complicated. Try DeployBot today!