Skip to content

Commit

Permalink
add pg17 tools
Browse files Browse the repository at this point in the history
  • Loading branch information
ihatemodels committed Dec 6, 2024
1 parent 6d7e707 commit 76d3c90
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 173 deletions.
14 changes: 9 additions & 5 deletions .bash/aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ alias cd...='cd ../../..'

# replace cat with bat
if [ -x "$(command -v bat)" ]; then
alias cat='bat -pp'
alias cat='bat -pp'
fi

# kubectl aliases
if [ -x "$(command -v kubectl)" ]; then
alias kc='kubectl'
alias kclsp='kubectl get pods -A -o wide'
alias kclsn='kubectl get nodes -o wide'
alias kclss='kubectl get services -A'
alias kc='kubectl'
alias kclsp='kubectl get pods -A -o wide'
alias kclsn='kubectl get nodes -o wide'
alias kclss='kubectl get services -A'
fi

# show the aliases
Expand All @@ -33,6 +33,8 @@ alias pg_dump12='/usr/lib/postgresql/12/bin/pg_dump'
alias pg_dump13='/usr/lib/postgresql/13/bin/pg_dump'
alias pg_dump14='/usr/lib/postgresql/14/bin/pg_dump'
alias pg_dump15='/usr/lib/postgresql/15/bin/pg_dump'
alias pg_dump16='/usr/lib/postgresql/16/bin/pg_dump'
alias pg_dump17='/usr/lib/postgresql/17/bin/pg_dump'

# pg_dump_all aliases
alias pg_dumpall10='/usr/lib/postgresql/10/bin/pg_dumpall'
Expand All @@ -49,6 +51,8 @@ alias pg_restore12='/usr/lib/postgresql/12/bin/pg_restore'
alias pg_restore13='/usr/lib/postgresql/13/bin/pg_restore'
alias pg_restore14='/usr/lib/postgresql/14/bin/pg_restore'
alias pg_restore15='/usr/lib/postgresql/15/bin/pg_restore'
alias pg_restore16='/usr/lib/postgresql/16/bin/pg_restore'
alias pg_restore17='/usr/lib/postgresql/17/bin/pg_restore'

# pg_basebackup aliases
alias pg_basebackup10='/usr/lib/postgresql/10/bin/pg_basebackup'
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,34 @@ jobs:
name: "Build and release"
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Docker meta
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/st3ga/dumputils
st3ga/dumputils
tags: |
type=semver,pattern={{version}}
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
Expand Down
138 changes: 70 additions & 68 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ RUN apk add git --no-cache
WORKDIR /build

RUN git clone https://github.com/timescale/timescaledb-parallel-copy.git \
&& cd timescaledb-parallel-copy \
&& git checkout ${TS_PARALLEL_COPY_VERSION} \
&& cd cmd/timescaledb-parallel-copy \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /build/timescaledb-parallel-copy
&& cd timescaledb-parallel-copy \
&& git checkout ${TS_PARALLEL_COPY_VERSION} \
&& cd cmd/timescaledb-parallel-copy \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /build/timescaledb-parallel-copy

FROM ubuntu:22.04

Expand All @@ -23,73 +23,75 @@ COPY .vimrc /root/
COPY .bash /root/.bash/
COPY --from=golang-builder /build/timescaledb-parallel-copy /usr/bin/

# create base dirs
# create base dirs
RUN mkdir -p /opt/backups /root/.config /root/.kube \
&& find /root/bin/ -type f -print0 | xargs -0 chmod +x \
# symlink python3 to python
&& ln -s /usr/bin/python3 /usr/bin/python \
# install base packages
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
# common utils
vim gpg gnupg2 git ca-certificates software-properties-common apt-transport-https \
# net utils
curl wget iputils-ping openssh-client \
# archive utils
zip unzip bzip2 p7zip-full \
# monitoring utils
procps htop \
# percona-toolkit dependencies
libdbi-perl libdbd-mysql-perl libterm-readkey-perl libio-socket-ssl-perl
&& find /root/bin/ -type f -print0 | xargs -0 chmod +x \
# symlink python3 to python
&& ln -s /usr/bin/python3 /usr/bin/python \
# install base packages
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
# common utils
vim gpg gnupg2 git ca-certificates software-properties-common apt-transport-https \
# net utils
curl wget iputils-ping openssh-client \
# archive utils
zip unzip bzip2 p7zip-full \
# monitoring utils
procps htop \
# percona-toolkit dependencies
libdbi-perl libdbd-mysql-perl libterm-readkey-perl libio-socket-ssl-perl

