What are Beanstalk’s deployment tools?
This article will give you a quick overview of what deployments are and how to use them. Unlimited deployments are offered on all paid accounts.
What are Beanstalk’s deployment tools?
Beanstalk allows you to deploy code from your repository to your web server in one step. You can setup your repository to manually or automatically upload your changed files to any web server via FTP or SFTP.
You can also run shell commands using our SSH deployment. Once a deployment is triggered, we’ll run any commands on the remote server you tell us to.
FTP/SFTP deployments work as a synchronization tool. After the first deployment Beanstalk will check for changes in the most recent revision of your repository to the one on the remote server. It will then upload those changes to the remote server, which makes it extremely fast to keep everything up to date. Beanstalk will add, edit and remove files as they were added, edited and removed in the repository.
You can trigger a deployment in three ways:
- Automatically each time a commit or push is made in the repository.
- Manually in your Beanstalk account by anyone with permissions to deploy that repository.
- Adding a tag to any commit or push comment like
[Deploy: Staging]
If you are deploying manually, Beanstalk allows you to select any revision in the repository. This way, you can choose an older one to rollback in case of any problems introduced in a recent deployment.
If you are using SSH deployment, we’ll simply run the shell command you enter on your settings page whenever a deployment is triggered. These can be triggered in the same three methods as FTP/SFTP deployments.
Getting started
To deploy your files or execute commands, you’ll need to first setup a server Environment. You’ll see a “Deployments” tab in the repository where you can set them up.
What is an environment?
An environment houses the server or servers you setup for deploying. A deployment will upload to all servers within this environment. Personal accounts can setup one server per environment, while Business accounts can deploy to many servers at once. Each environment is then set to either deploy automatically on a push/commit or manually.
For example, an environment might be called “Staging” or “Production”. For the Personal plans you’ll have a single server in there that will upload changes or execute commands on your staging or production remote server. For Business plans you could add multiple servers to the one environment. This is great if you have separate servers that are load balanced or host different parts of your repository on different servers.
What is a server?
Inside an environment you add the specific deployment server. You’ll define the hostname and paths where the files should be uploaded, or the SSH commands that will be run. This is also where you provide credentials to authenticate to your end server, or use the provided SSH keys.
If you are setting up an SSH deployment server, you just need to specify the commands. You won’t need to define specific paths since it will not deploy any files, but execute commands for you.
The first deployment
When you first setup a deployment server, or if you edit server settings, Beanstalk will deploy all files in your repository from scratch. That means Beanstalk will check every single file in the repository to make sure it matches the remote server. If you have an existing server with all of the files, you can skip this step by selecting a specific revision. Once the files are there, the subsequent deployments will only upload the files that changed since the last deployment.
Tracking deployments
Each deployment will create a set of release notes. These release notes will display what has changed since the last deployment to keep your team or clients in the loop.
Troubleshooting and tips
If you have a firewall setup, please read our article on ports and IPs. You may need to add our IPs to make a deployment go through. To diagnose issues, any failed connections will trigger our “Incidents” tool to explain the problem. We’ll try to detect what happened and give you tips on a resolution. If that doesn’t help, you can always get in touch and we’ll figure out what’s going on.