Skip to content

Commit 40a3e1e

Browse files
authored
Merge pull request #2 from erdmenchen/release/0.1-beta.3
Release/0.1 beta.3
2 parents 79f4e04 + 6410b8b commit 40a3e1e

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ Deploy your laravel app via bitbucket pipelines and envoyer.
44
<p align="center">
55
<a href="https://packagist.org/packages/erdmenchen/laravel-bitbucket-deploy"><img src="https://poser.pugx.org/erdmenchen/laravel-bitbucket-deploy/downloads"></a>
66
<a href="https://packagist.org/packages/erdmenchen/laravel-bitbucket-deploy"><img src="https://poser.pugx.org/erdmenchen/laravel-bitbucket-deploy/version"></a>
7+
<a href="https://packagist.org/packages/erdmenchen/laravel-bitbucket-deploy"><img src="https://poser.pugx.org/erdmenchen/laravel-bitbucket-deploy/v/unstable"></a>
78
<a href="https://packagist.org/packages/erdmenchen/laravel-bitbucket-deploy"><img src="https://poser.pugx.org/erdmenchen/laravel-bitbucket-deploy/license"></a>
89
</p>
910

1011
> **Important:** <br />
1112
> Be sure, that your project (migrations!) is working as expected (tests!), because there is no backup mechanism during the deployment! <br />
1213
> Do not deploy to production only, always test releases on staging before!
1314
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+
1420
## Installation
1521
You can easily install this package using Composer by running the following command:
1622
```bash
@@ -23,7 +29,7 @@ php artisan vendor:publish
2329
```
2430

2531
## 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:
2733
1. Enable Pipelines
2834
2. Add the repository variables: `DEPLOY_HOST` and `DEPLOY_USER`
2935
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
3339

3440
## Hosting Configuration
3541
The deployment script requires the following folder structure on the web hosting in order to work:
36-
* Deployment Target Folder
42+
* Deployment Target Folder (e.g. `cool_website_staging`)
3743
* .env (Laravel environment config file)
3844
* releases (each deployment will be placed here by the script in unique folders)
3945
* storage (Laravel storage folder)
4046

4147
During each deployment, the `.env` file and the `storage` folder are referenced into the current build folder via symlinks.
4248
Additionally a symlink `current` will be created (or updated) in the deployment folder, which points to the latest build folder.
4349

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.
4551

4652
## Requirements
4753
This package has the following requirements:
48-
4954
- PHP 7.3 or higher
5055
- Laravel 6.0 or higher
5156

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+
5274
## License
5375
The GNU General Public License v3.0. Please see [License File](LICENSE) for more information.
File renamed without changes.

0 commit comments

Comments
 (0)