setup_infra now uses infra_version.js
INFRA_VERSION is now removed. Note that DATA_DIR/INFRA_VERSION still exists.
This commit is contained in:
@@ -12,8 +12,8 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${script_dir}/../INFRA_VERSION" # this injects INFRA_VERSION
|
||||
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly infra_version="${script_dir}/../infra_version.js"
|
||||
|
||||
readonly data_dir="$1"
|
||||
readonly fqdn="$2"
|
||||
@@ -22,6 +22,7 @@ readonly mail_tls_cert="$4"
|
||||
readonly mail_tls_key="$5"
|
||||
|
||||
# graphite
|
||||
readonly graphite_image=$(node -e "console.log(require('${infra_version}').images.graphite.tag);")
|
||||
graphite_container_id=$(docker run --restart=always -d --name="graphite" \
|
||||
-m 75m \
|
||||
--memory-swap 150m \
|
||||
@@ -30,12 +31,13 @@ graphite_container_id=$(docker run --restart=always -d --name="graphite" \
|
||||
-p 127.0.0.1:8000:8000 \
|
||||
-v "${data_dir}/graphite:/app/data" \
|
||||
--read-only -v /tmp -v /run \
|
||||
"${GRAPHITE_IMAGE}")
|
||||
"${graphite_image}")
|
||||
echo "Graphite container id: ${graphite_container_id}"
|
||||
|
||||
# mail (note: 2525 is hardcoded in mail container and app use this port)
|
||||
# MAIL_SERVER_NAME is the hostname of the mailserver i.e server uses these certs
|
||||
# MAIL_DOMAIN is the domain for which this server is relaying mails
|
||||
readonly mail_image=$(node -e "console.log(require('${infra_version}').images.mail.tag);")
|
||||
mail_container_id=$(docker run --restart=always -d --name="mail" \
|
||||
-m 75m \
|
||||
--memory-swap 150m \
|
||||
@@ -50,10 +52,11 @@ mail_container_id=$(docker run --restart=always -d --name="mail" \
|
||||
-p 4190:4190 \
|
||||
-p 25:2525 \
|
||||
--read-only -v /tmp -v /run \
|
||||
"${MAIL_IMAGE}")
|
||||
"${mail_image}")
|
||||
echo "Mail container id: ${mail_container_id}"
|
||||
|
||||
# mysql
|
||||
readonly mysql_image=$(node -e "console.log(require('${infra_version}').images.mysql.tag);")
|
||||
mysql_addon_root_password=$(pwgen -1 -s)
|
||||
docker0_ip=$(/sbin/ifconfig docker0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}')
|
||||
cat > "${data_dir}/addons/mysql_vars.sh" <<EOF
|
||||
@@ -67,10 +70,11 @@ mysql_container_id=$(docker run --restart=always -d --name="mysql" \
|
||||
-v "${data_dir}/mysql:/var/lib/mysql" \
|
||||
-v "${data_dir}/addons/mysql_vars.sh:/etc/mysql/mysql_vars.sh:ro" \
|
||||
--read-only -v /tmp -v /run \
|
||||
"${MYSQL_IMAGE}")
|
||||
"${mysql_image}")
|
||||
echo "MySQL container id: ${mysql_container_id}"
|
||||
|
||||
# postgresql
|
||||
readonly postgresql_image=$(node -e "console.log(require('${infra_version}').images.postgresql.tag);")
|
||||
postgresql_addon_root_password=$(pwgen -1 -s)
|
||||
cat > "${data_dir}/addons/postgresql_vars.sh" <<EOF
|
||||
readonly POSTGRESQL_ROOT_PASSWORD='${postgresql_addon_root_password}'
|
||||
@@ -82,10 +86,11 @@ postgresql_container_id=$(docker run --restart=always -d --name="postgresql" \
|
||||
-v "${data_dir}/postgresql:/var/lib/postgresql" \
|
||||
-v "${data_dir}/addons/postgresql_vars.sh:/etc/postgresql/postgresql_vars.sh:ro" \
|
||||
--read-only -v /tmp -v /run \
|
||||
"${POSTGRESQL_IMAGE}")
|
||||
"${postgresql_image}")
|
||||
echo "PostgreSQL container id: ${postgresql_container_id}"
|
||||
|
||||
# mongodb
|
||||
readonly mongodb_image=$(node -e "console.log(require('${infra_version}').images.mongodb.tag);")
|
||||
mongodb_addon_root_password=$(pwgen -1 -s)
|
||||
cat > "${data_dir}/addons/mongodb_vars.sh" <<EOF
|
||||
readonly MONGODB_ROOT_PASSWORD='${mongodb_addon_root_password}'
|
||||
@@ -97,5 +102,5 @@ mongodb_container_id=$(docker run --restart=always -d --name="mongodb" \
|
||||
-v "${data_dir}/mongodb:/var/lib/mongodb" \
|
||||
-v "${data_dir}/addons/mongodb_vars.sh:/etc/mongodb_vars.sh:ro" \
|
||||
--read-only -v /tmp -v /run \
|
||||
"${MONGODB_IMAGE}")
|
||||
"${mongodb_image}")
|
||||
echo "Mongodb container id: ${mongodb_container_id}"
|
||||
|
||||
Reference in New Issue
Block a user