Skip to content

Commit

Permalink
Fix swdc down
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Aug 13, 2019
1 parent f664b4b commit bce10e0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
4 changes: 3 additions & 1 deletion modules/base/down.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

docker-compose down
export DOCKER_OVERRIDE_FILE="/tmp/swdc-docker-compose-override.yml";

docker-compose -f ${DIR}/docker-compose.yml -f ${DOCKER_OVERRIDE_FILE} down
57 changes: 29 additions & 28 deletions modules/local/local-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,41 @@ CODE_FOLDER_CONTENT="$(ls -A ${CODE_DIRECTORY})"

MYSQL_VERSION=$(echo ${MYSQL_VERSION} | sed 's/\.//g')
PHP_VERSION=$(echo ${PHP_VERSION} | sed 's/\.//g')
export DOCKER_OVERRIDE_FILE="/tmp/swdc-docker-compose-override.yml";


echo "version: '3'" > "${DIR}/docker-compose.override.yaml"
echo "services:" >> "${DIR}/docker-compose.override.yaml"
echo "version: '3'" > ${DOCKER_OVERRIDE_FILE}
echo "services:" >> ${DOCKER_OVERRIDE_FILE}
if [[ -f "${DIR}/images/custom/nginx/Dockerfile" ]]; then
echo " nginx:" >> "${DIR}/docker-compose.override.yaml"
echo " build:" >> "${DIR}/docker-compose.override.yaml"
echo " context: ${DIR}/images/custom/nginx/" >> "${DIR}/docker-compose.override.yaml"
echo " dockerfile: ${DIR}/images/custom/nginx/Dockerfile" >> "${DIR}/docker-compose.override.yaml"
echo " nginx:" >> ${DOCKER_OVERRIDE_FILE}
echo " build:" >> ${DOCKER_OVERRIDE_FILE}
echo " context: ${DIR}/images/custom/nginx/" >> ${DOCKER_OVERRIDE_FILE}
echo " dockerfile: ${DIR}/images/custom/nginx/Dockerfile" >> ${DOCKER_OVERRIDE_FILE}
if [[ ${CODE_FOLDER_CONTENT} ]]; then
echo " extra_hosts:" >> "${DIR}/docker-compose.override.yaml"
echo " extra_hosts:" >> ${DOCKER_OVERRIDE_FILE}
for d in ${CODE_DIRECTORY}/* ; do
if [[ -d "$d" ]]; then
NAME=$(basename $d)
if [[ -f "$d/public/index.php" ]]; then
echo " ${NAME}.platform.localhost: 127.0.0.1" >> "${DIR}/docker-compose.override.yaml"
echo " ${NAME}.platform.localhost: 127.0.0.1" >> ${DOCKER_OVERRIDE_FILE}
else
echo " ${NAME}.dev.localhost: 127.0.0.1" >> "${DIR}/docker-compose.override.yaml"
echo " ${NAME}.dev.localhost: 127.0.0.1" >> ${DOCKER_OVERRIDE_FILE}
fi
fi
done
echo " volumes:" >> "${DIR}/docker-compose.override.yaml"
echo " - ${CODE_DIRECTORY}:/var/www/html:cached" >> "${DIR}/docker-compose.override.yaml"
echo " volumes:" >> ${DOCKER_OVERRIDE_FILE}
echo " - ${CODE_DIRECTORY}:/var/www/html:cached" >> ${DOCKER_OVERRIDE_FILE}
for d in ${CODE_DIRECTORY}/* ; do
if [[ -d "$d" ]]; then
NAME=$(basename $d)
echo " - ${CODE_DIRECTORY}/${NAME}/media:/var/www/html/${NAME}/media:cached" >> "${DIR}/docker-compose.override.yaml"
echo " - ${CODE_DIRECTORY}/${NAME}/files:/var/www/html/${NAME}/files:cached" >> "${DIR}/docker-compose.override.yaml"
echo " - ${CODE_DIRECTORY}/${NAME}/media:/var/www/html/${NAME}/media:cached" >> ${DOCKER_OVERRIDE_FILE}
echo " - ${CODE_DIRECTORY}/${NAME}/files:/var/www/html/${NAME}/files:cached" >> ${DOCKER_OVERRIDE_FILE}
if [[ ${CACHE_VOLUMES} == "true" ]]; then
echo " - ${NAME}_var_cache:/var/www/html/${NAME}/var/cache:delegated" >> "${DIR}/docker-compose.override.yaml"
echo " - ${NAME}_web_cache:/var/www/html/${NAME}/web/cache:delegated" >> "${DIR}/docker-compose.override.yaml"
echo " - ${NAME}_var_cache:/var/www/html/${NAME}/var/cache:delegated" >> ${DOCKER_OVERRIDE_FILE}
echo " - ${NAME}_web_cache:/var/www/html/${NAME}/web/cache:delegated" >> ${DOCKER_OVERRIDE_FILE}
else
echo " - ${CODE_DIRECTORY}/${NAME}/var/cache:/var/www/html/${NAME}/var/cache:delegated" >> "${DIR}/docker-compose.override.yaml"
echo " - ${CODE_DIRECTORY}/${NAME}/web/cache:/var/www/html/${NAME}/web/cache:delegated" >> "${DIR}/docker-compose.override.yaml"
echo " - ${CODE_DIRECTORY}/${NAME}/var/cache:/var/www/html/${NAME}/var/cache:delegated" >> ${DOCKER_OVERRIDE_FILE}
echo " - ${CODE_DIRECTORY}/${NAME}/web/cache:/var/www/html/${NAME}/web/cache:delegated" >> ${DOCKER_OVERRIDE_FILE}
fi
fi
done
Expand All @@ -49,23 +50,23 @@ else
create_nginx
fi
if [[ -f "${DIR}/images/custom/mysql/Dockerfile" ]]; then
echo " mysql:" >> "${DIR}/docker-compose.override.yaml"
echo " build:" >> "${DIR}/docker-compose.override.yaml"
echo " context: ${DIR}/images/custom/mysql/" >> "${DIR}/docker-compose.override.yaml"
echo " dockerfile: ${DIR}/images/custom/mysql/Dockerfile" >> "${DIR}/docker-compose.override.yaml"
echo " mysql:" >> ${DOCKER_OVERRIDE_FILE}
echo " build:" >> ${DOCKER_OVERRIDE_FILE}
echo " context: ${DIR}/images/custom/mysql/" >> ${DOCKER_OVERRIDE_FILE}
echo " dockerfile: ${DIR}/images/custom/mysql/Dockerfile" >> ${DOCKER_OVERRIDE_FILE}
if [[ ${EXPOSE_MYSQL_LOCAL} == "true" ]]; then
echo " ports:" >> "${DIR}/docker-compose.override.yaml"
echo " - 3306:3306" >> "${DIR}/docker-compose.override.yaml"
echo " ports:" >> ${DOCKER_OVERRIDE_FILE}
echo " - 3306:3306" >> ${DOCKER_OVERRIDE_FILE}
fi
if [[ ${PERSISTENT_DATABASE} == "false" ]]; then
echo " tmpfs:" >> "${DIR}/docker-compose.override.yaml"
echo " - /var/lib/mysql" >> "${DIR}/docker-compose.override.yaml"
echo " tmpfs:" >> ${DOCKER_OVERRIDE_FILE}
echo " - /var/lib/mysql" >> ${DOCKER_OVERRIDE_FILE}
else
echo " volumes:" >> "${DIR}/docker-compose.override.yaml"
echo " volumes:" >> ${DOCKER_OVERRIDE_FILE}
for d in ${CODE_DIRECTORY}/* ; do
if [[ -d "$d" ]]; then
NAME=$(basename $d)
echo " - ./mysql-data:/var/lib/mysql:delegated" >> "${DIR}/docker-compose.override.yaml"
echo " - ./mysql-data:/var/lib/mysql:delegated" >> ${DOCKER_OVERRIDE_FILE}
fi
done
fi
Expand Down Expand Up @@ -101,4 +102,4 @@ if [[ ${CACHE_VOLUMES} == "true" ]]; then
create_caching
fi

docker-compose up -d --remove-orphans
docker-compose -f ${DIR}/docker-compose.yml -f ${DOCKER_OVERRIDE_FILE} up -d --remove-orphans

0 comments on commit bce10e0

Please sign in to comment.