Last active
August 29, 2015 14:20
-
-
Save ambakshi/95943020acf954350004 to your computer and use it in GitHub Desktop.
RancherOs Enable TLS
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 | |
# | |
# Run from RancherOS, then from client | |
# ssh rancher 'cat tls.tar' | tar xf - -C ~/.docker | |
# | |
# Replace HOSTNAME_TO_USE with how you will address | |
# the docker host. DOCKER_HOST=tcp://somehost:2376 | |
# means HOSTNAME_TO_USE=somehost | |
# | |
# Amit Bakshi | |
# | |
# | |
set -e | |
if [ "$1" = "fuckit" ]; then | |
sudo rancherctl config set user_docker.tls false | |
cat > /tmp/user_docker.yml <<'EOF' | |
user_docker: | |
args: [docker, -d, -s, overlay, -G, docker, -H, 'unix:///var/run/docker.sock','-H=0.0.0.0:2375'] | |
EOF | |
sudo rancherctl config merge < /tmp/user_docker.yml | |
exit $? | |
fi | |
HOSTNAME_TO_USE=${HOSTNAME_TO_USE:-`hostname`} | |
sudo rancherctl config set user_docker.tls true | |
sudo rm -rf /tmp/docker | |
sudo mkdir -p /tmp/docker | |
sudo rancherctl tls generate --hostname ${HOSTNAME_TO_USE} -d /tmp/docker | |
sudo chown -R rancher:rancher /tmp/docker | |
cd /tmp/docker | |
rm -f ~/tls.tar | |
tar cf ~/tls.tar * |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment