Skip to content
This repository has been archived by the owner on Mar 30, 2020. It is now read-only.

Enable the reverse to reach the backend on AWS #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rootfs/usr/local/bin/functions
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ f_gen_location() {
mkdir -p /nginx/auth/${domain_name}
export frontend_auth=${FRONTEND_AUTH}
export frontend_path=${FRONTEND_PATH}
export backend_addr=${container_name}
export backend_addr=${BACKEND_HOSTNAME}
export frontend_path=${FRONTEND_PATH}
export backend_port=${BACKEND_PORT}
export auth_file=${auth_file}
Expand Down Expand Up @@ -221,6 +221,9 @@ f_make_conf() {
esac
done
IFS=${OLD_IFS}
THIS_CONTAINER_ID=$(hostname)
THIS_CONTAINER_NAME=$(curl --unix-socket /var/run/docker.sock http://localhost/containers/${THIS_CONTAINER_ID}/json 2> /dev/null | jq '.Name' | sed -e 's|.*"/\(.*\)"$|\1|')
BACKEND_HOSTNAME=$(curl --unix-socket /var/run/docker.sock http://localhost/containers/${THIS_CONTAINER_ID}/json 2> /dev/null | jq '.HostConfig.Links' | grep -E "/${THIS_CONTAINER_NAME}/" | grep ${container_name} | sed 's|.*/\(.*\)",*|\1|')
f_log INF "Generate configuration for ${FRONTEND_DOMAIN}, with options :"
f_log INF " path=${FRONTEND_PATH}"
f_log INF " auth=${FRONTEND_AUTH}"
Expand Down