Zero-downtime Laravel deployment in 5 minutes

2 years ago
1 min read

Checklist

Set up Laravel Deployer

❑  Go to your application folder
❑  composer require lorisleiva/laravel-deployer
❑  php artisan deploy:init
❑  php artisan deploy

Ensure your server can communicate with GitHub

  • If your server don’t have a SSH key, create one:
    ❑  ssh-keygen -t rsa -b 4096 -C "[email protected]"
    ❑  eval "$(ssh-agent -s)"
    ❑  ssh-add ~/.ssh/id_rsa
  • If your server don’t have github.com in its known_hosts:
    ❑  Deploy using the git_tty option.
    ❑  php artisan deploy -o git_tty=true

Set up your production environment

❑  php artisan ssh
❑  cp .env.example .env
❑  php artisan key:generate
❑  vim .env and configure your production environment.
❑  exit
❑  php artisan deploy

Update nginx configurations

❑  vim /etc/nginx/sites-available/mydomain.com
❑  Point the root folder to the current/public directory.
❑  service nginx restart && service php7.2-fpm reload

Discussions

Would you like to chime in?

You must be a member to start a new discussion.

Fortunately, it only takes two click to become one. See you on the other side! 🌸

Become a Member