Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

Generating deployer script

How to generate deployer script? I heard when you want to use deployer on the server you must be able to generate deployer script.

ref: https://code.tutsplus.com/tutorials/how-to-deploy-with-deployer--cms-29719

The problem is I am using Windows. I want to install deployer on my web server at least. Is that possible? I have ssh on the server and my friend said try to generate deployer script, but I don't know how to using Windows

0 likes
8 replies
fylzero's avatar

You should check out Envoy. Really nice way to deploy from local using Git.

https://laravel.com/docs/6.x/envoy

Basically, setup a Git repo... get your code on Github... SSH into your server... generate an SSH key ON YOUR SERVER... add that key to Github... clone your code to your server using:

git clone [email protected] .

Once you've done that just, pull in envoy using composer global require laravel/envoy , create and Envoy.blade.php file and follow the instructions in the docs... mine looks like this... I use ServerPilot / DigitalOcean...

@servers(['localhost' => '127.0.0.1', 'www' => ['[email protected]']])

{{-- envoy run deploy --}}
@task('deploy', ['on' => 'www'])
    cd ~/apps/mycode
    php artisan down --message="Deploying New Code"
    git pull origin master
    composer install --optimize-autoloader --no-dev
    php artisan config:clear
    php artisan config:cache
    php artisan route:clear
    php artisan route:cache
    npm install --production
    php artisan migrate --force
    php artisan up
@endtask

Once you've done all this, all you have to do is git push to Github then run envoy run deploy locally and it will deploy your code for you.

23 likes
davy_yg's avatar
Level 27

How does the server know to which folder to deploy the latest release version?

Is laravel envoy a package for laravel to deploy?

We have outsouce an IT consultant and everytime they deploy a new release version appears on the production server. Everytkme they deploy a newer folder version appears on the server. Is this how it works?

Cronix's avatar

Here's a whole series detailing how it works, if you care to watch: https://laracasts.com/series/envoyer

It's pretty simple. It just uses symlinks to tell it what directory is the "new laravel" directory to use, just like when you use "artisan storage:link"

fylzero's avatar

@davy_yg The link I provided answers these questions. Seriously, RTFM.

In the top of the deploy script you change to the deploy directory. Envoy uses git pull on the server to deploy.

23 likes
fylzero's avatar

@cronix Envoyer and Envoy are two different things. If you want a service to handle deployment use Envoyer... if you want to write a simple deployment script Envoy has you covered.

I personally use Envoy and deploy to DigitalOcean/ServerPilot.

23 likes
davy_yg's avatar
Level 27

I am considering about subscribing these:

Envoyer - https://envoyer.io

Laravel Forge - https://forge.laravel.com

Perhaps for 1 month to learn how use them. What do I need to prepare before subscribing? I need to master them first before requesting for the company to pay for it.

davy_yg's avatar
Level 27

To use deployer is envoyer it self is enough? Do I need to subsribe to forge as well? Is digitalocean and serverpilot are alternatives to forge?

It seems like forge is a server management is it require to deploy? We are using Indonet for the web server as of now, later we will migrate to AWS (Amazon Web Service).

By the way, can you deploy for free with envoy?

envoy.blade.php

@servers(['localhost' => '127.0.0.1', 'www' => ['[email protected]']])

{{-- envoy run deploy --}}
@task('deploy', ['on' => 'www'])
    cd ~/apps/mycode
    php artisan down --message="Deploying New Code"
    git pull origin master
    composer install --optimize-autoloader --no-dev
    php artisan config:clear
    php artisan config:cache
    php artisan route:clear
    php artisan route:cache
    npm install --production
    php artisan migrate --force
    php artisan up
@endtask

What should I replace this with: [email protected]

I am using dewaweb.com for my webhost.

Please or to participate in this conversation.