-
-
Save luckyrat/5d57a1072b8752353ca5b2e9c611c415 to your computer and use it in GitHub Desktop.
Launch a Rancher server with https access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# - You need to set RANCHER_DOMAIN to a domain that reaches this host via port 80 and 443 | |
# - Run this script with sudo/root, | |
# e.g. `source setup-rancher.sh` | |
# - You can then access the Rancher dashboard via https://rancher.example.com | |
# - To add docker hosts to your Rancher environments, | |
# follow the rest of http://docs.rancher.com/rancher/latest/en/quick-start-guide/ | |
# Configure these | |
RANCHER_DOMAIN="$RANCHER_DOMAIN" | |
RANCHER_EMAIL="$RANCHER_EMAIL" | |
CERTS_PATH="$HOME/nginx-proxy-certs" | |
# Setup the nginx vhost proxy | |
# see: https://github.com/jwilder/nginx-proxy | |
docker run --name nginx-proxy-certbot -d --restart=always \ | |
-p 80:80 -p 443:443 \ | |
--name nginx-proxy \ | |
-v ${CERTS_PATH}:/etc/nginx/certs:ro \ | |
-v /etc/nginx/vhost.d \ | |
-v /usr/share/nginx/html \ | |
-v /var/run/docker.sock:/tmp/docker.sock:ro \ | |
jwilder/nginx-proxy | |
# Setup SSL cert auto registration for the vhost proxy | |
# see: https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion | |
docker run --name nginx-proxy-certbot -d --restart=always \ | |
-v ${CERTS_PATH}:/etc/nginx/certs:rw \ | |
--volumes-from nginx-proxy \ | |
-v /var/run/docker.sock:/var/run/docker.sock:ro \ | |
jrcs/letsencrypt-nginx-proxy-companion | |
# Rancher Server | |
# see: http://docs.rancher.com/rancher/latest/en/quick-start-guide/ | |
docker run --name rancher-server -d --restart=always \ | |
-e VIRTUAL_PORT=8080 \ | |
-e VIRTUAL_HOST=$RANCHER_DOMAIN \ | |
-e LETSENCRYPT_HOST=$RANCHER_DOMAIN \ | |
-e LETSENCRYPT_EMAIL=$RANCHER_EMAIL \ | |
rancher/server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment