-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to publish demo images and db
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export LOCAL_USER_ID=${LOCAL_USER_ID:-$UID} | ||
DOCKER_USERNAME=${DOCKER_USERNAME:-translatetravis2} | ||
DOCKER_PUBLISH_NAME=${DOCKER_PUBLISH_NAME:-translate} | ||
|
||
docker-compose pull --parallel demo redis elasticsearch | ||
docker-compose build db-demo | ||
|
||
echo "Installing db" | ||
makey demo pootle migrate | ||
makey demo pootle initdb | ||
|
||
export DB_UUID=$(docker-compose ps -q db-demo) | ||
|
||
echo "Dumping db in $DB_UUID" | ||
docker exec -ti $DB_UUID bash -c "pg_dump -U pootle -Z9 pootledb > /docker-entrypoint-initdb.d/demo.sql.gz" | ||
|
||
echo "Commiting $DB_UUID -> $DOCKER_PUBLISH_NAME/pootle:db-demo" | ||
docker-compose stop | ||
docker commit $DB_UUID $DOCKER_PUBLISH_NAME/pootle:db-demo | ||
|
||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker push $DOCKER_PUBLISH_NAME/pootle:db-demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export LOCAL_USER_ID=${LOCAL_USER_ID:-$UID} | ||
DOCKER_USERNAME=${DOCKER_USERNAME:-translatetravis2} | ||
DOCKER_PUBLISH_NAME=${DOCKER_PUBLISH_NAME:-translate} | ||
|
||
makey build-demo-all | ||
|
||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
|
||
docker push $DOCKER_PUBLISH_NAME/pootle:demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
CMD="${@:2}"; | ||
IMAGE=$1 | ||
RUNNER=/home/pootle/pootle_env/src/pootle/docker/bin/run_in_container | ||
export LOCAL_USER_ID=${LOCAL_USER_ID:-$UID} | ||
|
||
function pull_images () { | ||
docker-compose pull --include-deps --parallel $IMAGE | ||
} | ||
|
||
function image_exists() { | ||
IMAGE_EXISTS=$(docker images -q translate/pootle:$IMAGE) | ||
} | ||
|
||
function run_in_container () { | ||
COMPOSE="docker-compose run $FLAGS --rm $IMAGE" | ||
$COMPOSE $RUNNER "${@:1}"; | ||
} | ||
|
||
image_exists | ||
|
||
if [ ! -z $IMAGE_EXISTS ]; then | ||
echo "$IMAGE image exists" | ||
else | ||
echo "$IMAGE image does not exist, pulling..." | ||
pull_images | ||
fi | ||
|
||
run_in_container bash /home/pootle/pootle_env/src/pootle/docker/bin/await-postgres | ||
|
||
if [ -z ${CMD:+x} ]; then | ||
run_in_container pootle revision --restore | ||
FLAGS=--service-ports run_in_container | ||
else | ||
run_in_container $CMD; | ||
fi |