-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arthur LORENT
committed
May 13, 2020
0 parents
commit 3f96e5f
Showing
37 changed files
with
1,623 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.github export-ignore | ||
/tests export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/phpcs.xml export-ignore | ||
/phpmd.xml export-ignore | ||
/phpstan.neon.dist export-ignore | ||
/phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: ['7.4'] | ||
laravel: ['6.*', '7.*'] | ||
include: | ||
- laravel: '7.*' | ||
testbench: '5.*' | ||
- laravel: '6.*' | ||
testbench: '4.*' | ||
|
||
name: P${{ matrix.php }} - L${{ matrix.laravel }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache/files | ||
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: common, curl, json, mbstring, zip, sqlite, pdo_sqlite | ||
coverage: xdebug | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | ||
composer update --prefer-dist --no-interaction --no-suggest | ||
# lower php and laravel versions | ||
|
||
- name: PHPUnit | ||
if: matrix.php != '7.4' || matrix.laravel != '7.*' | ||
run: vendor/bin/phpunit | ||
|
||
# last php and laravel versions | ||
|
||
- name: Code analysis | ||
if: matrix.php == '7.4' && matrix.laravel == '7.*' | ||
run: | | ||
vendor/bin/phpcs | ||
vendor/bin/phpmd src text phpmd.xml | ||
vendor/bin/phpstan analyse | ||
- name: PHPUnit + Code coverage | ||
if: matrix.php == '7.4' && matrix.laravel == '7.*' | ||
run: | | ||
mkdir -p build/logs | ||
vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml | ||
- name: Code coverage upload to Coveralls | ||
if: matrix.php == '7.4' && matrix.laravel == '7.*' | ||
env: | ||
COVERALLS_RUN_LOCALLY: 1 | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
run: | | ||
echo ${GITHUB_REF##*/} | ||
composer require php-coveralls/php-coveralls | ||
vendor/bin/php-coveralls -v --coverage_clover=build/logs/clover.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
build | ||
composer.lock | ||
vendor | ||
coverage | ||
tests/Support/temp | ||
tests/temp | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
filter: | ||
excluded_paths: [tests/*] | ||
checks: | ||
php: true | ||
tools: | ||
php_mess_detector: true | ||
php_pdepend: true | ||
php_code_coverage: false | ||
external_code_coverage: false | ||
php_analyzer: true | ||
php_code_sniffer: | ||
config: | ||
standard: PSR4 | ||
filter: | ||
paths: ['src'] | ||
sensiolabs_security_checker: true | ||
php_loc: | ||
enabled: true | ||
excluded_dirs: [vendor, tests] | ||
php_cpd: | ||
enabled: true | ||
excluded_dirs: [vendor, tests] | ||
build: | ||
nodes: | ||
analysis: | ||
tests: | ||
override: | ||
- php-scrutinizer-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
|
||
## [1.0.0](https://github.com/Okipa/laravel-supervisor-downtime-notifier/releases/tag/1.0.0) | ||
|
||
2020-05-13 | ||
|
||
* First release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
Please read and understand the contribution guide before creating an issue or pull request. | ||
|
||
## Etiquette | ||
|
||
This project is open source, and as such, the maintainers give their free time to build and maintain the source code | ||
held within. They make the code freely available in the hope that it will be of use to other developers. It would be | ||
extremely unfair for them to suffer abuse or anger for their hard work. | ||
|
||
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the | ||
world that developers are civilized and selfless people. | ||
|
||
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient | ||
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. | ||
|
||
## Viability | ||
|
||
When requesting or submitting new features, first consider whether it might be useful to others. Open | ||
source projects are used by many developers, who may have entirely different needs to your own. Think about | ||
whether or not your feature is likely to be used by other users of the project. | ||
|
||
## Procedure | ||
|
||
Before filing an issue: | ||
|
||
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. | ||
- Check to make sure your feature suggestion isn't already present within the project. | ||
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. | ||
- Check the pull requests tab to ensure that the feature isn't already in progress. | ||
|
||
Before submitting a pull request: | ||
|
||
- Check the codebase to ensure that your feature doesn't already exist. | ||
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. | ||
|
||
## Requirements | ||
|
||
If the project maintainer has any additional requirements, you will find them listed here. | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Arthur LORENT | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Get notified when supervisor is down | ||
|
||
[![Source Code](https://img.shields.io/badge/source-okipa/laravel--supervisor--downtime--notifier-blue.svg)](https://github.com/Okipa/laravel-supervisor-downtime-notifier) | ||
[![Latest Version](https://img.shields.io/github/release/okipa/laravel-supervisor-downtime-notifier.svg?style=flat-square)](https://github.com/Okipa/laravel-supervisor-downtime-notifier/releases) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/okipa/laravel-supervisor-downtime-notifier.svg?style=flat-square)](https://packagist.org/packages/okipa/laravel-supervisor-downtime-notifier) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
[![Build status](https://github.com/Okipa/laravel-supervisor-downtime-notifier/workflows/CI/badge.svg)](https://github.com/Okipa/laravel-supervisor-downtime-notifier/actions) | ||
[![Coverage Status](https://coveralls.io/repos/github/Okipa/laravel-supervisor-downtime-notifier/badge.svg?branch=master)](https://coveralls.io/github/Okipa/laravel-supervisor-downtime-notifier?branch=master) | ||
[![Quality Score](https://img.shields.io/scrutinizer/g/Okipa/laravel-supervisor-downtime-notifier.svg?style=flat-square)](https://scrutinizer-ci.com/g/Okipa/laravel-supervisor-downtime-notifier/?branch=master) | ||
|
||
Get notified and execute PHP callback when: | ||
* the supervisor service is not running on your server. | ||
* your environment supervisor processes are down. | ||
|
||
Notifications can be sent by mail, Slack and webhooks (chats often provide a webhook API). | ||
|
||
## Compatibility | ||
|
||
| Laravel version | PHP version | Package version | | ||
|---|---|---| | ||
| ^6.0 | ^7.4 | ^1.0 | | ||
|
||
## Table of Contents | ||
- [Requirements](#requirements) | ||
- [Installation](#installation) | ||
- [Configuration](#configuration) | ||
- [Usage](#usage) | ||
- [Testing](#testing) | ||
- [Changelog](#changelog) | ||
- [Contributing](#contributing) | ||
- [Credits](#credits) | ||
- [Licence](#license) | ||
|
||
## Requirements | ||
|
||
By default, this package monitors supervisor downtime for projects running on Linux servers. | ||
|
||
The user running PHP CLI will execute the following commands: | ||
|
||
* `systemctl is-active supervisor` | ||
* `supervisorctl status "<your-process-name>"` | ||
|
||
As so, make sure you give him permission to execute these actions (`sudo visudo -f /etc/sudoers.d/<user>`) : | ||
|
||
* `<user> ALL=NOPASSWD:/bin/systemctl is-active supervisor` | ||
* `<user> ALL=NOPASSWD:/usr/bin/supervisorctl status *` | ||
|
||
That being said, you still can use this package for other servers OS by using your own `SupervisorChecker` class and defining OS-specific commands. | ||
|
||
## Installation | ||
|
||
Install the package with composer: | ||
|
||
```bash | ||
composer require "okipa/laravel-supervisor-downtime-notifier:^1.0" | ||
``` | ||
|
||
In case you want to use `Slack` notifications you'll also have to install: | ||
|
||
```bash | ||
composer require guzzlehttp/guzzle | ||
``` | ||
|
||
## Configuration | ||
|
||
Publish the package configuration: | ||
|
||
```bash | ||
php artisan vendor:publish --tag=supervisor-downtime-notifier:config | ||
``` | ||
|
||
## Usage | ||
|
||
Just add this command in the `schedule()` method of your `\App\Console\Kernel` class : | ||
|
||
```php | ||
$schedule->command('supervisor:downtime:notify')->everyFifteenMinutes(); | ||
``` | ||
|
||
And you will be notified if your supervisor service is not running, or if your environment supervisor processes are down when the command will be executed. | ||
|
||
## Testing | ||
|
||
```bash | ||
composer test | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
## Credits | ||
|
||
- [Arthur LORENT](https://github.com/okipa) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
Oops, something went wrong.