Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

14.04 support #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.deb
Dockerfile-*
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM ubuntu:12.04
FROM ubuntu:__UBUNTU_RELEASE__
MAINTAINER Brian Morton "bmorton@yammer-inc.com"

ENV MCROUTER_VERSION 0.15
ENV MCROUTER_SHA f1f40cc225a56369f14d3b5f39ef5d4f122dda3f
ENV MCROUTER_VERSION __MCROUTER_VERSION__
ENV MCROUTER_SHA __MCROUTER_SHA__
ENV UBUNTU_RELEASE __UBUNTU_RELEASE__

# Install tools needed by install scripts below
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Expand All @@ -16,9 +17,10 @@ RUN curl -L https://github.com/facebook/mcrouter/archive/${MCROUTER_SHA}.tar.gz
WORKDIR /tmp/mcrouter-${MCROUTER_SHA}/mcrouter
ENV LDFLAGS -Wl,-rpath=/usr/local/lib/mcrouter/
ENV LD_LIBRARY_PATH /usr/local/lib/mcrouter/
RUN mkdir /tmp/mcrouter-build && ./scripts/install_ubuntu_12.04.sh /tmp/mcrouter-build
RUN mkdir /tmp/mcrouter-build && ./scripts/install_ubuntu_${UBUNTU_RELEASE}.sh /tmp/mcrouter-build

# Install Ruby so we can install fpm for building the Debian package
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:brightbox/ruby-ng
RUN apt-get -y update && apt-get -y install ruby2.1 ruby2.1-dev
RUN echo "gem: --no-ri --no-rdoc" > ~/.gemrc
Expand Down
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
VERSION = `grep "ENV MCROUTER_VERSION" Dockerfile | cut -f3 -d' '`
SHA = `grep "ENV MCROUTER_SHA" Dockerfile | cut -f3 -d' '`
UBUNTU_RELEASE = "14.04"
MCROUTER_VERSION = $(shell git ls-remote --tags https://github.com/facebook/mcrouter.git | sort -t '/' -k 3 -V | tail -n1 | awk '{print $$1}')
MCROUTER_SHA = $(shell git ls-remote --tags https://github.com/facebook/mcrouter.git | sort -t '/' -k 3 -V | tail -n1 | awk '{print $$2}' | awk -F\/ '{print $$3}')

.PHONY: all build cp

all: build cp

build:
docker build -t mcrouter .
sed "s/__UBUNTU_RELEASE__/${UBUNTU_RELEASE}/g" Dockerfile > Dockerfile-${UBUNTU_RELEASE}
sed -i "s/__MCROUTER_VERSION__/${MCROUTER_VERSION}/g" Dockerfile-${UBUNTU_RELEASE}
sed -i "s/__MCROUTER_SHA__/${MCROUTER_SHA}/g" Dockerfile-${UBUNTU_RELEASE}
docker build -t mcrouter -f Dockerfile-${UBUNTU_RELEASE} .

cp:
docker create --name=mcrouter-build mcrouter && docker cp mcrouter-build:/tmp/mcrouter-build/install/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb . && docker rm -f mcrouter-build
mkdir -p ./${UBUNTU_RELEASE}
docker create --name=mcrouter-build mcrouter && docker cp mcrouter-build:/tmp/mcrouter-build/install/yammer-mcrouter_${MCROUTER_VERSION}-${MCROUTER_SHA}_amd64.deb . && docker rm -f mcrouter-build

test:
docker run -ti --rm -v `pwd`:/opt/mcrouter-build ubuntu:12.04 sh -c "dpkg -i /opt/mcrouter-build/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb; mcrouter --version; /bin/bash"
docker run -ti --rm -v `pwd`:/opt/mcrouter-build ubuntu:${UBUNTU_RELEASE} sh -c "dpkg -i /opt/mcrouter-build/yammer-mcrouter_${MCROUTER_VERSION}-${MCROUTER_SHA}_amd64.deb; mcrouter --version; /bin/bash"

clean:
rm -f Dockerfile-*
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mcrouter package builder

This `Dockerfile` will create a `.deb` package for [mcrouter](https://github.com/facebook/mcrouter) for use on Ubuntu 12.04. Yammer uses this package to deploy mcrouter to its production environments.
This `Dockerfile` will create a `.deb` package for [mcrouter](https://github.com/facebook/mcrouter) for use on Ubuntu 12.04 or 14.04. Yammer uses this package to deploy mcrouter to its production environments.


## Building
Expand All @@ -10,12 +10,12 @@ To build and copy the package to your local filesystem, run `make`.

## Testing package

To start up a new 12.04 Docker container with the built package installed, run `make test`.
To start up a new 12.04 or 14.04 Docker container with the built package installed, edit
the `UBUNTU_RELEASE` variable at the top of the Makefile and run `make test`.


## Updating

For updating to a new version of mcrouter, update the `MCROUTER_VERSION` and
`MCROUTER_SHA` environment variables in the `Dockerfile`. You'll probably have
to update the `FOLLY_SHA` variable as well since mcrouter usually depends on the
latest version of Folly.
`MCROUTER_SHA` environment variables in the `Dockerfile`. This will default to the latest
release tag, but you can replace that with a specific commit hash if you need to.