Oleksii Kliukin
29434e24ea
Allow relative paths to external scripts.
2015-08-24 16:53:57 +02:00
Alexander Kukushkin
72043703f5
Small code cleanup
2015-08-17 16:06:48 +02:00
Feike Steenbergen
a07a80806a
Update postgresql.py
...
Make build_connstring truly static
2015-08-11 11:33:40 +02:00
Feike Steenbergen
b0707c8ddd
Merge branch 'master' of github.com:zalando/patroni into feature/external_backup
...
Conflicts:
requirements-py2.txt
2015-08-11 11:27:53 +02:00
Feike Steenbergen
e51ea4c1ca
Merge pull request #4 from zalando/feature/lost-dcs-data
...
Run is_healthiest_node against last know healthy configuration of cluster
2015-08-11 11:22:46 +02:00
Feike Steenbergen
a11a41796b
Merge pull request #6 from zalando/feature/six
...
use six module to support python 2 and 3 instead of conditional imports
2015-08-11 11:20:30 +02:00
Feike Steenbergen
04dee96fde
Merge pull request #9 from zalando/feature/documentation
...
Write some documentation in a docstring format for AbstractDCS class
2015-08-11 11:18:44 +02:00
Feike Steenbergen
b7bedf6b06
Update dcs.py
2015-08-11 11:16:52 +02:00
Alexander Kukushkin
ce6d1c69d8
Merge branch 'master' of github.com:zalando/patroni into feature/six
2015-08-11 10:19:35 +02:00
Alexander Kukushkin
e9d46b0adb
Merge branch 'master' of github.com:zalando/patroni into feature/lost-dcs-data
2015-08-11 10:19:07 +02:00
Alexander Kukushkin
d2f956e87f
Write some documentation in a dockstring format for AbstractDCS class
2015-08-11 10:17:55 +02:00
Oleksii Kliukin
164b5760a4
remove line too long warnings where possible.
2015-08-07 16:35:00 +02:00
Oleksii Kliukin
5d1d59a42b
Add mock-based unit tests for the restore module.
...
- add unit tests for the restore module
- additional dependencies in requirement
- harden the code that calls restore callbacks
- remove WAL-E related code from postgresql.py
2015-08-07 16:05:17 +02:00
Feike Steenbergen
cdb0e43ed7
Dockerfile: Enable (undocumented) cheat mode to troubleshoot
2015-08-05 16:53:05 +02:00
Feike Steenbergen
c30d8dbd1a
Development: Update Dockerfile and create possibility to run local cluster
...
To help in developing features, the Dockerfile and its entrypoint have been extended.
The README.md explains stuff in detail, in short:
- you can now run a Patroni cluster with a single command
2015-08-05 14:12:45 +02:00
Feike Steenbergen
7c4efb33e7
Updated Dockerfile
...
Due to the renaming of Governor to Patroni some old references needed to be updated.
Also some python packages need to be added.
Added entrypoint.sh as a script, to ensure Patroni will have PID = 1 when the container is run.
2015-08-05 09:56:32 +02:00
Oleksii Kliukin
74a1daad09
fix a typo in the named tuple definition.
2015-08-04 17:13:36 +02:00
Oleksii Kliukin
8bed553d30
Use new-style classes.
2015-08-04 16:52:03 +02:00
Oleksii Kliukin
e69f015369
switch to using WAL-E by default.
2015-08-04 16:22:46 +02:00
Oleksii Kliukin
67da1b3a78
Make parse_connstring staticmethod less 'selfish'
2015-08-04 15:26:12 +02:00
Oleksii Kliukin
f17b651107
Adoprt WAL-E related code for a stand-alone script.
...
- make sure all parameters are taken from the env variables.
- make sure WAL-E code is not involved if the image is not configured for it
- pick up pg_basebackup as an alternative if WAL-E fails.
The WAL-E support will be switched on in subsequent commits.
2015-08-04 14:10:11 +02:00
Oleksii Kliukin
fd884a53a9
Multiple small fixes:
...
- Do delete trigger file in the patroni itself.
- Fix the typo in the datadir member.
- Add #! at the top of the python script.
2015-08-03 15:51:40 +02:00
Oleksii Kliukin
2089a123c2
fix line too long warning.
2015-08-03 11:48:02 +02:00
Oleksii Kliukin
7f2dcc0a95
Move replica creation code into a separte file. So far, only the class that makes replicas with pg_basebackup is called.
2015-08-03 11:44:11 +02:00
Oleksii Kliukin
6fdd0304f6
Merge pull request #7 from zalando/feature/callbacks
...
Implement callback actions for patroni in order to call external script on different events in the server lifecycle, supported are on start, stop, restart, reload and role change (which covers both promote and demote). A callback should receive 3 arguments: action, role and cluster name (in this order), and can do things like tagging the EC2 instances associated with PostgreSQL, or notifying the DBA when the master had been demoted.
A sample callback that assigns tags to AWS instances is provided.
2015-07-30 10:29:08 +02:00
Oleksii Kliukin
a0fdd6398f
Cosmetic changes: avoid magic strings in action names, name the parameter passed to the callback 'scope' for consistency.
2015-07-30 10:17:17 +02:00
Oleksii Kliukin
71a1200f64
Fix a mistake in checking for the number of parameters.
2015-07-29 12:09:17 +02:00
Oleksii Kliukin
5171964758
Merge branch 'master' into feature/callbacks
2015-07-27 16:19:03 +02:00
Oleksii Kliukin
5c5bae69ea
make sure we can import from scripts.
2015-07-27 16:11:58 +02:00
Oleksii Kliukin
27bda5b4e4
document the new callbacks option.
2015-07-27 13:12:08 +02:00
Oleksii Kliukin
7d1bc32ad9
potentially run the doctests for the scripts.
2015-07-27 13:06:44 +02:00
Oleksii Kliukin
d85451efae
Increase test coverage for aws script.
2015-07-27 13:04:45 +02:00
Oleksii Kliukin
b92bfb34a5
Futher test for postgresql module (includes callbacks)
2015-07-27 13:04:01 +02:00
Oleksii Kliukin
56983d867d
Run coverage test for the data in scripts as well as helpers.
2015-07-27 13:03:12 +02:00
Oleksii Kliukin
115ba1d9ae
Make sure postgresql.stop also return True if pg_ctl stop returned 0.
2015-07-27 11:23:08 +02:00
Oleksii Kliukin
201f9bf4b2
Make sure role check during callbacks does not accidentially modify the cluster state (is_promoted flag or trigger file).
2015-07-27 11:08:19 +02:00
Oleksii Kliukin
859da0db0a
Make unit tets run again.
2015-07-27 10:10:29 +02:00
Oleksii Kliukin
dac3d7997f
Change a typo.
2015-07-24 10:47:26 +02:00
Oleksii Kliukin
35fe536e8b
Set +x bit on aws.py
2015-07-23 17:09:39 +02:00
Oleksii Kliukin
c9c678fb5b
Pass scope, the cluster name, instead of the name, which is the instance name, to the callback.
2015-07-23 16:16:22 +02:00
Oleksii Kliukin
f1d76611b6
Use the executable bit on AWS callback.
2015-07-17 17:26:52 +02:00
Oleksii Kliukin
e9934be9aa
Do not terminate on callback failure.
...
Show the error if a callback command fails and move on.
Set the executable bit for the aws callback.
2015-07-17 17:26:28 +02:00
Oleksii Kliukin
a11d94aff5
Pass text names of cluster roles to the script.
...
Seems better than passing a bool flag and
converting it from/to string.
2015-07-17 15:39:34 +02:00
Oleksii Kliukin
33b5e1b22e
Make sure is_leader is False does not trigger the leader re-check.
2015-07-17 15:22:21 +02:00
Oleksii Kliukin
11004f8c48
Be more robust on callbacks when cluster is down.
...
For 'on_stop' or 'on_restart' callbacks we cannot
call is_leader, because the cluster would be stopped.
Instead, call is_leader before running a callback.
In addition, make the call_nowait more robust by handling
the exceptions related to the DB cluster unavailability.
2015-07-17 11:19:05 +02:00
Alexander Kukushkin
d1e47c8ccf
Update README.md
2015-07-15 16:17:38 +02:00
Alexander Kukushkin
fcead3aed9
Update README.md
2015-07-15 15:25:20 +02:00
Alexander Kukushkin
b6c2061f3a
Merge branch 'master' of github.com:zalando/patroni into feature/six
2015-07-15 12:49:51 +02:00
Alexander Kukushkin
26935c3725
Merge branch 'master' of github.com:zalando/patroni into feature/lost-dcs-data
2015-07-15 12:49:38 +02:00
Alexander Kukushkin
66f4f790d2
Improve test coverage
2015-07-15 12:49:17 +02:00