Skip to content
Deploy Laravel 5 or Lumen using Ansible in Capistrano way
Ruby HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Add routes caching Nov 21, 2016
group_vars Add debug info May 19, 2016
roles Update to handle lumen May 19, 2016
.gitignore Add debug info May 19, 2016
README.md Fix mistakes in readme Nov 15, 2016
ansible.cfg Initial commit Apr 13, 2016
hosts.example Initial commit Apr 13, 2016
playbook-deploy.yml Rename playbooks Apr 14, 2016
playbook-migrate.yml Rename playbooks Apr 14, 2016
playbook-rollback.yml Rename playbooks Apr 14, 2016
playbook-seed.yml Rename playbooks Apr 14, 2016

README.md

Deploy Laravel 5 using Ansible in Capistrano way

Prepare

Create hosts file for all your environments from example:

cp hosts.example production

Create group_vars/laravel.yml from example:

cp group_vars/laravel.example.yml group_vars/laravel.yml

Edit it to match your environment.

Note! Playbook uses Ansistrano, so you are free to update default group_vars and use Ansistrano's.

Use

Playbooks:

  • playbook-deploy.yml - Run files deployment
  • playbook-rollback.yml - Rollback deploy
  • playbook-migrate.yml - Run migrations
  • playbook-seed.yml - Run seeding
ansible-playbook playbook-deploy.yml -i production -u root

Deployment order

  1. Init releases directory structure
  2. Update repository
  3. Export a copy of the repo to a new release directory
  4. Copy .env.example to shared/.env if it was absent
  5. Copy storage to shared/storage if it was absent
  6. Remove local .env & storage from release directory
  7. Create soft links to shared .env & storage
  8. Install composer locally
  9. Run composer self-update
  10. Run composer install
  11. Clear Laravel cache
  12. Optimize code
  13. Run npm install
  14. Run gulp --production
  15. Change soflink to new release
  16. Update chown
  17. Install cachetool to clear opcache
  18. Run cachetool opcache:reset
  19. Restart Laravel queue
  20. Delete old relases

Attention! Don't forget to update your shared/.env file after first deploy!

You can’t perform that action at this time.