From 620cf76c588101d92e2f729737d6683450b3e52b Mon Sep 17 00:00:00 2001 From: Brad Ison Date: Tue, 30 Jan 2018 13:44:04 -0500 Subject: [PATCH] Add docker-compose configuration --- .dockerignore | 1 + Dockerfile.dev | 19 +++++++++ README.md | 55 +++++++++++++++++++-------- docker-compose.yaml | 93 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 16 deletions(-) create mode 100644 Dockerfile.dev create mode 100644 docker-compose.yaml diff --git a/.dockerignore b/.dockerignore index 723e64b91..8c062dd20 100644 --- a/.dockerignore +++ b/.dockerignore @@ -28,3 +28,4 @@ __pycache__ static/build/** .gitlab-ci/* .gitlab-ci.* +docker-compose.yaml diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000..03c97ce1a --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,19 @@ +# -*- mode: dockerfile -*- +# vi: set ft=dockerfile : + +FROM quay.io/quay/quay-base:latest + +WORKDIR $QUAYDIR + +COPY requirements.txt requirements-tests.txt ./ + +# Put the virtualenv outside the source directory. This lets us mount +# the Quay source as a volume for local development. +RUN virtualenv --distribute /venv \ + && /venv/bin/pip install -r requirements.txt \ + && /venv/bin/pip install -r requirements-tests.txt \ + && /venv/bin/pip freeze + +ENV PATH /venv/bin:${PATH} + +RUN ln -s $QUAYCONF /conf diff --git a/README.md b/README.md index 633f17cbc..43f1db291 100644 --- a/README.md +++ b/README.md @@ -134,28 +134,51 @@ yarn link typescript * [pyenv](https://github.com/yyuu/pyenv) * [pyenv-virtualenv](https://github.com/yyuu/pyenv-virtualenv) +### Docker Compose + +You'll need Docker and [Docker Compose](https://docs.docker.com/compose) installed. +If you're on macOS, [Docker for Mac](https://www.docker.com/docker-mac) should include +both tools. Otherwise, follow the docs for your platform. + +You'll also need Node.js and NPM if you want to interact with the +frontend code outside a container. + +Finally, you'll need a recent [Go](https://golang.org) version for the +builder. + +To start Quay locally: +```sh +# Clone the various repos you'll need: +git clone https://github.com/coreos-inc/quay.git +git clone https://github.com/coreos-inc/quay-config-local.git +git clone https://github.com/coreos-inc/quay-builder.git + +# Build the builder: +cd quay-builder +make build GOOS=linux + +# Install NPM modules: +cd ../quay +npm install + +# Build or pull images and start all Quay components: +docker-compose up +``` + +#### Third Party Docs + +* [Docker Compose](https://docs.docker.com/compose) +* [Docker for Mac](https://www.docker.com/docker-mac) + ### Linux -Do you use Linux? Send us a PR! +Do you use Linux? Send us a PR! Or use docker-compose! ## Development -### PivotalTracker Integration +### JIRA -Tag a commit with the Tracker Story ID and GitHub automatically comments on your -story with the commit message. - -Add the following at the end of your commit message: - -``` -[(Finishes|Fixes|Delivers) #TRACKER_STORY_ID] -``` - -When you push to GitHub, the post-receive hook will then call back to Tracker -and put a comment on the story with a link to the commit on GitHub. When tagged -with "Finishes", the trigger will also click Finish on the story. - -Reference: PivotalTracker blog - [A Guide to GitHub’s Service Hook for Tracker](https://www.pivotaltracker.com/blog/guide-githubs-service-hook-tracker/) +The Quay backlog can be found in JIRA: https://jira.coreos.com/projects/QUAY ## Running and Testing diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..cbf995948 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,93 @@ +--- +version: '3' + +services: + + web: + build: &BUILD + context: . + dockerfile: Dockerfile.dev + command: gunicorn -c conf/gunicorn_local.py application:application + environment: &ENVIRONMENT + QUAY_OVERRIDE_CONFIG: | + { + "SERVER_HOSTNAME": "localhost:5000", + "DB_URI": "mysql+pymysql://quay:quay@localhost/quay_dev", + "BUILDLOGS_MODULE_AND_CLASS": null, + "BUILDLOGS_OPTIONS": [], + "BUILDLOGS_REDIS": { "host": "localhost" }, + "USER_EVENTS_REDIS": { "host": "localhost" }, + "BUILD_MANAGER": [ + "ephemeral", + { + "ALLOWED_WORKER_COUNT": 1, + "ETCD_HOST": "localhost", + "EXECUTORS": [ + { + "EXECUTOR": "popen" + } + ] + } + ] + } + ports: + - 5000:5000 + network_mode: host + volumes: + - .:/quay-registry + - ../quay-config-local/local:/quay-registry/conf/stack + depends_on: + - mysql + - redis + + webpack: + build: *BUILD + command: npm run watch + environment: *ENVIRONMENT + network_mode: host + volumes: + - .:/quay-registry + - ../quay-config-local/local:/quay-registry/conf/stack + + buildman: + build: *BUILD + command: python -m buildman.builder + environment: *ENVIRONMENT + network_mode: host + volumes: + - .:/quay-registry + - ../quay-config-local/local:/quay-registry/conf/stack + - ../quay-builder/bin/quay-builder:/usr/local/bin/quay-builder + - /var/run/docker.sock:/var/run/docker.sock + depends_on: + - etcd + - redis + + notifications: + build: *BUILD + command: python -m workers.notificationworker.notificationworker + environment: *ENVIRONMENT + network_mode: host + volumes: + - .:/quay-registry + - ../quay-config-local/local:/quay-registry/conf/stack + + mysql: + image: mysql:5.6 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: quay_dev + MYSQL_USER: quay + MYSQL_PASSWORD: quay + network_mode: host + + etcd: + image: quay.io/coreos/etcd:v2.3.8 + environment: + ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 + ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 + network_mode: host + + redis: + image: redis:3.2 + network_mode: host