You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Be sure, that your project (migrations!) is working as expected (tests!), because there is no backup mechanism during the deployment! <br />
12
13
> Do not deploy to production only, always test releases on staging before!
13
14
15
+
## Prerequisites
16
+
* Bitbucket account
17
+
* Bitbucket Pipeline build minutes available ([the free plan](https://confluence.atlassian.com/bitbucket/plans-and-billing-224395568.html#BitbucketCloudplandetails-Plandetails) has 50min per month)
18
+
* Hosting with SSH access
19
+
14
20
## Installation
15
21
You can easily install this package using Composer by running the following command:
16
22
```bash
@@ -23,7 +29,7 @@ php artisan vendor:publish
23
29
```
24
30
25
31
## Bitbucket Configuration
26
-
In order to get the build and deployment pipeline going at Bitbucket, you need to make the following steps on Bitbucket:
32
+
In order to get the build and deployment pipeline going at Bitbucket, you need to make the following steps in your Bitbucket repository:
27
33
1. Enable Pipelines
28
34
2. Add the repository variables: `DEPLOY_HOST` and `DEPLOY_USER`
29
35
3. Create a new SSH key, add your host to the known hosts and copy the public key to your hosting
@@ -33,21 +39,37 @@ In order to get the build and deployment pipeline going at Bitbucket, you need t
33
39
34
40
## Hosting Configuration
35
41
The deployment script requires the following folder structure on the web hosting in order to work:
* releases (each deployment will be placed here by the script in unique folders)
39
45
* storage (Laravel storage folder)
40
46
41
47
During each deployment, the `.env` file and the `storage` folder are referenced into the current build folder via symlinks.
42
48
Additionally a symlink `current` will be created (or updated) in the deployment folder, which points to the latest build folder.
43
49
44
-
To always point the webserver to the latest release, just create a symlink, that points on the `current` symlink.
50
+
To always point the webserver to the latest release, just create a symlink, that points on the `current` symlink (e.g. `cool_website.com` -> `cool_website_staging/current/public`. You don´t need to edit it during deployment. It will always point to the latest release.
45
51
46
52
## Requirements
47
53
This package has the following requirements:
48
-
49
54
- PHP 7.3 or higher
50
55
- Laravel 6.0 or higher
51
56
57
+
## How it works
58
+
This package scaffolds a [Bitbucket pipeline](https://bitbucket.org/product/de/features/pipelines) script and a [Laravel Envoyer](https://laravel.com/docs/master/envoy) script into your Laravel project.
59
+
60
+
When a new pipeline run is triggered (via git commit or manually) a full CI/CD (Continuous Integration/Continuous Delivery) build is executed with the following steps:
61
+
62
+
1. Fetch source code and install PHP dependencies (`Build PHP`)
63
+
2. Run `phpunit` and gather results - stops on any failed test (`Test PHP`)
64
+
3. Install javascript dependencies via npm and build UI assets(`Build Assets`)
65
+
4. Deploy to staging / production - connects to hosting via ssh and pushes build (`Deploy`)
66
+
* Create manifest file with original trigger commit details
67
+
* Create symlinks to `.env` and `storage`
68
+
* Check Laravel health (running `php artisan --version`)
69
+
* Activate build by updating the `current` symlink
70
+
* Optimise, migrate and cleanup Laravel project
71
+
72
+
The last step (step 4) is only executed when triggered from a commit on `develop` or `master` branch. Feature branches are build only, they do not get deployed.
73
+
52
74
## License
53
75
The GNU General Public License v3.0. Please see [License File](LICENSE) for more information.
0 commit comments