mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
fix nginx https issues
Signed-off-by: Shahbaz Nazir <shahbaz@bigchaindb.com>
This commit is contained in:
parent
582025ba3d
commit
4b06378bbf
@ -115,7 +115,7 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# POST requests get forwarded to BDB.
|
# POST requests get forwarded to BDB.
|
||||||
if ($request_method = POST ) {}
|
if ($request_method = POST ) {
|
||||||
proxy_pass http://$bdb_backend:BIGCHAINDB_API_PORT;
|
proxy_pass http://$bdb_backend:BIGCHAINDB_API_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ set -euo pipefail
|
|||||||
threescale_auth_mode="threescale"
|
threescale_auth_mode="threescale"
|
||||||
secret_token_auth_mode="secret-token"
|
secret_token_auth_mode="secret-token"
|
||||||
|
|
||||||
|
|
||||||
# Cluster vars
|
# Cluster vars
|
||||||
cluster_fqdn=`printenv CLUSTER_FQDN`
|
cluster_fqdn=`printenv CLUSTER_FQDN`
|
||||||
cluster_frontend_port=`printenv CLUSTER_FRONTEND_PORT`
|
cluster_frontend_port=`printenv CLUSTER_FRONTEND_PORT`
|
||||||
@ -15,18 +16,14 @@ dns_server=`printenv DNS_SERVER`
|
|||||||
health_check_port=`printenv HEALTH_CHECK_PORT`
|
health_check_port=`printenv HEALTH_CHECK_PORT`
|
||||||
authorization_mode=`printenv AUTHORIZATION_MODE`
|
authorization_mode=`printenv AUTHORIZATION_MODE`
|
||||||
|
|
||||||
|
|
||||||
# MongoDB vars
|
# MongoDB vars
|
||||||
mongo_frontend_port=`printenv MONGODB_FRONTEND_PORT`
|
|
||||||
mongo_backend_host=`printenv MONGODB_BACKEND_HOST`
|
mongo_backend_host=`printenv MONGODB_BACKEND_HOST`
|
||||||
mongo_backend_port=`printenv MONGODB_BACKEND_PORT`
|
mongo_backend_port=`printenv MONGODB_BACKEND_PORT`
|
||||||
|
|
||||||
|
|
||||||
# OpenResty vars
|
# OpenResty vars
|
||||||
openresty_backend_host=`printenv OPENRESTY_BACKEND_HOST`
|
openresty_backend_host=`printenv OPENRESTY_BACKEND_HOST`
|
||||||
openresty_backend_port=`printenv OPENRESTY_BACKEND_PORT`
|
openresty_backend_port=`printenv OPENRESTY_BACKEND_PORT`
|
||||||
|
|
||||||
|
|
||||||
# BigchainDB vars
|
# BigchainDB vars
|
||||||
bdb_backend_host=`printenv BIGCHAINDB_BACKEND_HOST`
|
bdb_backend_host=`printenv BIGCHAINDB_BACKEND_HOST`
|
||||||
bdb_api_port=`printenv BIGCHAINDB_API_PORT`
|
bdb_api_port=`printenv BIGCHAINDB_API_PORT`
|
||||||
@ -37,9 +34,9 @@ tm_pub_key_access_port=`printenv TM_PUB_KEY_ACCESS_PORT`
|
|||||||
tm_backend_host=`printenv TM_BACKEND_HOST`
|
tm_backend_host=`printenv TM_BACKEND_HOST`
|
||||||
tm_p2p_port=`printenv TM_P2P_PORT`
|
tm_p2p_port=`printenv TM_P2P_PORT`
|
||||||
|
|
||||||
|
|
||||||
# sanity check
|
# sanity check
|
||||||
if [[ -z "${cluster_frontend_port:?CLUSTER_FRONTEND_PORT not specified. Exiting!}" || \
|
if [[ -z "${cluster_frontend_port:?CLUSTER_FRONTEND_PORT not specified. Exiting!}" || \
|
||||||
-z "${mongo_frontend_port:?MONGODB_FRONTEND_PORT not specified. Exiting!}" || \
|
|
||||||
-z "${mongo_backend_host:?MONGODB_BACKEND_HOST not specified. Exiting!}" || \
|
-z "${mongo_backend_host:?MONGODB_BACKEND_HOST not specified. Exiting!}" || \
|
||||||
-z "${mongo_backend_port:?MONGODB_BACKEND_PORT not specified. Exiting!}" || \
|
-z "${mongo_backend_port:?MONGODB_BACKEND_PORT not specified. Exiting!}" || \
|
||||||
-z "${openresty_backend_port:?OPENRESTY_BACKEND_PORT not specified. Exiting!}" || \
|
-z "${openresty_backend_port:?OPENRESTY_BACKEND_PORT not specified. Exiting!}" || \
|
||||||
@ -52,8 +49,7 @@ if [[ -z "${cluster_frontend_port:?CLUSTER_FRONTEND_PORT not specified. Exiting!
|
|||||||
-z "${cluster_fqdn:?CLUSTER_FQDN not specified. Exiting!}" || \
|
-z "${cluster_fqdn:?CLUSTER_FQDN not specified. Exiting!}" || \
|
||||||
-z "${tm_pub_key_access_port:?TM_PUB_KEY_ACCESS_PORT not specified. Exiting!}" || \
|
-z "${tm_pub_key_access_port:?TM_PUB_KEY_ACCESS_PORT not specified. Exiting!}" || \
|
||||||
-z "${tm_backend_host:?TM_BACKEND_HOST not specified. Exiting!}" || \
|
-z "${tm_backend_host:?TM_BACKEND_HOST not specified. Exiting!}" || \
|
||||||
-z "${tm_p2p_port:?TM_P2P_PORT not specified. Exiting!}" || \
|
-z "${tm_p2p_port:?TM_P2P_PORT not specified. Exiting!}" ]]; then
|
||||||
-z "${authorization_mode:-threescale_auth_mode}" ]]; then # Set the default authorization mode to threescale
|
|
||||||
echo "Missing required environment variables. Exiting!"
|
echo "Missing required environment variables. Exiting!"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
@ -61,7 +57,6 @@ else
|
|||||||
echo CLUSTER_FRONTEND_PORT="$cluster_frontend_port"
|
echo CLUSTER_FRONTEND_PORT="$cluster_frontend_port"
|
||||||
echo DNS_SERVER="$dns_server"
|
echo DNS_SERVER="$dns_server"
|
||||||
echo HEALTH_CHECK_PORT="$health_check_port"
|
echo HEALTH_CHECK_PORT="$health_check_port"
|
||||||
echo MONGODB_FRONTEND_PORT="$mongo_frontend_port"
|
|
||||||
echo MONGODB_BACKEND_HOST="$mongo_backend_host"
|
echo MONGODB_BACKEND_HOST="$mongo_backend_host"
|
||||||
echo MONGODB_BACKEND_PORT="$mongo_backend_port"
|
echo MONGODB_BACKEND_PORT="$mongo_backend_port"
|
||||||
echo OPENRESTY_BACKEND_HOST="$openresty_backend_host"
|
echo OPENRESTY_BACKEND_HOST="$openresty_backend_host"
|
||||||
@ -77,7 +72,7 @@ fi
|
|||||||
if [[ ${authorization_mode} == ${secret_token_auth_mode} ]]; then
|
if [[ ${authorization_mode} == ${secret_token_auth_mode} ]]; then
|
||||||
NGINX_CONF_FILE=/etc/nginx/nginx.conf
|
NGINX_CONF_FILE=/etc/nginx/nginx.conf
|
||||||
secret_access_token=`printenv SECRET_ACCESS_TOKEN`
|
secret_access_token=`printenv SECRET_ACCESS_TOKEN`
|
||||||
sed -i "s|SECRET_ACCESS_TOKEN|${secret_token_header}|g"
|
sed -i "s|SECRET_ACCESS_TOKEN|${secret_access_token}|g" ${NGINX_CONF_FILE}
|
||||||
elif [[ ${authorization_mode} == ${threescale_auth_mode} ]]; then
|
elif [[ ${authorization_mode} == ${threescale_auth_mode} ]]; then
|
||||||
NGINX_CONF_FILE=/etc/nginx/nginx-threescale.conf
|
NGINX_CONF_FILE=/etc/nginx/nginx-threescale.conf
|
||||||
sed -i "s|OPENRESTY_BACKEND_PORT|${openresty_backend_port}|g" ${NGINX_CONF_FILE}
|
sed -i "s|OPENRESTY_BACKEND_PORT|${openresty_backend_port}|g" ${NGINX_CONF_FILE}
|
||||||
@ -90,7 +85,6 @@ fi
|
|||||||
# configure the nginx.conf file with env variables
|
# configure the nginx.conf file with env variables
|
||||||
sed -i "s|CLUSTER_FQDN|${cluster_fqdn}|g" ${NGINX_CONF_FILE}
|
sed -i "s|CLUSTER_FQDN|${cluster_fqdn}|g" ${NGINX_CONF_FILE}
|
||||||
sed -i "s|CLUSTER_FRONTEND_PORT|${cluster_frontend_port}|g" ${NGINX_CONF_FILE}
|
sed -i "s|CLUSTER_FRONTEND_PORT|${cluster_frontend_port}|g" ${NGINX_CONF_FILE}
|
||||||
sed -i "s|MONGODB_FRONTEND_PORT|${mongo_frontend_port}|g" ${NGINX_CONF_FILE}
|
|
||||||
sed -i "s|MONGODB_BACKEND_HOST|${mongo_backend_host}|g" ${NGINX_CONF_FILE}
|
sed -i "s|MONGODB_BACKEND_HOST|${mongo_backend_host}|g" ${NGINX_CONF_FILE}
|
||||||
sed -i "s|MONGODB_BACKEND_PORT|${mongo_backend_port}|g" ${NGINX_CONF_FILE}
|
sed -i "s|MONGODB_BACKEND_PORT|${mongo_backend_port}|g" ${NGINX_CONF_FILE}
|
||||||
sed -i "s|BIGCHAINDB_BACKEND_HOST|${bdb_backend_host}|g" ${NGINX_CONF_FILE}
|
sed -i "s|BIGCHAINDB_BACKEND_HOST|${bdb_backend_host}|g" ${NGINX_CONF_FILE}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user