Commit Graph
887 Commits
Author SHA1 Message Date
Alexander Kukushkin f9ce29d49f rename address to conn_url in a Member obj
and introduce new field: api_url
2015-06-02 08:52:34 +02:00
Alexander Kukushkin bacd05d99e Determine preferable local address to connect through.
If listen contains '*' or 0.0.0.0 - connect via localhost
In all other cases pick the first one.
2015-06-01 17:00:15 +02:00
Alexander Kukushkin 1bcc2b5fa6 Extend postgres?.yml with pg_hba section to give possibility to customize pg_hba.conf 2015-06-01 16:05:35 +02:00
Alexander Kukushkin ccdff5ea99 Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	helpers/postgresql.py
	tests/test_postgresql.py
2015-06-01 14:14:53 +02:00
Alexander Kukushkin adcc7ac256 Try to avoid "double" promotion.
Also check presence of trigger_file on master after promotion when
pg_is_in_recovery() = false and if it is there - remove it.
Plus check presence of trigger_file on a new slave (after running
pg_basebackup) and if it is there - also remove it.
2015-06-01 13:48:44 +02:00
Alexander Kukushkin 939254021e Code cleanup: do not modify os.environ but pass copy of it to subprocess.call 2015-06-01 11:03:06 +02:00
Alexander Kukushkin f8c3582715 Refactor api:
Call is_running only when it's not possible to execute query against
governed postgres.
2015-06-01 10:48:16 +02:00
Alexander Kukushkin b85262637d Bugfix: do not create replication slot for master 2015-06-01 09:20:24 +02:00
Alexander Kukushkin 5fcb19b817 Merge branch 'sleep-sigchld' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	tests/test_governor.py
2015-05-28 15:55:03 +02:00
Alexander Kukushkin aa486194ae Wrap time.sleep into wrapper function
In case if it was interrupted by SIGCHLD but scheduled awake time is not
reached it will continue sleeping. For all other signals behaviuor is
not changed.
2015-05-28 15:47:51 +02:00
Alexander Kukushkin 9cd7000d7f Merge branch 'master' of github.com:CyberDem0n/governor 2015-05-28 13:04:49 +02:00
Alexander Kukushkin cd5e589620 Revert previous commit (restore sigchld_handler) 2015-05-28 13:04:21 +02:00
Feike Steenbergen 119c56e5d3 Merge pull request #18 from CyberDem0n/master
Set handler of SIGCHLD to SIG_IGN
2015-05-28 12:43:05 +02:00
Alexander Kukushkin f76f77e964 Ignore SIGCHLD instead of processing it.
This way time.sleep wont be interrupted when some external process is
finished and terminated childs would be reaped automatically.
2015-05-28 12:25:49 +02:00
Alexander Kukushkin 9971d214fe Merge branch 'restapi' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	governor.py
2015-05-27 14:54:08 +02:00
Alexander Kukushkin 77911144c7 Improve test of governor against real config files 2015-05-27 14:44:52 +02:00
Alexander Kukushkin 0cd81a1ecf Merge branch 'restapi' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	tests/test_postgresql.py
2015-05-27 11:15:15 +02:00
Alexander Kukushkin 9968a66048 helpers/postgresql.py
Replace os.system with subprocess.call
2015-05-27 11:08:06 +02:00
Alexander Kukushkin bbf1110518 Merge branch 'restapi' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	governor.py
	helpers/postgresql.py
	postgres0.yml
	postgres1.yml
	tests/test_postgresql.py
2015-05-26 09:56:35 +02:00
Alexander Kukushkin 3e3acc3d3a Do not start listening port during test 2015-05-26 08:59:42 +02:00
Alexander Kukushkin faf295dcd0 Add initialize key into Cluster 2015-05-24 19:26:35 +02:00
Alexander Kukushkin 755f54f266 Improve test coverage for governor.py 2015-05-24 15:42:41 +02:00
Alexander Kukushkin 8dd99170bf Refactor exceptions handling in etcd.py and ha.py
update_leader can throw EtcdError exception
unused HealthiestMemberError exception is removed
2015-05-24 15:40:36 +02:00
Alexander Kukushkin 188741de5a Merge branch 'master' of github.com:CyberDem0n/governor into restapi 2015-05-24 09:02:42 +02:00
Alexander Kukushkin ce267d9f1e query method will retry only in case of communication error 2015-05-24 09:01:23 +02:00
Alexander Kukushkin d202f72a42 Added simple web server which shows current state of postgres
Server always returns json which contains some status of postgres:
* instance type: master/slave
* xlog location for master
* xlog received_location, replayed_location
This server could be used by haproxy
GET / returns 200 if there is postgres master behind governor.
GET /slave returns 200 is there is postgres slave behind governor
In all other cases it returns 503
Currently server always listening on 0.0.0.0:8080, but it should be
configurable. In the next versions this rest api could also report some
status of etcd and could be used by is_healthiest_node method
2015-05-23 20:29:51 +02:00
Alexander Kukushkin f53c369c69 Connect timeout 5 seconds for psycopg2
Refactored query and is_healthiest_node methods
query method wont retry more then 3 times if OperationalError raised
is_healthiest_node takes into account that one of the nodes could be
still a master
2015-05-23 20:21:13 +02:00
Alexander Kukushkin 7f9c10e33f Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring 2015-05-22 12:27:02 +02:00
Alexander Kukushkin b00846affc Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
Conflicts:
	helpers/postgresql.py
2015-05-22 12:26:55 +02:00
Alexander Kukushkin 34f9b666cf Demote master when etcd is not accessible 2015-05-22 12:26:19 +02:00
Alexander Kukushkin bb884bac00 Move is_unlocked method from Ha into Cluster class 2015-05-22 11:45:09 +02:00
Feike Steenbergen f3e1c74d9b Unittests: Remove some more unneccesary code. 2015-05-21 14:59:54 +02:00
Feike Steenbergen 7f458a84bb Remove unnessecary functions from unittest, fix one bug (return tuples) in cursor. 2015-05-21 14:53:25 +02:00
Feike Steenbergen 836a681157 Fixed the tests, by testing also found an squashed a bug in the StatusPage on python 3. 2015-05-21 14:40:07 +02:00
Feike Steenbergen 7afba469b4 Add Tests for testing the statuspage, extend the PostgreSQL test to return a wider result. 2015-05-21 13:56:08 +02:00
Alexander Kukushkin d56b8772e5 Update unit tests 2015-05-20 18:21:08 +02:00
Alexander Kukushkin ebb8bce0f6 some simple tests 2015-05-19 12:49:53 +02:00