Skip to content

Instantly share code, notes, and snippets.

@neeravkumar
Created October 16, 2014 03:35
Show Gist options
  • Save neeravkumar/2e7ab078afa98c33d696 to your computer and use it in GitHub Desktop.
Save neeravkumar/2e7ab078afa98c33d696 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Docker Ecosystem</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
@import url(http://fonts.googleapis.com/css?family=Neuton);
@import url(http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Neuton';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<textarea id="source">
class: center, middle
# Docker Ecosystem - problems faced while deploying and solutions
---
# Docker at Viki
- ### All our systems now run under docker.
- ### Any new services that come up, have to be made in Docker.
- ### We have made our own deploy tools around it in python.
- ### We are moving towards service discovery within Docker.
---
# Problems - a lot of problems!
1. ### Push and Pull are slow!
2. ### Service discovery is bad(Links, Ambassador).
3. ### No good way to pass dynamic configuration variables(ENV everything!).
---
# Solution for #1:
![Solution #1](http://v1.memecaptain.com/11945a.jpg)
---
## A heavy base image
### Install as many common packages as you can in the base image that your developers might use.
### Make base image the parent for all the app dockerfiles to encourage layer reuse.
### A good starting point would be
### https://github.com/phusion/baseimage-docker
### if you are just starting out.
---
# Chain your commands
```bash
FROM debian:wheezy
WORKDIR /tmp
RUN wget -nv http://viki.com/someutility-v1.0.0.tar.gz
RUN tar -xvf someutility-v1.0.0.tar.gz
RUN mv /tmp/someutility-v1.0.0/someutil /usr/bin/someutil
RUN rm -rf /tmp/someutility-v1.0.0
RUN rm /tmp/someutility-v1.0.0.tar.gz
```
#### becomes
```bash
FROM debian:wheezy
RUN cd /tmp &&\
wget -nv http://viki.com/someutility-v1.0.0.tar.gz &&\
tar -xvf someutility-v1.0.0.tar.gz &&\
mv /tmp/someutility-v1.0.0/someutil /usr/bin/someutil &&\
rm -rf /tmp/someutility-v1.0.0 &&\
rm /tmp/someutility-v1.0.0.tar.gz
```
---
# Solution for #2:
![Solution #2](http://v1.memecaptain.com/60dae7.jpg)
---
### 1. Currenly, we use HAproxy + DNS as a very primitive service discovery system,
### 2. We configure Docker to use a DNS server which we setup on all the hosts that points *.local to haproxy.
### 3. Haproxy based on vhosts and ports redirects traffic to the correct services.
### 4. We are evaluating Consul[https://consul.io] to do this right now.
---
# Solution for #3:
![Solution #3](http://v1.memecaptain.com/25d6f9.jpg)
---
### 1. Currently, we are using envoirnment variables that we pass during deployment for passing config variables to Docker.
### 2. We use envsubst(https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html)
#### which when passed a file containing $VARIABLE, replaces it with the value of VARIABLE in environment,
### 3. We are slowly moving this to consul also since its a distributed key-value store also.
---
# Facebook Group: https://www.facebook.com/groups/dockersg/
---
# Thanks and also we are hiring, http://www.viki.com/jobs
</textarea>
<script src="http://gnab.github.io/remark/downloads/remark-0.7.0.min.js" type="text/javascript">
</script>
<script type="text/javascript">
var slideshow = remark.create();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment