Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icanhazstring/duck-pony
PHP Integration Server Maintenance
https://github.com/icanhazstring/duck-pony
jira maintenance php server systemctl-php tempa-php
Last synced: 13 days ago
JSON representation
PHP Integration Server Maintenance
- Host: GitHub
- URL: https://github.com/icanhazstring/duck-pony
- Owner: icanhazstring
- License: mit
- Created: 2017-05-05T15:14:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T09:16:19.000Z (over 1 year ago)
- Last Synced: 2024-10-11T01:08:44.188Z (27 days ago)
- Topics: jira, maintenance, php, server, systemctl-php, tempa-php
- Language: PHP
- Homepage:
- Size: 189 KB
- Stars: 5
- Watchers: 4
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# duck-pony
`duck-pony` is a little maintenance tool used to manage integration server instances.
It is linked to Atlassian Jira to retrieve information of what actions to perform.These actions include
- CleanBranch
- CleanMySQLDatabase
- PurgeService
- RemoveOrphanedSymlinks# Installation
To use this tool simply clone or download it onto your integration server.
> Be aware that some commands needs some kind of `root` execution rights (e.g. to shutdown a service using `systemctl`)Start by using composer to install all needed packages. (You might want to skip dev packages)
```bash
$ composer install --no-dev
```To configure your `config.yml` use [icanhazstring/tempa-php](https://github.com/icanhazstring/tempa-php) which is included in this tool.
```bash
$ vendor/bin/tempa file:substitute \
config/ \
tempa.json \
jira_host=JIRA_HOST \
jira_username=JIRA_USER \
jira_password=JIRA_PASSWORD \
pattern=BRANCH_PATTERN_REGEX \
db_host=DB_HOST \
db_username=DB_USER \
db_password=DB_PASSWORD \
instance_pattern=SYSTEMD_SERVICE_PATTERN \
slack_token=SLACK_TOKEN \
slack_channel=SLACK_CHANNEL```
> The `pattern` is used to identify tickets and folders alike. This means, your folders **MUST** have the same name
as the ticket in your jira board.> If slack_token and slack_channel are set, logged messages with a level of critical or higher will be sent to this slack channel
# Commands
## CleanBranch```bash
$ bin/dp folder:clean --helpDescription:
Scan folder an clean branchesUsage:
folder:clean [options] [--]Arguments:
folder Folder
branchname-filter Remove parts of the folder name to match jira ticketOptions:
-s, --status=STATUS Status
-p, --pattern=PATTERN Branch pattern
--keep-days[=KEEP-DAYS] The number of days a branch is allowed to remain.
-i, --invert Invert status
-y, --yes Confirm questions with yes
-c, --config=CONFIG Config [default: "/home/vendor/duck-pony/config/config.yml"]
-f, --force Force delete
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--branchname-filter Remove parts of the branchname for better jira ticket matchingHelp:
Scan folder iterate over sub folders and removes
them under certain conditions
```**Example**: Clean every branch that is currently **not** "in progress", "reopened", "todo" or "in review".
```bash
$ bin/dp folder:clean /path/to/folder --status="reopened,open,in progress,in review" --invert --yes
```## PurgeService
```bash
Description:
Scan folder an purge services with same nameUsage:
service:purge [options] [--]Arguments:
folder Deployment folder as referenceOptions:
-u, --unit=UNIT Name of unit
-p, --pattern=PATTERN Instance pattern
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugHelp:
Disables and stops systemd services that have
no reference folder in given folder argument
```**Example**: Purge every `awesome` service from systemd which is not present in scanned folder
Assuming the following folder structure and services:
```
/path/to/folder
|- ABC-123systemd services:
- awesome@ABC-124
- awesome@ABC-125
```Executing this command:
```bash
$ bin/dp service:purge /path/to/folder --unit=awesome@'
```Will remove the following systemd services:
- awesome@ABC-124
- awesome@ABC-125## RemoveOrphanedSymlinks
```bash
Description:
Removes orphaned symlinks of a given folderUsage:
symlinks:remove_orphanedArguments:
folder FolderOptions:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugHelp:
Removes only orphaned symlinks under a given folder without any recursion.
```Example: Remove every orphaned symlink under nginx site-enabled
```bash
$ bin/dp symlinks:remove_orphaned /etc/nginx/sites-enabled
```## CleanMySQLDatabase
```bash
$ bin/dp db:clean --helpDescription:
Scans Database and cleans orphanedUsage:
db:clean [options] [--]Arguments:
branchname-filter Remove parts of the folder name to match jira ticketOptions:
-s, --status=STATUS Status
-p, --pattern=PATTERN Branch pattern
-i, --invert Invert status
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugHelp:
Scans MySQL Databases and removes
them under certain conditions
```**Example**: Clean every database of tickets that are currently **not** "in progress", "reopened", "todo" or "in review".
```bash
$ bin/dp db:clean --status="reopened,open,in progress,in review" --invert rsv_feature- rsv_bugfix-
```