This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Sida Chen e1651b976e
Merge pull request #3410 from KeyboardNerd/QUAY-1437
Validate service key name using regex
2019-03-14 15:48:11 -04:00
.github feat(.github): add PR template 2017-02-01 15:59:32 -05:00
auth Catch unicode decode errors in auth decode 2018-12-07 16:16:32 -05:00
avatars fix(136521333): Handle None email_or_id in avatar code 2016-12-21 15:00:55 -05:00
buildman Move SSH keys and other config hard-coded config out of the build worker template 2018-09-05 17:36:01 -04:00
buildstatus Adding in UI for cancel anytime. 2016-11-21 10:58:32 -05:00
buildtrigger Move trigger tests into pytest 2018-07-19 11:10:19 -04:00
conf Merge pull request #3320 from thomasmckay/1279-nginx-conf 2019-03-14 12:01:51 -04:00
config_app Merge pull request #3402 from KeyboardNerd/QUAY-1358 2019-03-12 16:24:04 -04:00
data Merge pull request #3402 from KeyboardNerd/QUAY-1358 2019-03-12 16:24:04 -04:00
digest Move digest tools tests to pytest 2018-07-12 15:40:46 +03:00
docs Update the Quay roadmap 2018-07-31 16:33:54 -04:00
emails Implement a worker for batch exporting of usage logs 2018-12-18 15:33:03 -05:00
endpoints Validate service key name on server side 2019-03-14 14:14:16 -04:00
events Add missing build event template 2017-07-25 17:00:07 -04:00
features Disable federated login for new users if user creation is disabled 2017-05-15 15:07:08 -04:00
health Skip the database check filtering if not present, such as on warnings 2019-02-04 16:36:02 -05:00
image Add additional logging information to squashed image exception 2019-03-01 12:53:03 -05:00
notifications Fix test notification data for repo_pull to match actual data 2018-09-12 17:31:07 -04:00
oauth Add ability to configure custom email and username claims 2018-09-12 11:14:23 -04:00
scripts Fix postgres CI test 2019-03-11 14:42:27 -04:00
static Frontend service key name regex check 2019-03-14 14:14:16 -04:00
storage Remove the HEAD check for a file being read in cloud storage 2019-02-18 14:27:28 -05:00
templates Merge pull request #3390 from quay/joseph.schorr/QUAY-1383/change-logo 2019-03-01 11:32:29 -05:00
test Fix old docker client blocked on login issue 2019-03-14 14:08:54 -04:00
tools Remove old audit manifests tool 2018-08-06 13:01:11 -04:00
util Validate service key name on server side 2019-03-14 14:14:16 -04:00
workers Merge pull request #3315 from quay/joseph.schorr/QUAY-1266/manifestlist-validation 2019-02-27 18:32:21 -05:00
.coverage.dockerfile add coverage report 2017-07-27 12:12:56 +02:00
.dockerignore Add an end-to-end test suite for different versions of Docker 2018-09-25 14:33:30 -04:00
.gitignore Add an end-to-end test suite for different versions of Docker 2018-09-25 14:33:30 -04:00
.style.yapf Update yapf 2017-04-08 09:25:09 +02:00
.travis.yml Add test for certs_install script 2018-08-24 11:04:13 -04:00
CHANGELOG.md 1166 - 'Quay Enterprise' to 'Red Hat Quay' 2019-02-25 18:27:11 -05:00
Dockerfile Fix python license checking and uninstall docutils on build 2019-02-12 12:50:35 -05:00
Dockerfile.dev Add docker-compose configuration 2018-02-05 12:03:50 -05:00
MAINTAINERS MAINTAINERS: init owners to subpkgs 2017-01-23 17:46:34 -05:00
Makefile Add test for certs_install script 2018-08-24 11:04:13 -04:00
Procfile Run gunicorn and webpack through Procfile 2016-10-20 13:50:57 -04:00
README.md 1166 - 'Quay Enterprise' to 'Red Hat Quay' 2019-02-25 18:27:11 -05:00
_init.py Move config provider to _init to decouple from app 2018-05-25 11:15:06 -04:00
alembic.ini Print the time when logging from migrations 2015-11-09 22:29:17 -05:00
app.py Add ability for proportional rollout of the OCI data model 2019-02-18 16:34:43 -05:00
application.py Add log JSON formatter 2017-06-07 00:02:52 +02:00
bill-of-materials.json Update bill-of-materials 2018-10-30 09:53:03 -04:00
boot.py Add metrics for tracking when instance key renewal succeeds and fails, as well as when instance key *lookup* fails 2018-02-02 11:14:42 -05:00
build.sh Update build.sh to work with GIT_HEAD 2015-11-04 16:55:34 -05:00
config.py Add ability to restrict V1 push behind a namespace whitelist 2019-03-05 17:33:32 -05:00
dev.df Refactor prometheus integration 2016-07-01 14:16:50 -04:00
displayversion.py Add version information to Quay on startup 2018-05-31 17:01:09 -04:00
docker-compose.yaml Add docker-compose configuration 2018-02-05 12:03:50 -05:00
external_libraries.py Add automatic retry to external lib downloader 2019-02-26 16:21:24 -05:00
initdb.py Interface out all action log data model operations 2019-01-25 15:52:22 -05:00
karma.conf.js Add --no-sandbox flag to Karma test 2017-11-30 11:57:51 -05:00
local-config-app.sh Make script paths work in docker and locally for config_app 2018-06-12 14:45:00 -04:00
local-docker.sh local-docker.sh now accepts env vars 2016-07-08 15:50:51 -04:00
local-run.sh Add version information to Quay on startup 2018-05-31 17:01:09 -04:00
loghandler.py Add log JSON formatter 2017-06-07 00:02:52 +02:00
package.json Make script paths work in docker and locally for config_app 2018-06-12 14:45:00 -04:00
path_converters.py update(security_test.py): moving tests to new framework 2017-02-02 13:40:00 -05:00
pylintrc database: initial manifestlist schema changes 2016-09-26 14:47:06 -04:00
quay-base.dockerfile 1311 - remove buildmanager monit 2019-02-01 12:59:18 -05:00
quay-entrypoint.sh Sets up nginx on image for config app with ssl 2018-06-13 14:29:11 -04:00
registry.py Use $QUAYPATH and $QUAYDIR in conf and init files 2017-07-05 16:23:54 +02:00
release.py superuser: add storage replication config 2015-11-09 17:34:22 -05:00
requirements-dev.txt Generate .gitlab.yaml via .gitlab.jsonnet 2017-06-15 14:16:00 +02:00
requirements-nover.txt Implement logs model using Elasticsearch 2019-02-12 16:33:42 -05:00
requirements-tests.txt Add Travis CI build configuration 2018-06-05 13:12:21 -04:00
requirements.txt Implement logs model using Elasticsearch 2019-02-12 16:33:42 -05:00
secscan.py Use $QUAYPATH and $QUAYDIR in conf and init files 2017-07-05 16:23:54 +02:00
setup.cfg add coverage report 2017-07-27 12:12:56 +02:00
tox.ini Switch to use the new registry tests suite 2018-05-22 17:06:41 -04:00
tsconfig.json added TSLint for TypeScript code style checking, fixed associated errors 2017-06-27 11:37:13 -07:00
tslint.json added TSLint for TypeScript code style checking, fixed associated errors 2017-06-27 11:37:13 -07:00
verbs.py Use $QUAYPATH and $QUAYDIR in conf and init files 2017-07-05 16:23:54 +02:00
web.py Create webpack config for config app 2018-06-12 14:44:15 -04:00
webpack.config.js Create webpack config for config app 2018-06-12 14:44:15 -04:00
yarn.lock Change from manual URL construction to using a lib 2018-05-22 13:10:09 -04:00

