mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Refactoring to enable package building and succesfull installation of the Patroni package.
Build the first packages of patroni and added them to pypi.python.org Update Dockerfile to use pip to install patroni.
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
include requirements*
|
||||||
|
include *.rst
|
||||||
|
recursive-include patroni *.py
|
||||||
@@ -8,29 +8,26 @@ RUN apt-get update -y && apt-get install curl -y
|
|||||||
|
|
||||||
# Add PGDG repositories
|
# Add PGDG repositories
|
||||||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||||
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||||
RUN apt-get update -y
|
RUN apt-get update -y
|
||||||
RUN apt-get upgrade -y
|
RUN apt-get upgrade -y
|
||||||
|
|
||||||
ENV PGVERSION 9.4
|
ENV PGVERSION 9.4
|
||||||
RUN apt-get install python python-psycopg2 python-yaml python-requests python-boto postgresql-${PGVERSION} python-dnspython python-kazoo python-pip -y
|
RUN apt-get install postgresql-${PGVERSION} -y
|
||||||
RUN pip install python-etcd
|
RUN apt-get install python python-psycopg2 python-yaml python-requests python-dnspython python-pip python-mock -y
|
||||||
|
RUN pip install patroni
|
||||||
|
|
||||||
|
|
||||||
ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:$PATH
|
ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:$PATH
|
||||||
|
|
||||||
RUN mkdir -p /patroni/helpers
|
|
||||||
RUN mkdir -p /patroni/scripts
|
|
||||||
ADD patroni.py /patroni/patroni.py
|
|
||||||
ADD helpers /patroni/helpers
|
|
||||||
ADD scripts /patroni/scripts
|
|
||||||
|
|
||||||
ENV ETCDVERSION 2.0.13
|
ENV ETCDVERSION 2.0.13
|
||||||
RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz | tar xz -C /bin --strip=1 --wildcards --no-anchored etcd etcdctl
|
RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz | tar xz -C /bin --strip=1 --wildcards --no-anchored etcd etcdctl
|
||||||
|
|
||||||
## Setting up a simple script that will serve as an entrypoint
|
### Setting up a simple script that will serve as an entrypoint
|
||||||
|
RUN mkdir /patroni/
|
||||||
RUN mkdir /data/ && touch /var/log/etcd.log /var/log/etcd.err /pgpass /patroni/postgres.yml
|
RUN mkdir /data/ && touch /var/log/etcd.log /var/log/etcd.err /pgpass /patroni/postgres.yml
|
||||||
RUN chown postgres:postgres -R /patroni/ /data/ /pgpass /var/log/etcd.* /patroni/postgres.yml
|
RUN chown postgres:postgres -R /patroni/ /data/ /pgpass /var/log/etcd.* /patroni/postgres.yml
|
||||||
ADD docker/entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 4001 5432 2380
|
EXPOSE 4001 5432 2380
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
--- Dockerfile 2015-09-03 09:24:16.355412216 +0200
|
||||||
|
+++ Dockerfile.test 2015-09-03 09:25:48.407879693 +0200
|
||||||
|
@@ -15,7 +15,9 @@
|
||||||
|
ENV PGVERSION 9.4
|
||||||
|
RUN apt-get install postgresql-${PGVERSION} -y
|
||||||
|
RUN apt-get install python python-psycopg2 python-yaml python-requests python-dnspython python-pip python-mock -y
|
||||||
|
-RUN pip install patroni
|
||||||
|
+## We install prereqs from pypi, the package from testpypi
|
||||||
|
+RUN pip install --force-reinstall --upgrade kazoo boto python-etcd
|
||||||
|
+RUN pip install -i https://testpypi.python.org/pypi patroni
|
||||||
|
|
||||||
|
|
||||||
|
ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:$PATH
|
||||||
@@ -133,5 +133,5 @@ then
|
|||||||
sleep 60
|
sleep 60
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
exec /patroni/patroni.py /patroni/postgres.yml
|
exec patroni /patroni/postgres.yml
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
__version__ = '0.15'
|
__version__ = '0.22'
|
||||||
|
|||||||
+6
-6
@@ -5,12 +5,12 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from patroni.helpers.api import RestApiServer
|
from .helpers.api import RestApiServer
|
||||||
from patroni.helpers.etcd import Etcd
|
from .helpers.etcd import Etcd
|
||||||
from patroni.helpers.ha import Ha
|
from .helpers.ha import Ha
|
||||||
from patroni.helpers.postgresql import Postgresql
|
from .helpers.postgresql import Postgresql
|
||||||
from patroni.helpers.utils import setup_signal_handlers, sleep
|
from .helpers.utils import setup_signal_handlers, sleep
|
||||||
from patroni.helpers.zookeeper import ZooKeeper
|
from .helpers.zookeeper import ZooKeeper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ psycopg2
|
|||||||
PyYAML
|
PyYAML
|
||||||
requests
|
requests
|
||||||
six
|
six
|
||||||
kazoo
|
kazoo>=2.2.1
|
||||||
python-etcd
|
python-etcd>=0.4.1
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ if sys.version_info < (2, 7, 0):
|
|||||||
|
|
||||||
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
|
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
|
||||||
|
|
||||||
|
|
||||||
def read_version(package):
|
def read_version(package):
|
||||||
data = {}
|
data = {}
|
||||||
with open(os.path.join(package, '__init__.py'), 'r') as fd:
|
with open(os.path.join(package, '__init__.py'), 'r') as fd:
|
||||||
@@ -56,6 +57,8 @@ CLASSIFIERS = [
|
|||||||
'Programming Language :: Python :: Implementation :: CPython',
|
'Programming Language :: Python :: Implementation :: CPython',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CONSOLE_SCRIPTS = ['patroni = patroni.patroni:main']
|
||||||
|
|
||||||
|
|
||||||
class PyTest(TestCommand):
|
class PyTest(TestCommand):
|
||||||
|
|
||||||
@@ -91,7 +94,6 @@ class PyTest(TestCommand):
|
|||||||
params['plugins'] = ['cov']
|
params['plugins'] = ['cov']
|
||||||
if self.junitxml:
|
if self.junitxml:
|
||||||
params['args'] += self.junitxml
|
params['args'] += self.junitxml
|
||||||
#params['args'] += ['--doctest-modules', MAIN_PACKAGE, '--doctest-modules', HELPERS, '--doctest-modules', SCRIPTS, '-s']
|
|
||||||
params['args'] += ['--doctest-modules', MAIN_PACKAGE, '-s', '-vv']
|
params['args'] += ['--doctest-modules', MAIN_PACKAGE, '-s', '-vv']
|
||||||
errno = pytest.main(**params)
|
errno = pytest.main(**params)
|
||||||
sys.exit(errno)
|
sys.exit(errno)
|
||||||
@@ -144,6 +146,7 @@ def setup_package():
|
|||||||
cmdclass=cmdclass,
|
cmdclass=cmdclass,
|
||||||
tests_require=['pytest-cov', 'pytest'],
|
tests_require=['pytest-cov', 'pytest'],
|
||||||
command_options=command_options,
|
command_options=command_options,
|
||||||
|
entry_points={'console_scripts': CONSOLE_SCRIPTS},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user