|
| 1 | +# Contributing to Automatron |
| 2 | + |
| 3 | +Community contributions are essential to the growth of Automatron. Both code and documentation contributions are not only welcomed, they are encouraged. The following guidelines will explain how to get started with contributing to this project. |
| 4 | + |
| 5 | +## Accept our Contributor License Agreement |
| 6 | + |
| 7 | +Before starting to contribute to Automatron please review and accept our [Contributor License Agreement](https://goo.gl/forms/44vauc2jjlNlln2t1) |
| 8 | + |
| 9 | +## Core vs. Plugins |
| 10 | + |
| 11 | +Contributing to the Core platform and contributing Plugins have two different guidelines and requirements. The below will explain some basic concepts of how to contribute different functionality. |
| 12 | + |
| 13 | +### Core |
| 14 | + |
| 15 | +Automatron follows a pluggable architecture with the majority of features being provided by plugins located within the `plugins/` directory. This allows us to keep the Core framework minimal and simple. |
| 16 | + |
| 17 | +At this time there are 4 primary core components of Automatron. |
| 18 | + |
| 19 | + * `discovery` - This component is used to launch node Discovery plugins which serve the purpose of finding new nodes to monitor. |
| 20 | + * `runbooks` - The Runbooks component is used to parse and update the monitoring and actioning "rules" applied to monitored nodes. |
| 21 | + * `monitoring` - Monitoring is a component that is used to schedule defined checks as well as launching and executing the defined check. |
| 22 | + * `actioning` - The Actioning component listen for events based on checks and performs actions specified within Runbooks. |
| 23 | + |
| 24 | +These components are written in Python and as such should follow basic Python development practices. |
| 25 | + |
| 26 | +### Plugins |
| 27 | + |
| 28 | +Where the Automatron Core provides a monitoring and actioning framework, the functional features are all provided by Automatron Plugins. Plugins, are the fastest way to add features to Automatron. As such it is suggested that new contributors start by adding a plugin before adding core functionality. |
| 29 | + |
| 30 | +#### Executable Plugins |
| 31 | + |
| 32 | +At this time there are 6 types of Plugins. |
| 33 | + |
| 34 | + * `actions` - Executables used to perform corrective actions. |
| 35 | + * `checks` - Executables used to check system health (Nagios compatible). |
| 36 | + * `datastores` - Python modules used by Automatron Core to access datastores. |
| 37 | + * `discovery` - Python modules used by Automatron to automatically detect new monitoring targets. |
| 38 | + * `logging` - Python modules used to provide custom logging mechanisms to Automatron Core. |
| 39 | + * `vetting` - Executables used to identify `facts` for discovered monitoring targets. |
| 40 | + |
| 41 | +While `datastores`, `logging`, and `discovery` plugins are Python modules; `actions`, `checks` and `vetting` are simply executables. |
| 42 | +Python is the preferred approach however, these plugins may also be written in Perl or BASH. While other languages are accepted it is important to ensure capabilities are available across as many platforms as possible. When writing plugins do consider the availability of functionality on generic systems. |
| 43 | + |
| 44 | +## Contribution Workflow & Requirements |
| 45 | + |
| 46 | +Automatron follows a workflow very similar to the GitHub flow. |
| 47 | + |
| 48 | +Pull Requests for new features should be opened against the `develop` branch. It is recommended to create a feature branch on your local repository from the `develop` branch to avoid merge conflicts or and ease the integration process. |
| 49 | + |
| 50 | +```console |
| 51 | +$ git checkout develop |
| 52 | +$ git checkout -b new-feature |
| 53 | +``` |
| 54 | + |
| 55 | +Periodically the `develop` branch will be merged into the `master` branch to start the process of creating a new release. Prior to merging changes into `master` a release branch will be created for the previous release base. |
| 56 | + |
| 57 | +When opening a Pull Request for a bug fix, if the fix is for the current release, the Pull Request should be opened to the `master` branch. If the fix is for a previous release, the Pull Request should be opened to the release specific branch. |
| 58 | + |
| 59 | +If the bug fix should also be incorporated with the `develop` branch a second Pull Request should be opened to the `develop` branch. |
| 60 | + |
| 61 | +### Tests are required for Core and some Plugins |
| 62 | + |
| 63 | +Any Pull Requests for the Automatron core code base should include applicable `unit`, `integration` and `functional` tests. Automatron uses Coveralls to ensure code coverage does not decrease with each Pull Request. |
| 64 | + |
| 65 | +While not strictly enforced, plugins should also include tests where applicable. In some cases it may not be possible to provide `unit` or `integration` tests for plugins. In these cases it is recommended to create `functional` tests. |
| 66 | + |
| 67 | +### Documentation is required |
| 68 | + |
| 69 | +Documentation of new functionality is important to increase the adoption of Automatron. As such, you may be asked to provide documentation for new functionality created by your Pull Request. This is especially true for new plugins being submitted as plugins must be documented in order for users to adopt the plugin. |
| 70 | + |
| 71 | +Documentation is just as important as new functionality, as such documentation based pull requests are encouraged. For idea's on current gaps please reference our [documentation board](https://github.com/madflojo/automatron/projects/1). |
| 72 | + |
| 73 | +## Developer environment |
| 74 | + |
| 75 | +To ease the development and testing experience of Automatron a `docker-compose` environment has been created and is included within the repository. |
| 76 | + |
| 77 | +To launch a local instance of Automatron simply execute the following `docker-compose` command. |
| 78 | + |
| 79 | +```console |
| 80 | +$ sudo docker-compose up --build automatron |
| 81 | +``` |
| 82 | + |
| 83 | +If you wish to execute tests you can do so by running the following `docker-compose` command. |
| 84 | + |
| 85 | +```console |
| 86 | +$ sudo docker-compose up --build test |
| 87 | +``` |
| 88 | + |
| 89 | +To test documentation updates you can launch a `mkdocs` container as well. |
| 90 | + |
| 91 | +```console |
| 92 | +$ sudo docker-compose up --build mkdocs |
| 93 | +``` |
| 94 | + |
| 95 | +To wipe and reset the `docker-compose` environment simply run the following. |
| 96 | + |
| 97 | +```console |
| 98 | +$ sudo docker-compose kill automatron redis |
| 99 | +$ sudo docker-compose rm automatron redis tests mkdocs |
| 100 | +``` |
0 commit comments