From 72c21a98e8d646a43afc362cf04c8903a5cc568d Mon Sep 17 00:00:00 2001 From: Matt Jibson Date: Tue, 18 Aug 2015 13:47:16 -0400 Subject: [PATCH] Add buildman and test to the docker build script --- README.md | 38 ++++++++++++++++++++++++++++++++++++-- dev.df | 2 +- local-docker.sh | 31 +++++++++++++++++++++++++------ 3 files changed, 62 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c395801f4..9768c4656 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,42 @@ The application is implemented as a set of API endpoints written in python and a If you are doing local development on your workstation against the code base follow these instructions. +### Docker + +Quay and its parts can run inside of docker containers. +This method requires no installation of any python packages on your host machine. +The `local-docker.sh` script is provided to prepare and run parts of quay. +First, start redis: + + +``` +docker run -d -p 6379:6379 redis +``` + +And clone the configuration repo: + +``` +git clone git@github.com:coreos-inc/quay-config.git ../quay-config +ln -s ../../quay-config/local conf/stack +``` + +To build and run a docker container, pass one argument to local-docker.sh: + +- `dev`: run quay on port 5000 +- `buildman`: run the buildmanager +- `notifications`: run the notification worker +- `test`: run the unit tests + +For example: + +``` +./local-docker.sh dev +```` + +will start quay in a docker container. +Now quay will be running on: http://127.0.0.1:5000 +The username is `devtable` and the password is `password`. + ### OS X ``` @@ -15,8 +51,6 @@ cd quay ./contrib/osx/local-setup.sh ``` -## Running Development Environment - Now run the server; it will use sqlite as the SQL server. ``` diff --git a/dev.df b/dev.df index f99c4cc61..683018080 100644 --- a/dev.df +++ b/dev.df @@ -18,4 +18,4 @@ RUN venv/bin/pip install -r requirements.txt WORKDIR /src/quay ENV PYTHONPATH=/ -ENV PATH=$PATH:/venv/bin +ENV PATH=/venv/bin:$PATH diff --git a/local-docker.sh b/local-docker.sh index 7dc6d447e..530ff2dae 100755 --- a/local-docker.sh +++ b/local-docker.sh @@ -1,11 +1,30 @@ -#!/bin/sh - -# Run this from the quay directory to start a quay development instance in -# docker on port 5000. +#!/bin/bash set -e REPO=quay.io/quay/quay-dev -docker build -t $REPO -f dev.df . -docker run -it -p 5000:5000 -v $(pwd)/..:/src $REPO bash /src/quay/local-run.sh +d () +{ + docker build -t $REPO -f dev.df . + docker -- run --rm -it --net=host -v $(pwd)/..:/src $REPO $* +} + +case $1 in +buildman) + d /venv/bin/python -m buildman.builder + ;; +dev) + d bash /src/quay/local-run.sh + ;; +notifications) + d /venv/bin/python -m workers.notificationworker + ;; +test) + d bash /src/quay/local-test.sh + ;; +*) + echo "unknown option" + exit 1 + ;; +esac