This repository has been archived by the owner on Mar 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
6 changed files
with
89 additions
and
1 deletion.
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
Architecture | ||
============ | ||
|
||
At its core, Charlesbot essentially works as follows: | ||
|
||
.. image:: _static/images/charlesbot_architecture.png | ||
:alt: Charlesbot Architecture | ||
|
||
When a message comes in through a Slack websocket, ``robot.py`` delivers a copy | ||
of the message to each Charlesbot plugin. This is done by pushing this message | ||
onto each plugin's queue, at which point the plugin is free to consume the | ||
message on its own schedule. | ||
|
||
This approach decouples the processing of a message from the receiving of a | ||
message, which helps in a scenario where a channel is flooded with more | ||
incoming messages than a plugin is able to handle (in a timely manner). | ||
|
||
Abstract Base Class | ||
------------------- | ||
|
||
The abstract base class ``BasePlugin`` handles the bulk of the message | ||
coordination which allows you to write your plugins with minimum boiler plate. | ||
|
||
In order for this to work, you will need to inherit from ``BasePlugin`` and | ||
implement the plugin logic using at minimum the following two abstract methods: | ||
|
||
.. code-block:: python | ||
def get_help_message(self): | ||
pass | ||
def process_message(self, message): | ||
pass |
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
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 |
---|---|---|
|
@@ -24,3 +24,5 @@ out! | |
|
||
installation | ||
development | ||
roadmap | ||
architecture |
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,51 @@ | ||
Roadmap | ||
======= | ||
|
||
``python-slackclient`` | ||
---------------------- | ||
|
||
Charlesbot currently uses the python-slackclient__ library to handle the | ||
underlying websocket communication. I am not *entirely* a fan of this library | ||
and I intend on replacing it with a native asyncio solution. | ||
|
||
__ https://github.com/slackhq/python-slackclient | ||
|
||
Plugin Architecture | ||
------------------- | ||
|
||
The plugin architecture for this project has come a long way since the first | ||
few iterations. It is designed such that plugins can be dropped in place | ||
without having to modify the core code-base. | ||
|
||
This is what the `current architecture`__ looks like. | ||
|
||
__ architecture.html | ||
|
||
The "queue + worker" system of delivering messages to each plugin is an | ||
experiment in how much this design will scale, before it starts hogging | ||
resources and being generally slow. We'll see how it goes! | ||
|
||
Configuration Management | ||
------------------------ | ||
|
||
One thing that I would like to axe eventually is the way configuration is | ||
read/written to. I am *not* a fan of supplying config files on the command | ||
line. | ||
|
||
Another alterative to supplying config files on the command line is the | ||
"everything gets configured through environment variables" (`12 factor-ish`__) | ||
approach. I feel like this approach is taking it to the other extreme and there | ||
must be a middle ground somewhere. | ||
|
||
I feel like relying on an operator to supply a slew of environment variables on | ||
the command line can get unwieldy fast! (imagine a chain of 50+ ``-e | ||
"VAR=foo"`` docker arguments!) | ||
|
||
I am hoping to explore an architecture where the basic amount of information | ||
needed to get going is read from environment variables, and the rest are read | ||
from a key-value store of sorts. This would allow for things such as | ||
post-launch configuration and this approach scales nicely if/when Charlesbot is | ||
restarted as users would not need to go in and reconfigure their | ||
plugin-specific settings. | ||
|
||
__ http://12factor.net |