README.md

quay

Build Status Docker Repository on Quay

⚠️ The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order to get stable binaries.

Quay Logo

Quay is project to build, store, and distribute container images.

High-level features include:

Table of Contents

  1. Getting Started
  2. macOS
  3. Linux
  4. Development
  5. PivotalTracker Integration
  6. Running and Testing
  7. Test Data
  8. Local Scripts
  9. Development inside Docker
  10. Adding a Python Dependency
  11. Adding a Yarn Dependency
  12. Running the Build System
  13. To run individual tests 1. Pytest 2. Tox
  14. Running Migrations
  15. How to run a build with tests for a push or merge
  16. Documentation
  17. Architecture at a Glance
  18. Terminology 1. Organizations 2. Concepts 3. Software

Getting Started

macOS

macOS developers will need:

# Download the code
git clone git@github.com:coreos-inc/quay.git && cd quay

# Install the system dependencies
brew install libevent libmagic postgresql gpgme pyenv pyenv-virtualenv node yarn

# Create a default virtualmachine for docker
docker-machine create -d virtualbox default

# Add these to ~/.bashrc or ~/.zshrc
eval "$(pyenv virtualenv-init -)"
eval "$(pyenv init -)"
eval $(/usr/local/bin/docker-machine env default)
export PYTHONPATH="."

