406 Commits
Author SHA1 Message Date
Alexander Kukushkin e8b2fb112b It is better to reap childs before running relatively long sleep v0.1 2015-09-03 11:50:58 +02:00
Alexander Kukushkin a670b598f4 Implement unit test for reap_children function 2015-09-02 16:48:40 +02:00
Oleksii Kliukin da132ca1fc Do not rely on env vars for superuser role name.
Environment variables may not be set in Docker.
Instead, obtain the superuser role from the database.
2015-09-02 15:20:16 +02:00
Alexander Kukushkin a7f7a7bf58 Remove spurious print 2015-09-02 13:33:07 +02:00
Oleksii Kliukin a5f2ab6f88 Better SIGCHLD handling, use correct user name.
- Defer SIGCHLD processing until the later stage in order to allow
  subprocess to run its own reaping of children and return the correct
  exit code from the process called.

- When changing the password at startup, do not assume the user postgres.
2015-09-02 12:56:23 +02:00
Oleksii Kliukin 3e4d2df33b put a real restore/replication command inside the test postgres.yaml files 2015-09-02 12:04:39 +02:00
Feike Steenbergen 61e01b1435 Update documentation and Dockerfile to point to a SNAPSHOT version. Include python-etcd in Dockerfile 2015-09-01 11:35:32 +02:00
Alexander Kukushkin ead0b7444f Merge pull request #10 from zalando/feature/python-etcd
python-etcd
2015-09-01 10:04:20 +02:00
Alexander Kukushkin 65d3df3ec0 Merge branch 'master' of github.com:zalando/patroni into feature/python-etcd 2015-08-26 15:23:42 +02:00
Alexander Kukushkin c2aaa876d2 Merge branch 'feature/cloexec' of github.com:zalando/patroni into feature/python-etcd 2015-08-26 15:18:02 +02:00
Alexander Kukushkin 60a360a4da Reset _machines_cache before doing next load attempt 2015-08-26 15:17:24 +02:00
Alexander Kukushkin 353fc58bee Do not inherit rest api port on fork 2015-08-26 15:14:44 +02:00
Oleksii Kliukin af10bb8ab8 make sure replica-creation scripts are also available to patroni docker image. 2015-08-25 18:22:47 +02:00
Oleksii Kliukin 6b60be09a1 include restore command in the entyrpoint 2015-08-25 16:19:22 +02:00
Oleksii Kliukin 824819bbff Make script compatible with boot2docker on OS X by exporting the correct LC_ variable and running docker with -P, exposing the ports to the underlying OS. 2015-08-25 16:18:59 +02:00
Alexander Kukushkin 420176aa75 Merge branch 'master' of github.com:zalando/patroni into feature/python-etcd 2015-08-25 10:11:29 +02:00
Oleksii Kliukin 9d79be56df Merge pull request #8 from zalando/feature/external_backup
Move the functionality of restoring a replica from backup into an external script
2015-08-24 18:12:38 +02:00
Alexander Kukushkin befd33555d Refactor helpers/etcd.py
Work with etcd cluster via high-level python-etcd module.
Plus change all unit tests accordingly.
2015-08-24 16:58:08 +02:00
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
Alexander Kukushkin 4940665cea Update dcs.py 2015-08-11 12:01:21 +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