Compare commits
No commits in common. "dc36be2efb1856150bf5bbd61825914796e5227f" and "3ef347323606ed143221d44a380ac4967f537d56" have entirely different histories.
dc36be2efb
...
3ef3473236
@ -34,7 +34,7 @@ stop() {
|
||||
|
||||
start() {
|
||||
__msg "Starting container... " 0 no
|
||||
docker inspect --type container "${SERVICE_NAME}" > /dev/null 2>&1
|
||||
docker inspect "${SERVICE_NAME}" > /dev/null 2>&1
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
init
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
|
||||
|
||||
IMAGE_NAME="dpage/pgadmin4"
|
||||
IMAGE_VERSION="4.10"
|
||||
IMAGE_VERSION="4.1"
|
||||
|
||||
SERVICE_NAME=pgadmin
|
||||
|
||||
|
||||
71
pgsql-db/run
71
pgsql-db/run
@ -2,39 +2,24 @@
|
||||
|
||||
SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P )
|
||||
|
||||
IMAGE_NAME="postgres"
|
||||
IMAGE_VERSION="10.9"
|
||||
|
||||
POSTGIS_MAJOR="2.5"
|
||||
POSTGIS_VERSION="2.5.2+dfsg-1~exp1.pgdg90+1"
|
||||
IMAGE_NAME="mdillon/postgis"
|
||||
IMAGE_VERSION="9.5"
|
||||
|
||||
SERVICE_NAME=pgsql-db
|
||||
|
||||
|
||||
source ${SCRIPT_PATH}/../common.shinc
|
||||
|
||||
#
|
||||
# Project specific variables
|
||||
#
|
||||
|
||||
DB_VOLUME=pgsql_persistent_10
|
||||
DB_VOLUME=pgsql_persistent
|
||||
PORT=5432
|
||||
|
||||
source ${SCRIPT_PATH}/env.shinc 2> /dev/null
|
||||
|
||||
|
||||
__build() {
|
||||
docker build \
|
||||
--build-arg IMAGE_NAME=${IMAGE_NAME} \
|
||||
--build-arg VERSION=${IMAGE_VERSION} \
|
||||
--build-arg POSTGIS_MAJOR=${IMAGE_VERSION} \
|
||||
--build-arg POSTGIS_VERSION=${IMAGE_VERSION} \
|
||||
-t ${SERVICE_NAME}:latest \
|
||||
${SCRIPT_PATH}/build
|
||||
|
||||
return $?
|
||||
|
||||
}
|
||||
|
||||
init() {
|
||||
__init
|
||||
|
||||
@ -59,54 +44,6 @@ init() {
|
||||
__ask_to_start
|
||||
}
|
||||
|
||||
migrate9to10() {
|
||||
local migrationVolume="pgsql-9-10-dump-migration"
|
||||
local migrationpath="/pgsql-data-dump"
|
||||
stop
|
||||
docker volume create ${migrationVolume}
|
||||
|
||||
docker run --rm -d \
|
||||
--name postgres_migration_from_9 \
|
||||
-v ${DB_VOLUME}:/var/lib/postgresql/data \
|
||||
-v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \
|
||||
-v ${migrationVolume}:${migrationpath} \
|
||||
-e POSTGRES_USER=${DB_USER} \
|
||||
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
|
||||
mdillon/postgis:9
|
||||
|
||||
docker exec -it \
|
||||
postgres_migration_from_9 \
|
||||
bash -c "pg_dumpall > /migration/full.dump"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
__err "Bad thing, don't continue, quitsies, bye"
|
||||
exit 137
|
||||
fi
|
||||
|
||||
docker stop postgres_migration_from_9
|
||||
|
||||
docker volume rm -f ${DB_VOLUME}
|
||||
docker volume create ${DB_VOLUME}
|
||||
|
||||
docker run --rm -d \
|
||||
--name postgres_migration_to_10 \
|
||||
-v ${DB_VOLUME}:/var/lib/postgresql/data \
|
||||
-v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \
|
||||
-v ${migrationVolume}:${migrationpath} \
|
||||
-e POSTGRES_USER=${DB_USER} \
|
||||
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
|
||||
mdillon/postgis:10 \
|
||||
psql -d postgres -f ${migrationpath}/full.dump
|
||||
|
||||
sudo docker exec -it \
|
||||
postgres_migration_to_10 \
|
||||
psql -f /migration/full.dump
|
||||
|
||||
docker stop postgres_migration_to_10
|
||||
|
||||
__init
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
||||
exit $?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user