Skip to content

Commit

Permalink
add 11.7 support and improve scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
abbotto committed May 15, 2020
1 parent f85b937 commit e252b62
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ branches:
- master

script:
- ./lint.sh --sh
- ./dev/util/shellcheck.sh
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG alpine_version
FROM alpine:${alpine_version}

ARG alpine_version
ARG pg_package_version
ARG pg_full_version

#--------------------------------------------------------------------------------
# Install dependencies
Expand All @@ -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

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

Cron based download from s3 and database restore.

## Build

`./build_push.sh [-p <FILE>, --package <FILE>]`

`./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.
Expand Down
8 changes: 8 additions & 0 deletions dev/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -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}"
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_BUCKET_NAME>
AWS_REGION: <AWS_REGION_NAME>
Expand Down
17 changes: 0 additions & 17 deletions lint.sh

This file was deleted.

3 changes: 3 additions & 0 deletions package/10.12-3.8.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALPINE_VERSION='3.8'
PG_BASE_VERSION='10'
PG_FULL_VERSION='10.12'
4 changes: 4 additions & 0 deletions package/11.7-3.9.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALPINE_VERSION='3.9'
PG_LATEST=false
PG_BASE_VERSION='11'
PG_FULL_VERSION='11.7'
3 changes: 3 additions & 0 deletions package/9.6.13-3.6.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALPINE_VERSION='3.6'
PG_BASE_VERSION='9'
PG_FULL_VERSION='9.6.13'

0 comments on commit e252b62

Please sign in to comment.