Skip to content

Instantly share code, notes, and snippets.

@nevalla
Last active May 28, 2016 11:34
Show Gist options
  • Save nevalla/c4b3362623c0e3e9f03d3122e530a4ff to your computer and use it in GitHub Desktop.
Save nevalla/c4b3362623c0e3e9f03d3122e530a4ff to your computer and use it in GitHub Desktop.
# Install Kontena master
# HA-proxy
# If you have SSL certificate
SSL_CERT="/path/to/cerf_file"
SSL_CERT=$(awk 1 ORS='\\n' $SSL_CERT)
# else
SSL_CERT="**None**"
docker run --name=kontena-server-haproxy \
--link kontena-server-api:kontena-server-api \
-e SSL_CERT="$SSL_CERT" \
-p 80:80 -p 443:443 -d kontena/haproxy:latest
# MongoDB data container
docker create --name=kontena-server-mongo-data mongo:3.0
# MongoDB container
docker run --name=kontena-server-mongo \
--volumes-from=kontena-server-mongo-data \
-d mongo:3.0 mongod --smallfiles
# Kontena Master
export KONTENA_VAULT_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
export KONTENA_VAULT_IV=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
docker run --name kontena-server-api \
--link kontena-server-mongo:mongodb \
-e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
-e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
-d kontena/server:latest
# Kontena Agent
export KONTENA_URI="wss://<master_uri>" # or ws:// if no SSL certificate
export KONTENA_TOKEN="<grid_token>"
export KONTENA_PEER_INTERFACE=eth1 # change this if using other interface
export KONTENA_VERSION=latest
# add docker0 interface ip as first nameserver on /etc/resolv.conf
# for example:
# nameserver 172.17.43.1
docker run --name kontena-agent \
-e KONTENA_URI=${KONTENA_URI} \
-e KONTENA_TOKEN=${KONTENA_TOKEN} \
-e KONTENA_PEER_INTERFACE=${KONTENA_PEER_INTERFACE} \
-v=/var/run/docker.sock:/var/run/docker.sock \
-v=/etc/kontena-agent.env:/etc/kontena.env \
--net=host \
-d kontena/agent:${KONTENA_VERSION}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment