{"id":104305,"url":"https://github.com/sjorso/deploy-laravel","last_synced_at":"2025-08-28T12:38:31.462Z","repository":{"id":248845883,"uuid":"829964644","full_name":"SjorsO/deploy-laravel","owner":"SjorsO","description":"Production-ready zero-downtime deployment script for Laravel","archived":false,"fork":false,"pushed_at":"2024-08-02T08:57:51.000Z","size":44,"stargazers_count":86,"open_issues_count":0,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-17T06:37:09.355Z","etag":null,"topics":["deployment","laravel"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SjorsO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-17T10:43:49.000Z","updated_at":"2024-11-18T06:18:03.000Z","dependencies_parsed_at":"2024-07-31T05:53:23.525Z","dependency_job_id":null,"html_url":"https://github.com/SjorsO/deploy-laravel","commit_stats":null,"previous_names":["sjorso/deploy-laravel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SjorsO%2Fdeploy-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SjorsO%2Fdeploy-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SjorsO%2Fdeploy-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SjorsO%2Fdeploy-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SjorsO","download_url":"https://codeload.github.com/SjorsO/deploy-laravel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230788196,"owners_count":18280295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","laravel"],"created_at":"2024-01-06T02:23:24.247Z","updated_at":"2024-12-22T02:31:29.683Z","avatar_url":"https://github.com/SjorsO.png","language":"Shell","funding_links":[],"categories":["The list"],"sub_categories":["Developer tools"],"readme":"# Deploy Laravel\nProduction-ready zero-downtime deployment script for Laravel.\n\n## Install\nVisit the link below for the download and the installation guide:\n- [Deploy Laravel for GitHub Actions](https://sjorso.com/deploy-laravel/github/step-1)\n- [Deploy Laravel for GitLab CI/CD](https://sjorso.com/deploy-laravel/gitlab/step-1)\n- [Deploy Laravel for Bitbucket Pipelines](https://sjorso.com/deploy-laravel/bitbucket/step-1)\n\nRequirements:\n- Laravel 5 or higher\n- Ubuntu 16.04 or higher / CentOS7 or higher\n\nInstalling this deployment script can typically be done in less than 10 minutes.\nMake sure you follow the installation guide linked above, it helps you configure the script and it prevents any pitfalls (like the pitfall of having stored user uploaded files in the public directory). \n\n## Migrating to this deployment script\nThis deployment script is compatible with Deployer and Laravel Envoyer.\nIf you have already deployed your application with Deployer or Laravel Envoyer then you can switch to this deployment script without making any changes.\n\nIf your application has already been deployed with git clone, FTP or Laravel Forge quick deploy, then you only have to change your Apache2/Nginx webroot from `public` to `current/public`.\nHow to make this change is explained in the installation guide.\n\n## Features\nThis deployment script follows all [deployment best practices](https://sjorso.com/laravel-deployment-best-practices) (except running your tests).\nA quick overview:\n- CI/CD starts running when you push a new commit to the main branch\n- CI/CD builds and bundles your application\n- The bundle is uploaded to your server\n- When everything is ready the new release is activated (zero-downtime)\n- Laravel's optimization commands are run by the [before](https://github.com/SjorsO/deploy-laravel/blob/main/src/script/hooks/before-activation.sh) and [after](https://github.com/SjorsO/deploy-laravel/blob/main/src/script/hooks/after-activation.sh) activation hooks.\n- File permissions are set correctly for the new release (if necessary)\n- [OPCache is flushed](https://github.com/SjorsO/deploy-laravel/blob/main/src/script/hooks/flush-opcache.sh) by calling `opcache_reset()` \n\n## Zero-downtime deployments (current \u0026 releases directory)\nThis deployment script is zero-downtime, this has two big advantages: deployments don't cause downtime for your users, and deployments are gracefully aborted when something goes wrong.\nTo understand what exactly this means, lets first look at what it means if your deployments are not zero-downtime.\n\nA typical not zero-downtime deployment strategy is SSHing into your server, calling `git clone`, and then running `composer install`.\nWhile these commands are running your application is in limbo: some code is new, some code is old, and some new dependencies are missing entirely.\nA user visiting your application while this deployment is running will most likely receive a 500 error.\nEven worse, if the `composer install` fails then you have to scramble to roll back the `git clone` you already did.\n\nThis deployment script solves these problems by using the following directory structure:\n\n```\nproject\n├── .env\n├── current/ (your nginx/apache2 webroot)\n├── releases/\n│   ├── 1/ (old release, unused)\n│   ├── 2/ (old release, unused)\n│   └── 3/ (the latest release, symlinked to the \"current\" directory)\n└── storage/\n```\n\nNginx/Apache2 is serving your application from the \"current\" directory.\nThis directory is a symlink to the latest release directory.\nThis deployment script creates a new release directory for each deployment, but it does not change the symlink until that release is completely ready.\n\nUsing a new release directory for each deployment means that a running deployment does not affect your current application at all.\nEven if a step in the deployment script fails, the new release directory will simply get deleted and your application keeps running like before.\n\nOnce the new release is completely ready the new release is [symlinked to the \"current\" directory](https://github.com/SjorsO/deploy-laravel/blob/fd6ddaf5a6562db60c4c1711c66ef76e142213df/src/script/deploy.sh#L166-L169).\nChanging the symlink is instant, also causing no downtime for your users.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjorso%2Fdeploy-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjorso%2Fdeploy-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjorso%2Fdeploy-laravel/lists"}