Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/.mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all
rule 'MD013', :code_blocks => false
11 changes: 5 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ jobs:
- image: rsrchboy/mdl
steps:
- checkout
- run: mdl .
- run: mdl --style ./.circleci/.mdlrc .

flake8:
black:
docker:
- image: python:2.7
- image: 667005031541.dkr.ecr.us-west-1.amazonaws.com/black:18.9b0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a public image? We don't want to use private stuff in our public repo to prevent leaking (anyone can fork, open a PR, and dump some env vars)

steps:
- run: pip install flake8
- checkout
- run: flake8 .
- run: pyfmt

workflows:
version: 2
sdic:
jobs:
- mdl
- flake8
- black
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This works for simple constraints:
1. It's easy to implement
1. It's cheap for the database to check on every change

But for more complex constraints that you'd like to set, it'd be either very
But for more complex conditions, it'd be either very
expensinve to check on every write, or even impossible to write as a
constraint.

Expand Down Expand Up @@ -87,21 +87,23 @@ doctor ordered.

## Install as a cron

If you want to get an email every night to give you a list of all the soft
constraints that have been broken during the last day, just add it to you
crontab. We like to have it run daily, so we can fix any bug generating bad
data before it becomes a real problem.
Run sdic from cron as often as you like, we like to have it run daily.

Example crontab:
## Monitoring

```
MAILTO="dba@acme.com"
@daily sdic live
sdic uses Python's [`logging`](https://docs.python.org/2.7/library/logging.html)
module to log any output in dot separated hierarchical fashion.

Any general sdic message would look like this:

```console
Jan 11 00:10:19 <sender> sdic.enforce_fullname: enforce_fullname.sql successfully ran in 0.029 sec
```

`dba@acme.com` is the email that will get the soft constraints broken every
day. Make sure your local MTA is well configured on your system. You can test
it by doing `date | mail -s test dba@acme.com`.
In Papertrail `sdic.enforce_fullname` will be treated as a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Papertrail is really specific to us, can you talk about syslog in general instead?

[program attribute](https://help.papertrailapp.com/kb/how-it-works/search-syntax/#attributes).
And alert can be created with the search keyword `program:sdic.enforce_fullname`
to trigger anytime the checker encounters a violated constraint.

## Databases supported

Expand Down Expand Up @@ -137,7 +139,7 @@ only run one of them, an optional `server` argument can be passed as well:

If a query produces an output, it will look something like this:

```
```console
-----===== /!\ INCOMING BAD DATA /!\ =====-----

Server: big-database
Expand Down
2 changes: 1 addition & 1 deletion sdic/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = u'0.2.1'
VERSION = u'0.2.2'
Loading