In this article, I’ll walk you through how you can easily update your site by deploying your code from a Git repository to an SFTP server using Launchdeck.

There are several ways of uploading code to your SFTP server. You could, for instance, use an SFTP client, or install git onto your server and run a command such as git pull to update sources on your server.

Both methods are relatively quick and simple, but they’re still manual processes requiring you to log into your server.

If you have full shell access to your remote server you can also use the zero downtime SSH deployment "strategy". We've written a tutorial on how to deploy your code with atomic SSH deployments.

Before you get started 

When you first start using Launchdeck to improve your deployment process and development workflow, it’s important that you’re already using Git, and have access to an SFTP server that you wish to deploy code to. If you’re not already using Git, do yourself a favor and look into it! Git’s main website has some great resources to get you started.

We offer a free full-featured plan that allows you to deploy one project as often as you’d like!

Connect your GitHub, Bitbucket or GitLab repository

Once you've signed up for a new Launchdeck account, you can create your first project and link it to your Git account. You can easily connect a Github or Bitbucket account and choose from the list of repositories available within the account. Or if you're using a different Git provider, like GitLab or a self-hosted server, you can choose the Private/Hosted Git server option.

Deploy from Git to SSH

Setup your build

The next step allows you to define commands which will be executed in an isolated docker container - this is the build step. You can use this step to, for example, compile assets, install dependencies, run tests, and everything in between.

All files generated using these build commands will be uploaded to your server. You’ll find more information on how to set up and use build commands in our build commands docs.

Run build commands before deployment

Configure an SFTP server

Now let’s tell Launchdeck where to upload the files.

Pick ‘SFTP’ as the server type and give it an easily recognizable name.

Enter your server’s hostname, and optionally the SFTP port if you wish to use a different port (the default ‘22’ is standard for the SFTP protocol).

Enter your username, and you’ll then be presented with two choices in terms of authentication: an SSH key or a simple password.

For security, we recommend creating a separate user to use for deployments.

sudo adduser launchdeck
sudo usermod -a -G www-data launchdeck

If you opt for the former option, we’ll generate a public key for you as well as a one-liner that you may run on your server to add this key to the “authorized_keys” file.

It’s not uncommon for a shared hosting provider to offer semi-restricted SSH access, for which you’ll need to add the SSH key through the web interface offered by your hosting provider. In this case, copy the public key using the “copy the public key” link and add it through said web interface. Often, you’ll also have to whitelist our IP address or explicitly link it to the key address you’re adding. You’ll find the appropriate IP address in the “Server configuration” modal (note that this IP address might be different across projects or users).

Deploy from Git to SFTP server

Enter the upload path to which your files should be uploaded. This is the absolute path on the remote server. On DirectAdmin-based systems, for example, this path will look something like /home/<username>/domains/<domain>/public_html.

To figure out whether the server connection data is correct, run the server connection test and we’ll try to connect to your server and check the provided path(s).

Deploy configuration files

When you deploy, you often need to store a configuration file on your server or some other file that has to be present - like an SSL certificate. For that you can use our configuration files feature allows you to define a set of files on a per-server basis. As such, you'll find the configuration files control in the server settings modal.

You’ll find more information on how to set up and use config files on our docs page about config files.

Deploy configuration file Laravel

Deploy for the first time

You’re now ready to start our first deployment. Click ‘create new project’ to confirm the settings and add the project. In the project overview, you can now start the build. The code will be cloned from your repository and prepared for you to publish it. Hit ‘Publish’ and your code is live!

If you then commit changes to our repository, the commit will automatically appear in your project overview where you’ll be able to upload and publish your new version with the push of a button. If anything goes wrong, you can simply roll back to the latest working version.

That’s all! By using Launchdeck to deploy to your SFTP server, you’ll never have to upload a new version or run commands manually. Just hit “publish”, and Launchdeck will deploy your site or app within seconds.

Deploy from Github Bitbucket to SFTP server

A better way to deploy code

Get started for free

Free • Simple setup • Cancel any time

A better way to deploy code

Get started for free

Free • Simple setup • Cancel any time

A little bit about the author
Webdesigner and front-end developer. Marketing, UI, UX & SEO enthusiast. Likes to delete buttons, features and settings for a more intuitive design. Life motto: Less is more.