Skip to content

Commit

Permalink
add tests for services; fix some ipfs funkiness; fix data_container m…
Browse files Browse the repository at this point in the history
…arshaling
  • Loading branch information
Casey Kuhlman committed Aug 19, 2015
1 parent 44f9521 commit 1f69c07
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 28 deletions.
66 changes: 60 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,64 @@
FROM eris/base:latest
# NOTE => this dockerfile is used **ONLY** for testing
# please do not use this dockerfile for anything other
# than sandboxed testing of the cli
FROM ubuntu:14.04
MAINTAINER Eris Industries <[email protected]>

ENV source $GOPATH/src/github.com/eris-ltd/eris-cli
COPY . $source
WORKDIR $source/cmd/eris
RUN go install
ENV DEBIAN_FRONTEND noninteractive

USER $USER
# DEPS
RUN apt-get update && apt-get install -y \
curl wget gcc libc6-dev make ca-certificates \
lxc apt-transport-https supervisor \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# GOLANG
ENV GOLANG_VERSION 1.4.2

RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
| tar -v -C /usr/src -xz

RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1

ENV PATH /usr/src/go/bin:$PATH

RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
WORKDIR /go

RUN curl -sSL -o /usr/local/bin/go-wrapper https://raw.githubusercontent.com/docker-library/golang/master/1.4/wheezy/go-wrapper
RUN chmod +x /usr/local/bin/go-wrapper

# DOCKER
RUN mkdir -p /var/log/supervisor
RUN mkdir -p /var/log/docker
COPY ./specs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 \
&& apt-get update -qq \
&& apt-get install -qqy lxc-docker

RUN curl -sSL -o /usr/local/bin/wrapdocker https://raw.githubusercontent.com/jpetazzo/dind/master/wrapdocker
RUN chmod +x /usr/local/bin/wrapdocker

# SETUP USER
ENV USER eris
RUN groupadd --system $USER && \
useradd --system --create-home --uid 1000 --gid $USER $USER && \
usermod -a -G docker $USER

RUN mkdir /home/$USER/.eris
RUN chown --recursive $USER /home/$USER/.eris

# INSTALL CLI
RUN mkdir --parents /go/src/github.com/eris-ltd/eris-cli
COPY . /go/src/github.com/eris-ltd/eris-cli/
RUN cd /go/src/github.com/eris-ltd/eris-cli/cmd/eris && go install

COPY ./specs/test.sh /home/$USER/
WORKDIR /home/$USER

# CMD eris agent
13 changes: 13 additions & 0 deletions agent/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[supervisord]
user=root
nodaemon=true

[program:docker]
user=root
autostart=true
autorestart=true
command=/usr/local/bin/wrapdocker
redirect_stderr=true
stdout_logfile=/var/log/docker/%(program_name)s.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=10
12 changes: 7 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
machine:
services:
- docker

post:
- rm -rf ${GOPATH%%:*}/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
- mkdir -p ${GOPATH%%:*}/src/github.com/${CIRCLE_PROJECT_USERNAME}
Expand All @@ -10,12 +7,17 @@ machine:
- git config --global user.name "Billings the Bot"

dependencies:
post:
pre:
- sudo curl -L -o /usr/bin/docker 'http://s3-external-1.amazonaws.com/circle-downloads/docker-1.6.0-circleci'; chmod 0755 /usr/bin/docker; true
- sudo service docker start

override:
- "cd ${GOPATH%%:*}/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/cmd/eris && go install"

test:
override:
- specs/test.sh
- specs/test.sh:
timeout: 1800

deployment:
master:
Expand Down
2 changes: 1 addition & 1 deletion definitions/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Service struct {
// TODO: harmonize with services_definition_spec.md
Name string `json:"name,omitempty" yaml:"name,omitempty" toml:"name,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty" toml:"image,omitempty"`
AutoData bool `json:"data_container" yaml:"data_container" toml:"data_container`
AutoData bool `json:"data_container" yaml:"data_container" toml:"data_container"`
Command string `json:"command,omitempty" yaml:"command,omitempty" toml:"command,omitempty"`
ServiceDeps []string `mapstructure:"services" json:"services,omitempty", yaml:"services,omitempty" toml:"services,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty" toml:"labels,omitempty"`
Expand Down
Loading

0 comments on commit 1f69c07

Please sign in to comment.