Skip to main content
Version: 7.x

Getting Started

This tutorial will cover:

  • Provisioning a new server.
  • Configuring a deployment.
  • Automateing deployment via GitHub Actions.

Tutorial duration: 7 min

First, install the Deployer:

curl -LO
mv deployer.phar /usr/local/bin/dep
chmod +x /usr/local/bin/dep

Now lets cd into the project and run following command:

dep init

Deployer will ask you a few question and after finishing you will have a deploy.php or deploy.yaml file. This is our deployment recipe. It contains hosts, tasks and requires other recipes. All framework recipes that come with Deployer are based on the common recipe.



If you already have a configured webserver you may skip to deployment.

Let's create a new VPS on Linode, DigitalOcean, Vultr, AWS, GCP, etc.

Make sure the image is Ubuntu 20.04 LTS as this version is supported via Deployer provision recipe.

Configure Reverse DNS or RDNS on your server. This will allow you to ssh into server using the domain name instead of the IP address.

Now let's provision our server.

dep provision -o remote_user=root

We added -o remote_user=root to make Deployer use the root user to connect to host for provisioning.

Deployer will ask you a few questions during provisioning like what php version and database type you would like to use.

Provisioning will take around 5 minutes and will install everything we need to run a site. It will also configure a deployer user we will need to use to ssh to our host. A new website will be configured at deploy_path.

After we have configured the webserver, let's deploy the project.


To deploy the project:

dep deploy

Ssh to host, for example, for editing .env file.

dep ssh

Let's add a build step on our host:

task('build', function () {
run('npm install');
run('npm run prod');

after('deploy:update_code', 'build');

Deployer has a useful task for examining what is currently deployed.

$ dep releases
task releases
+---------------------+--------- -------+--------+-----------+
| Date (UTC) | Release | Author | Target | Commit |
| 2021-11-05 14:00:22 | 1 (current) | Anton Medvedev | HEAD | 943ded2be |

During development, the dep push task maybe useful.

Deploy on push

Not let's use GitHub Action for Deployer.

Create .github/workflows/deploy.yml file with following content:

name: deploy

branches: [ master ]

concurrency: production_environment

runs-on: ubuntu-latest

- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
php-version: '8.0'

- name: Deploy
uses: deployphp/action@v1
private-key: ${{ secrets.PRIVATE_KEY }}
dep: deploy

The concurrency: production_environment is important as it prevents concurrent deploys.

Support Deployer โค๏ธ

Hello, my name is Anton Medvedev. I'm the creator of the Deployer. I maintain this open source project in my spare time. Supporters on GitHub give me extra motivation to work on the project.

Consider supporting Deployer via GitHub Sponsors.