Merge pull request #2989 from bison/docker-compose

Add docker-compose configuration for dev
This commit is contained in:
Brad Ison 2018-02-06 10:50:36 -05:00 committed by GitHub
commit cc26eefd2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 152 additions and 16 deletions

View File

@ -30,3 +30,4 @@ __pycache__
static/build/**
.gitlab-ci/*
.gitlab-ci.*
docker-compose.yaml

19
Dockerfile.dev Normal file
View File

@ -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

View File

@ -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 GitHubs 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

93
docker-compose.yaml Normal file
View File

@ -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