# Some installs don't have /usr/include, required for finding SASL header files
# This command might fail because of the rootfs is read-only. Refer to the following:
# http://apple.stackexchange.com/questions/196224/unix-ln-s-command-not-permitted-in-osx-el-capitan-beta3
if [ ! -e /usr/include ]; then sudo ln -s `xcrun --show-sdk-path`/usr/include /usr/include; fi

# Install the Python dependencies
pyenv install 2.7.12
pyenv virtualenv 2.7.12 quay
pyenv activate quay
pyenv local quay

# Some packages may fail to build with clang (which now defaults to C11).
# If you're getting errors trying running again with CFLAGS='std=c99'.
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-test.txt

# Setup a local config
git clone git@github.com:quay/quay-config-local.git ../quay-config
ln -s ../../quay-config/local conf/stack

# Install Node Dependencies
yarn install

# Link Typescript
yarn link typescript

# Download external libraries
mkdir static/fonts static/ldn
python external_libraries.py

Third Party Docs

Docker Compose

You'll need Docker and Docker Compose installed. If you're on macOS, Docker for 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 version for the builder.

To start Quay locally:

# 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

Linux

Do you use Linux? Send us a PR! Or use docker-compose!

Development

JIRA

The Quay backlog can be found in JIRA: https://jira.coreos.com/projects/QUAY

Running and Testing

Test Data

A SQLite database full of test data is committed to this git repository at test/data/test.db. This database is generated by executing python initdb.py. The username and password of the admin test account is devtable and password, respectively.

Local Scripts

Running the web server locally requires goreman:

go get github.com/mattn/goreman
  • local-run runs the web server for testing
  • local-test runs the unit test suite
  • yarn run build builds front-end dependencies
  • yarn run watch builds and watches front-end dependencies
  • yarn test runs front-end test suite

Development inside Docker

To build and run a development container, pass one argument to local-docker.sh:

  • buildman: run the buildmanager
  • dev: run web server on port 5000
  • initdb: clear and initialize the test database
  • notifications: run the notification worker
  • test: run the unit test suite

Adding a Python Dependency

# Create a new virtualenv and activate it
pyenv virtualenv 2.7.12 quay-deps
pyenv activate quay-deps

# Install unversioned dependencies with your changes
pip install -r requirements-nover.txt

# Run the unit test suite
./local-test.sh

# Freeze the versions of all of the dependencies
pip freeze > requirements.txt

# Delete the virtualenv
pyenv uninstall quay-deps

Adding a Yarn Dependency

We use Yarn for frontend dependency management. The yarn.lock file ensures that we get consistant version installs using the yarn install command. However, new dependencies should be added using yarn add <npm package>. This will add an entry to package.json and yarn.lock.

Occassionally there will be merge conflicts with yarn.lock. To resolve them, use the following (taken from here).

git rebase origin/master
git checkout origin/master -- yarn.lock
yarn install
git add yarn.lock
git rebase --continue

Running the Build System

TODO

# Run an instance of redis
docker run -d -p 6379:6379 quay.io/quay/redis

To run individual tests

# To run a specific suite
TEST=true python -m test.test_api_usage -f

# To run a specific test in a suite
TEST=true python -m test.test_api_usage -f SuiteName

Pytest

