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:
Feike Steenbergen
2015-09-03 09:52:01 +02:00
parent e96265e4d1
commit b1afd5ddc4
10 changed files with 38 additions and 22 deletions
+3
View File
@@ -0,0 +1,3 @@
include requirements*
include *.rst
recursive-include patroni *.py
+8 -11
View File
@@ -8,29 +8,26 @@ RUN apt-get update -y && apt-get install curl -y
# 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 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 upgrade -y
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 pip install python-etcd
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
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
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 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
+13
View File
@@ -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
+1 -1
View File
@@ -133,5 +133,5 @@ then
sleep 60
done
else
exec /patroni/patroni.py /patroni/postgres.yml
exec patroni /patroni/postgres.yml
fi
+1 -1
View File
@@ -1 +1 @@
__version__ = '0.15'
__version__ = '0.22'
View File
+6 -6
View File
@@ -5,12 +5,12 @@ import sys
import time
import yaml
from patroni.helpers.api import RestApiServer
from patroni.helpers.etcd import Etcd
from patroni.helpers.ha import Ha
from patroni.helpers.postgresql import Postgresql
from patroni.helpers.utils import setup_signal_handlers, sleep
from patroni.helpers.zookeeper import ZooKeeper
from .helpers.api import RestApiServer
from .helpers.etcd import Etcd
from .helpers.ha import Ha
from .helpers.postgresql import Postgresql
from .helpers.utils import setup_signal_handlers, sleep
from .helpers.zookeeper import ZooKeeper
logger = logging.getLogger(__name__)
View File
+2 -2
View File
@@ -5,5 +5,5 @@ psycopg2
PyYAML
requests
six
kazoo
python-etcd
kazoo>=2.2.1
python-etcd>=0.4.1
+4 -1
View File
@@ -18,6 +18,7 @@ if sys.version_info < (2, 7, 0):
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
def read_version(package):
data = {}
with open(os.path.join(package, '__init__.py'), 'r') as fd:
@@ -56,6 +57,8 @@ CLASSIFIERS = [
'Programming Language :: Python :: Implementation :: CPython',
]
CONSOLE_SCRIPTS = ['patroni = patroni.patroni:main']
class PyTest(TestCommand):
@@ -91,7 +94,6 @@ class PyTest(TestCommand):
params['plugins'] = ['cov']
if 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']
errno = pytest.main(**params)
sys.exit(errno)
@@ -144,6 +146,7 @@ def setup_package():
cmdclass=cmdclass,
tests_require=['pytest-cov', 'pytest'],
command_options=command_options,
entry_points={'console_scripts': CONSOLE_SCRIPTS},
)