Skip to content

Commit

Permalink
Fix CI and deb package builds
Browse files Browse the repository at this point in the history
  • Loading branch information
usernamedt committed Aug 25, 2023
1 parent 3029ccf commit de66ddb
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 61 deletions.
53 changes: 0 additions & 53 deletions Dockerfile

This file was deleted.

13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PGCONSUL_IMAGE=pgconsul:behave
PROJECT=pgconsul
ZK_VERSION=3.7.1
export ZK_VERSION
INSTALL_DIR=$(DESTDIR)opt/yandex/pgconsul
INSTALL_DIR=$(DESTDIR)/opt/yandex/pgconsul
REPLICATION_TYPE=quorum

clean_report:
Expand All @@ -27,8 +27,7 @@ install:
mkdir -p $(DESTDIR)/etc/pgconsul/plugins
# Make venv
python3 -m venv $(INSTALL_DIR)
# echo `git rev-list HEAD --count`-`git rev-parse --short HEAD` > $(INSTALL_DIR)/package.release
echo "1-0303030" > $(INSTALL_DIR)/package.release
echo `git rev-list HEAD --count`-`git rev-parse --short HEAD` > $(INSTALL_DIR)/package.release
# Install dependencies and pgconsul as python packages in venv
$(INSTALL_DIR)/bin/pip install wheel
$(INSTALL_DIR)/bin/pip install --pre -r requirements.txt
Expand All @@ -38,15 +37,17 @@ install:
mkdir -p $(DESTDIR)/etc/pgconsul/plugins
# Fix "ValueError: bad marshal data (unknown type code)"
find $(INSTALL_DIR) -name __pycache__ -type d -exec rm -rf {} +

install_local: install
# Make symlinks in /usr/local/bin
ln -s /opt/yandex/pgconsul/bin/pgconsul $(DESTDIR)/usr/local/bin
ln -s /opt/yandex/pgconsul/bin/pgconsul-util $(DESTDIR)/usr/local/bin
# Replace redundant paths with actual ones
# E.g. /tmp/build/opt/yandex/pgconsul -> /opt/yandex/pgconsul
test -n '$(DESTDIR)' \
&& grep -l -r -F '$(INSTALL_DIR)' $(INSTALL_DIR) \
| xargs sed -i -e 's|$(INSTALL_DIR)|/opt/yandex/pgconsul|' \
|| true
&& grep -l -r -F '$(INSTALL_DIR)' $(INSTALL_DIR) \
| xargs sed -i -e 's|$(INSTALL_DIR)|/opt/yandex/pgconsul|' \
|| true

build:
cp -f docker/base/Dockerfile .
Expand Down
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
19 changes: 19 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Source: pgconsul
Section: unknown
Priority: optional
Maintainer: Evgeny Dyukov <[email protected]>
Build-Depends:
debhelper (>= 8.0.0),
python3.10, python3.10-venv, python3-pip,
python-setuptools,
libpq-dev,
git
Standards-Version: 3.9.4
Homepage: https://github.com/yandex/pgconsul
#Vcs-Git: git://github.com:yandex/pgconsul.git
#Vcs-Browser: https://github.com/yandex/pgconsul

Package: pgconsul
Architecture: any
Depends: ${misc:Depends}, python3.10
Description: Automatic failover of PostgreSQL with help of ZK
19 changes: 19 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pgconsul
Upstream-Contact: Vladimir Borodin <[email protected]>
Source: <https://github.com/yandex/pgconsul>

Files: *
Copyright: 2023 Yandex LLC <[email protected]>
License:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
4 changes: 4 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/opt/yandex/pgconsul/bin/pgconsul
/opt/yandex/pgconsul/bin/pgconsul-util
/etc/logrotate.d/pgconsul
/etc/pgconsul/plugins
2 changes: 2 additions & 0 deletions debian/links
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/opt/yandex/pgconsul/bin/pgconsul /usr/local/bin/pgconsul
/opt/yandex/pgconsul/bin/pgconsul-util /usr/local/bin/pgconsul-util
13 changes: 13 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/make -f

clean:
dh clean

build:
dh build

override_dh_auto_install:
dh_auto_install --destdir=debian/tmp

binary:
dh binary
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
2 changes: 1 addition & 1 deletion docker/pgconsul/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN pg_dropcluster --stop $PG_MAJOR main && \
ln -s /usr/lib/postgresql/$PG_MAJOR/bin /usr/bin/postgresql && \
mkdir -p /etc/pgconsul/plugins && \
cd /var/lib/dist && \
DESTDIR=/ make install && \
DESTDIR=/ make install_local && \
cp /var/lib/dist/docker/pgconsul/pgconsul_${replication_type}.conf /etc/pgconsul.conf && \
cp /var/lib/dist/docker/pgconsul/gen_rec_conf.sh /usr/local/bin/gen_rec_conf.sh && \
echo "*:*:*:repl:repl" > /var/lib/postgresql/.pgpass && \
Expand Down
2 changes: 1 addition & 1 deletion tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

RUN mkdir /repo
COPY ./ /repo/
RUN cd /repo && DESTDIR=/ make install
RUN cd /repo && DESTDIR=/ make install_local
RUN ln -s /repo/src/plugins/upload_wals.py /etc/pgconsul/plugins/upload_wals.py
RUN chown -R postgres:postgres /opt/yandex/pgconsul /etc/pgconsul/plugins /repo/src/plugins

Expand Down

0 comments on commit de66ddb

Please sign in to comment.