Skip to content

Commit ca4c134

Browse files
committed
Added RANCHER_PORT and RANCHER_CONTAINER_NAME
1 parent 75effc9 commit ca4c134

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ MAINTAINER codedevote
33

44
# Set this to rancher url via docker option '-e RANCHER_URL=myrancher.example.org'
55
ENV RANCHER_URL localhost
6+
ENV RANCHER_PORT 8080
7+
ENV RANCHER_CONTAINER_NAME rancher
68

79
# add nginx config for rancher server
810
ADD rancher.conf /etc/nginx/conf.d/rancher.conf

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ View in GitHub [codedevote/docker-nginx-ssl-proxy-rancher](https://github.com/co
1919
* __RANCHER\_URL__
2020
* default: localhost
2121

22+
* __RANCHER\_PORT__
23+
* default: 8080
24+
25+
* __RANCHER\_CONTAINER_NAME__
26+
* default: rancher
27+
28+
2229
## Running codedevote/nginx-ssl-proxy-rancher container
2330
All the information on running the base image also applies to this container.
2431

entrypoint.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ if [ ! -e "/etc/nginx/external/cert.pem" ] || [ ! -e "/etc/nginx/external/key.pe
3232
then
3333
echo ">> generating self signed cert"
3434
openssl req -x509 -newkey rsa:4086 \
35-
-subj "/C=XX/ST=XXXX/L=XXXX/O=XXXX/CN=localhost" \
35+
-subj "/C=XX/ST=XXXX/L=XXXX/O=XXXX/CN=$RANCHER_URL" \
3636
-keyout "/etc/nginx/external/key.pem" \
3737
-out "/etc/nginx/external/cert.pem" \
3838
-days 3650 -nodes -sha256
3939
fi
4040

4141
echo ">> setting rancher url to $RANCHER_URL"
4242
sed -i "s/\${RANCHER_URL}/$RANCHER_URL/" /etc/nginx/conf.d/rancher.conf
43+
sed -i "s/\${RANCHER_PORT}/$RANCHER_PORT/" /etc/nginx/conf.d/rancher.conf
44+
sed -i "s/\${RANCHER_CONTAINER_NAME}/$RANCHER_CONTAINER_NAME/" /etc/nginx/conf.d/rancher.conf
4345

4446
echo ">> copy /etc/nginx/external/*.conf files to /etc/nginx/conf.d/"
4547
cp /etc/nginx/external/*.conf /etc/nginx/conf.d/ 2> /dev/null > /dev/null

rancher.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# terminates ssl at the proxy and proxy passes to rancher server
33

44
upstream rancherserver {
5-
server rancher:8080;
5+
server ${RANCHER_CONTAINER_NAME}:${RANCHER_PORT};
66
}
77

88
server {

0 commit comments

Comments
 (0)