Skip to content

Commit

Permalink
fix(ZNTA-1660): Use :z instead of chcon (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
definite committed Feb 13, 2017
1 parent 5454073 commit f70cd5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions server/docker/rundb.sh
@@ -1,10 +1,11 @@
#!/bin/bash
#!/bin/bash -eu
### This program sets up the data volume and database containers for Zanata

# determine directory containing this script
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
SOURCE="$(realpath "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
Expand All @@ -14,7 +15,6 @@ source ${DIR}/common
VOLUME_DIR=$HOME/docker-volumes/zanata-mariadb

mkdir -p $VOLUME_DIR
chcon -Rt svirt_sandbox_file_t $VOLUME_DIR

while getopts ":n:h" opt; do
case ${opt} in
Expand All @@ -41,7 +41,7 @@ docker run --name zanatadb \
-e MYSQL_USER=$DB_USERNAME -e MYSQL_PASSWORD=$DB_PASSWORD \
-e MYSQL_DATABASE=$DB_SCHEMA -e MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD \
-P --net=${DOCKER_NETWORK} \
-v $VOLUME_DIR:/var/lib/mysql \
-v $VOLUME_DIR:/var/lib/mysql:Z \
-d mariadb:10.1 \
--character-set-server=utf8 --collation-server=utf8_general_ci

Expand Down
12 changes: 6 additions & 6 deletions server/docker/rundev.sh
@@ -1,10 +1,10 @@
#!/bin/bash -xe
#!/bin/bash -xeu

# determine directory containing this script
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
SOURCE="$(realpath "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
Expand All @@ -18,7 +18,7 @@ ZANATA_WAR=$(echo $PWD/zanata-war/target/zanata-*.war)
# volume mapping for JBoss deployment folder (put exploded war or war file here to deploy)
ZANATA_DEPLOYMENTS_DIR=$HOME/docker-volumes/zanata-deployments
# make zanata deployment directory accessible to docker containers (SELinux)
mkdir -p ${ZANATA_DEPLOYMENTS_DIR} && chcon -Rt svirt_sandbox_file_t ${ZANATA_DEPLOYMENTS_DIR}
mkdir -p ${ZANATA_DEPLOYMENTS_DIR}

if [ -f "$ZANATA_WAR" ]
then
Expand Down Expand Up @@ -102,7 +102,7 @@ ensure_docker_network
# volume mapping for zanata server files
ZANATA_DIR=$HOME/docker-volumes/zanata
# create the data directory and set permissions (SELinux)
mkdir -p $ZANATA_DIR && chcon -Rt svirt_sandbox_file_t "$ZANATA_DIR"
mkdir -p $ZANATA_DIR

# build the docker dev image
docker build -t zanata/server-dev docker/
Expand All @@ -121,6 +121,6 @@ docker run \
-e MAIL_HOST="${MAIL_HOST}" ${MAIL_CREDENTIAL_ENV} \
--rm --name zanata --net=${DOCKER_NETWORK} \
-p ${HTTP_PORT}:8080 -p ${DEBUG_PORT}:8787 -p ${MGMT_PORT}:9990 -it \
-v ${ZANATA_DEPLOYMENTS_DIR}:${JBOSS_DEPLOYMENT_VOLUME} \
-v $ZANATA_DIR:/opt/jboss/zanata \
-v ${ZANATA_DEPLOYMENTS_DIR}:${JBOSS_DEPLOYMENT_VOLUME}:Z \
-v $ZANATA_DIR:/opt/jboss/zanata:Z \
zanata/server-dev

0 comments on commit f70cd5c

Please sign in to comment.