From e252b6228c693ca27eb4054e41f4d4b30ef63c56 Mon Sep 17 00:00:00 2001 From: Jared Abbott Date: Fri, 15 May 2020 12:13:11 -0230 Subject: [PATCH] add 11.7 support and improve scripts --- .travis.yml | 2 +- Dockerfile | 4 ++-- README.md | 19 +++++++++++++++++++ dev/shellcheck.sh | 8 ++++++++ docker-compose.yml | 6 +++--- lint.sh | 17 ----------------- package/10.12-3.8.env | 3 +++ package/11.7-3.9.env | 4 ++++ package/9.6.13-3.6.env | 3 +++ 9 files changed, 43 insertions(+), 23 deletions(-) create mode 100755 dev/shellcheck.sh delete mode 100644 lint.sh create mode 100644 package/10.12-3.8.env create mode 100644 package/11.7-3.9.env create mode 100644 package/9.6.13-3.6.env diff --git a/.travis.yml b/.travis.yml index a42996d..8c791e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ branches: - master script: - - ./lint.sh --sh + - ./dev/util/shellcheck.sh diff --git a/Dockerfile b/Dockerfile index a0da40b..f72cd42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG alpine_version FROM alpine:${alpine_version} ARG alpine_version -ARG pg_package_version +ARG pg_full_version #-------------------------------------------------------------------------------- # Install dependencies @@ -12,7 +12,7 @@ ARG pg_package_version #-------------------------------------------------------------------------------- RUN echo "http://dl-cdn.alpinelinux.org/alpine/v${alpine_version}/main" >> /etc/apk/repositories -RUN apk --no-cache --update add dumb-init postgresql=${pg_package_version} py-pip && \ +RUN apk --no-cache --update add dumb-init postgresql=${pg_full_version} py-pip && \ pip install awscli && \ apk --purge -v del py-pip diff --git a/README.md b/README.md index f1bc80f..f60e576 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,25 @@ Cron based download from s3 and database restore. +## Build + +`./build_push.sh [-p , --package ]` + +`./build_push.sh -p 11.7-3.8` + +### Package files + +Each package file represents a release for a particular `postgres` branch. + +The contents of the latest package file may look like this: + +``` +ALPINE_VERSION='3.8' +PG_BASE_VERSION='11' +PG_FULL_VERSION='11.7' +PG_LATEST=true +``` + ## Usage Typically this image is instantiated as a container among many others and would have the responsibility of getting downloading a dump file from s3 and restoring a database at a particular time of day. diff --git a/dev/shellcheck.sh b/dev/shellcheck.sh new file mode 100755 index 0000000..af7e20d --- /dev/null +++ b/dev/shellcheck.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +printf '\n%s\n' "Checking shell scripts..." + +SHELLCHECK_OPTS="" + +RUN_SHELLCHECK="shellcheck ${ALLOW_EXTERNAL_SOURCE:-} ${SHELLCHECK_OPTS} {} +" +eval "find ./*.sh -type f -exec ${RUN_SHELLCHECK}" diff --git a/docker-compose.yml b/docker-compose.yml index 33ab5e3..744e16f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,14 +11,14 @@ version: '3' services: postgres-restore-from-s3: - image: postgres-restore-from-s3:10.10 + image: postgres-restore-from-s3:11.7 network_mode: 'host' build: context: ./ dockerfile: ./Dockerfile args: - pg_alpine_branch: '3.8' - pg_version: '10.10-r0' + alpine_version: '3.9' + pg_full_version: '11.7-r0' environment: AWS_BUCKET: AWS_REGION: diff --git a/lint.sh b/lint.sh deleted file mode 100644 index be6fb52..0000000 --- a/lint.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env sh - -ALLOW_EXTERNAL_SOURCE="${ALLOW_EXTERNAL_SOURCE:-}" - -if [ "${1}" = "--yml" ]; then - printf '\n%s\n' "Checking '.travis.yml'..." - travis lint ./.travis.yml -fi - -if [ "${1}" = "--sh" ]; then - printf '\n%s\n' "Checking shell scripts..." - - SHELLCHECK_OPTS="" - - RUN_SHELLCHECK="shellcheck ${ALLOW_EXTERNAL_SOURCE} ${SHELLCHECK_OPTS} {} +" - eval "find ./*.sh -type f -exec ${RUN_SHELLCHECK}" -fi diff --git a/package/10.12-3.8.env b/package/10.12-3.8.env new file mode 100644 index 0000000..c1f48eb --- /dev/null +++ b/package/10.12-3.8.env @@ -0,0 +1,3 @@ +ALPINE_VERSION='3.8' +PG_BASE_VERSION='10' +PG_FULL_VERSION='10.12' diff --git a/package/11.7-3.9.env b/package/11.7-3.9.env new file mode 100644 index 0000000..970ec5b --- /dev/null +++ b/package/11.7-3.9.env @@ -0,0 +1,4 @@ +ALPINE_VERSION='3.9' +PG_LATEST=false +PG_BASE_VERSION='11' +PG_FULL_VERSION='11.7' diff --git a/package/9.6.13-3.6.env b/package/9.6.13-3.6.env new file mode 100644 index 0000000..9ee2ce9 --- /dev/null +++ b/package/9.6.13-3.6.env @@ -0,0 +1,3 @@ +ALPINE_VERSION='3.6' +PG_BASE_VERSION='9' +PG_FULL_VERSION='9.6.13'