# To run all tests
TEST=true PYTHONPATH="." py.test --verbose

# To run a specific test module
TEST=true PYTHONPATH="." py.test --verbose test/registry/registry_tests.py

# To run a specific test unique test
TEST=true PYTHONPATH="." py.test --verbose test/test_api_usage.py::TestDeleteNamespace

# To retry only last failed (--lf):
TEST=true PYTHONPATH="." py.test --verbose --lf

# To start pdb on failure:
TEST=true PYTHONPATH="." py.test --verbose --pdb

# To run a coverage report (html pages in ./htmlcov):
TEST=true PYTHONPATH="." py.test --cov="." --cov-report=html --cov-report=term-missing  --cov-config=.coverage.ini --verbose

# Don't capture stdout (-s)
TEST=true PYTHONPATH="." py.test --verbose -s

Tox

To create a virtualenv to run the tests. It allows to test the code on multiple env like python2.x and python3.x or different library versions

# Test all tox env:
tox

# Add extra parameters to the pytest command:
# tox -- [pytest ARGS]
tox -- -x

# build a single env with -e:
tox -e py27-api

Running migrations

# To create a new migration with this description.
# Note there might be some errors about unique id being to long
# That's okay as long as the migration file is created
./data/migrations/migration.sh "Description goes here"

# To test the up and down of the migration
./data/migrations/migration.sh # without params

# Migrations get run when you create a docker image or you can run them
# manually with the following command.
PYTHONPATH=. alembic upgrade head

# You can also rebuild your local sqlite db image from initdb.py using
# And once you have a migration you should do this and check in the
# changes to share your migration with others.
rm test/data/test.db
python initdb.py

Running tests for migrations

Use AWS/RDS to create a test image. To create a new database from a snapshot to test against see this.

Then point the migrations to the new instance using quay-config/local/config.yaml

Remember to run this from the root of the quay directory and to set your python environment first.

PYTHONPATH=. alembic upgrade head

How to run a build with tests for a push or merge

# Inside the quay directory.
export QUAY_TAG=quay.io/quay/quay:localtest
docker build -t $QUAY_TAG --build-arg RUN_TESTS=true .

Documentation

Architecture at a Glance

Terminology

Organizations

  • AppC: a standards body responsible for a Runtime and Image Format superseded by the Open Container Initiative
  • Open Container Initiative: a standards body responsible for a Runtime specification and an Image Format
  • Docker: a company that builds a platform that has its own Image Formats, Build System, Container Runtime, and Container Orchestration

Concepts

  • Image: an archive containing all of the contents necessary to execute a container
  • Image Format: a specification for the structure of an Image
  • Image Layer: an Image that may depend on being applied to other Images to generate a final Image
  • Image Squashing: the process of compressing an Image into a single Layer
  • Manifest: a text file containing metadata for a particular Image
  • Tag: a human-friendly named, mutable pointer to a particular set of Images
  • Build System: a program used to generate Images
  • Registry: a program that speaks one or more standard protocols to store and receive Images
  • Repository: a collection of related Tags organized by a Registry
  • Push: the act of uploading an Image to a Registry
  • Pull: the act of downloading an Image from a Registry
  • Container: an Image and its execution environment
  • Container Runtime: a program that can transform an Image into a Container by executing it
  • Container Orchestration: a program or set of programs that provides a framework for deploying Containers

Software

  • Quay.io: CoreOS's hosted Registry
  • Quay: CoreOS's enterprise-grade Registry product
  • quayctl: an open source program that implements alternative methods for pulling Images from Quay
  • Clair: an open source static analysis tool used to detect vulnerability in Images
  • Quay Security Scanning: the integration between Clair and Quay
  • Kubernetes: an open source program implementing Container Orchestration
  • Docker Hub: Docker's hosted Registry
  • Docker Trusted Registry: Docker's enterprise-grade Registry product
  • Notary: an open source implementation of the TUF protocol used in Docker Content Trust
  • Docker Content Trust: the integration between Notary and Docker Trusted Registry
  • Docker Engine: a program used to interact with all aspects of the Docker platform
  • Swarm: a program implementing Container Orchestration for the Docker platform