-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpost-receive.sample
More file actions
35 lines (23 loc) · 1.28 KB
/
Copy pathpost-receive.sample
File metadata and controls
35 lines (23 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
ENV="-e USERDB_SALT=xxxsalt -e USERDB_GOOGLE_MAPS_KEY=xxxmapskey -e USERDB_DB_HOST=db.hkfree.org -e USERDB_DB_NAME=xxxdb -e USERDB_DB_USERNAME=xxxuser -e USERDB_DB_PASSWORD=xxxpwd -e USERDB_ENCRYPTION_PASSPHRASE=def000b87ec03 -e USERDB_IDS_IPS_WHITELIST=10.107.99.188 -e PDF_GENERATOR_URL=http://userdb-pdf-generator-testing/ FILE_STORAGE_PATH=/opt/userdb/smlouvy DIGISIGN_ACCESS_KEY=PSy...abc DIGISIGN_SECRET_KEY=dko...MM"
DEPLOYDIR=/opt/UserDB
# get the latest version in master branch
GIT_WORK_TREE="$DEPLOYDIR" git checkout -f
TAG=`git log -1 --format=%h`
# go to web app dir
cd "$DEPLOYDIR"
echo "Building Docker image..."
docker build -t userdb:$TAG .
set -e
echo "Upgrading DB schema..." # mandatory
docker run --rm $ENV userdb:$TAG php bin/console migrations:continue --production
echo "Stopping container..." # optional (may fail if container was not running)
docker stop userdb || true
DATETIME=`date '+%Y%m%d-%H%M%S'`
echo "Renaming old userdb container to userdb-$DATETIME" # optional (may fail if old container does not exist)
docker rename userdb userdb-$DATETIME || true
echo "Starting a new userdb container..." # mandatory
docker run -d --restart=always $ENV --name userdb -p 127.0.0.1:8080:80 userdb:$TAG
#
# TODO pořešit deployment "pdf-generator" kontejneru
#