RUN cd /tmp/ \
# add repository lists
&& curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg \
&& echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' \
&& add-apt-repository "deb [arch=amd64,arm64,ppc64el] https://atl.mirrors.knownhost.com/mariadb/repo/10.8/ubuntu $(lsb_release -cs) main" \
&& curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list \
# update and install postgres-client, mariadb-client and redis-tools
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
postgresql-client-10 \
postgresql-client-11 \
postgresql-client-12 \
postgresql-client-13 \
postgresql-client-14 \
postgresql-client-15 \
mariadb-client \
redis-tools \
kafkacat \
# install minio client
&& wget -q https://dl.min.io/client/mc/release/linux-amd64/mc \
&& mv mc /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc \
# install mongo tools
&& wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian10-x86_64-${MONGO_TOOLS_VERSION}.deb -O mongo-tools.deb \
&& dpkg -i mongo-tools.deb \
# Install kubectl
&& curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
# Install percona-toolkit
&& wget -q https://downloads.percona.com/downloads/percona-toolkit/3.5.0/binary/debian/jammy/x86_64/percona-toolkit_3.5.0-5.jammy_amd64.deb -O percona-toolkit.deb \
&& dpkg -i percona-toolkit.deb \
# Install AWS cli
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
# Install bat
&& wget -q "https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat_${BAT_VERSION}_amd64.deb" -O bat.deb \
&& dpkg -i bat.deb \
# configure vim
&& git clone https://github.com/VundleVim/Vundle.vim.git --depth=1 --branch master --single-branch ~/.vim/bundle/Vundle.vim \
&& vim +VundleInstall +qall \
# clean
&& rm -rf /tmp/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.wget-hsts \
&& rm -rf /root/.vim/bundle/Vundle.vim/.git
# add repository lists
&& curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg \
&& echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' \
&& add-apt-repository "deb [arch=amd64,arm64,ppc64el] https://atl.mirrors.knownhost.com/mariadb/repo/10.8/ubuntu $(lsb_release -cs) main" \
&& curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list \
# update and install postgres-client, mariadb-client and redis-tools
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
postgresql-client-10 \
postgresql-client-11 \
postgresql-client-12 \
postgresql-client-13 \
postgresql-client-14 \
postgresql-client-15 \
postgresql-client-16 \
postgresql-client-17 \
mariadb-client \
redis-tools \
kafkacat \
# install minio client
&& wget -q https://dl.min.io/client/mc/release/linux-amd64/mc \
&& mv mc /usr/local/bin/mc \
&& chmod +x /usr/local/bin/mc \
# install mongo tools
&& wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian10-x86_64-${MONGO_TOOLS_VERSION}.deb -O mongo-tools.deb \
&& dpkg -i mongo-tools.deb \
# Install kubectl
&& curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
# Install percona-toolkit
&& wget -q https://downloads.percona.com/downloads/percona-toolkit/3.5.0/binary/debian/jammy/x86_64/percona-toolkit_3.5.0-5.jammy_amd64.deb -O percona-toolkit.deb \
&& dpkg -i percona-toolkit.deb \
# Install AWS cli
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
# Install bat
&& wget -q "https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat_${BAT_VERSION}_amd64.deb" -O bat.deb \
&& dpkg -i bat.deb \
# configure vim
&& git clone https://github.com/VundleVim/Vundle.vim.git --depth=1 --branch master --single-branch ~/.vim/bundle/Vundle.vim \
&& vim +VundleInstall +qall \
# clean
&& rm -rf /tmp/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.wget-hsts \
&& rm -rf /root/.vim/bundle/Vundle.vim/.git

WORKDIR /root

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DOCKER := $(shell command -v docker)

IMAGE_TAG := st3ga/dumputils:local-test
IMAGE_TAG := ghcr.io/athennamind/dumputils:local-test

.PHONY: default
default: build-run
Expand Down
Loading

0 comments on commit 76d3c90

Please sign in to comment.