Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Running a Rancher Server

docker pull rancher/server && docker run -d --restart=always -p 8080:8080 rancher/server

I used a coreos machine to have docker installed already, I used https://coreos.com/docs/cluster-management/setup/switching-channels/ to help me update it to a new version.

Running a Rancher Agent on a Host

sudo docker run -e CATTLE_AGENT_IP=IP_OF_HOST -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.7.8 HOST_URL /v1/scripts/23FBC72A18294F01194B:1432918800000:RANCHER_TOKEN

cattle_agent_ip is only required if your running the agent on the same host as the rancher server, the docker run command is generated from the rancher gui under add custom host.

Container Linking

"instanceLinks":{"embeder_app":"ID_OF_CONTAINER"}

Start Embeder

curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"name":"embeder_app","description":"embeder application","hostname":"embeder_app","imageUuid":"docker:quay.io/bleacherreport/embeder:br-develop-27a6816","ports":["3002:4001/tcp"],"environment":{"EMBEDLY_API_KEY":"","INSTAGRAM_TOKEN":""},"tty":true}' \
'$HOST_URL/v1/projects/1a5/containers/'

Start Djay

USE ID FROM EMBED RESPONSE TO FILL IN THE "instanceLinks" field

curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"count":1, "description":"djay_app", "hostname":"djay_app", "imageUuid":"docker:bleacher/djay:br-master-1fd5817", "name":"djay_app", "ports":["3001:4000/tcp"], "environment":{"DJAY_HOST":"djay_app:4000", "EMBED_HOST":"embeder_app:4001", "MIX_ENV":"prod","PSQL_URL":"","RABBITMQ_URL":"", "ROLE":"app"},"tty":true,"instanceLinks":{"embeder_app":"1i87"}}' \
'$HOST_URL/v1/projects/1a5/containers/'

Start Carburetor

curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"count":1, "description":"carburetor application", "hostname":"carburetor_app", "imageUuid":"docker:bleacher/carburetor:br-master-22ce52f", "name":"carburetor_app", "networkIds":["1n2"],"ports":["3000:4000/tcp"],"environment":{"BR_PLAYLISTS_DOMAIN":"djay_app:4000", "INSTAGRAM_ACCESS_TOKEN":"","BR_API_DOMAIN":"", "MIX_ENV":"dev", "TWITTER_CONSUMER_KEY":"", "TWITTER_CONSUMER_SECRET":"", "TWITTER_TOKEN":"", "TWITTER_SECRET_TOKEN":"","ROLE":"app"},"tty":true,"instanceLinks":{"djay_app":"1i78"}}' \
'$HOST_URL/v1/projects/1a5/containers/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment