README: update mac instructions

also some misc cleanup
This commit is contained in:
Jimmy Zelinskie 2017-01-23 15:44:53 -05:00
parent 28813159e5
commit 125c03ab68

View file

@ -68,7 +68,6 @@ High-level features include:
2. [Concepts](#concepts) 2. [Concepts](#concepts)
3. [Software](#software) 3. [Software](#software)
## Getting Started ## Getting Started
### macOS ### macOS
@ -82,36 +81,37 @@ macOS developers will need:
[xcode]: https://developer.apple.com/downloads [xcode]: https://developer.apple.com/downloads
[brew]: https://github.com/Homebrew/brew [brew]: https://github.com/Homebrew/brew
``` ```sh
# Download the code # Download the code
git clone git@github.com:coreos-inc/quay.git && cd quay git clone git@github.com:coreos-inc/quay.git && cd quay
# Install the system dependencies # Install the system dependencies
brew install libevent libmagic postgresql gpgme pyenv pyenv-virtualenv docker docker-machine node brew install libevent libmagic postgresql gpgme pyenv pyenv-virtualenv pyenv-pip-rehash docker docker-machine node
# create a default virtualmachine for docker # Create a default virtualmachine for docker
docker-machine create -d virtualbox default docker-machine create -d virtualbox default
# setup brew dependencies # Add these to ~/.bashrc or ~/.zshrc
# note you may want to add these to your bashrc or zshrc file
eval "$(pyenv virtualenv-init -)" eval "$(pyenv virtualenv-init -)"
eval "$(pyenv init -)" eval "$(pyenv init -)"
eval $(/usr/local/bin/docker-machine env default) eval $(/usr/local/bin/docker-machine env default)
# Some installs don't have /usr/include, required for finding SASL header files # 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 # http://apple.stackexchange.com/questions/196224/unix-ln-s-command-not-permitted-in-osx-el-capitan-beta3
# note this command might fail because of new OSx write protections here above is a link that explains
# how to fix that
if [ ! -e /usr/include ]; then sudo ln -s `xcrun --show-sdk-path`/usr/include /usr/include; fi if [ ! -e /usr/include ]; then sudo ln -s `xcrun --show-sdk-path`/usr/include /usr/include; fi
# Install the Python dependencies # Install the Python dependencies
pyenv install 2.7.11 pyenv install 2.7.12
pyenv virtualenv 2.7.11 quay pyenv virtualenv 2.7.12 quay
pyenv activate quay pyenv activate quay
pyenv local quay
# Some packages may fail to build with clang (which now defaults to C11). # Some packages may fail to build with clang (which now defaults to C11).
CFLAGS='-std=c99' pip install -r requirements.txt # 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-dev.txt
pip install -r requirements-test.txt
# Setup a local config # Setup a local config
git clone git@github.com:coreos-inc/quay-config.git ../quay-config git clone git@github.com:coreos-inc/quay-config.git ../quay-config
@ -124,18 +124,16 @@ npm install
npm link typescript npm link typescript
``` ```
#### Useful docs #### Third Party Docs
* [docker](https://beta.docker.com/docs/mac/getting-started://beta.docker.com/docs/mac/getting-started) * [docker](https://beta.docker.com/docs/mac/getting-started)
* [docker-machine](https://docs.docker.com/machine/install-machine://docs.docker.com/machine/install-machine) * [docker-machine](https://docs.docker.com/machine/install-machine)
* [pyenv](https://github.com/yyuu/pyenv) * [pyenv](https://github.com/yyuu/pyenv)
* [pyenv-virtualenv](https://github.com/yyuu/pyenv-virtualenv) * [pyenv-virtualenv](https://github.com/yyuu/pyenv-virtualenv)
### Linux ### Linux
TODO Do you use Linux? Send us a PR!
## Development ## Development
@ -156,7 +154,6 @@ 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/) Reference: PivotalTracker blog - [A Guide to GitHubs Service Hook for Tracker](https://www.pivotaltracker.com/blog/guide-githubs-service-hook-tracker/)
## Running and Testing ## Running and Testing
### Test Data ### Test Data
@ -169,7 +166,7 @@ The username and password of the admin test account is `devtable` and `password`
Running the web server locally requires [goreman](https://github.com/mattn/goreman): Running the web server locally requires [goreman](https://github.com/mattn/goreman):
``` ```sh
go get github.com/mattn/goreman go get github.com/mattn/goreman
``` ```
@ -190,7 +187,7 @@ To build and run a development container, pass one argument to [local-docker.sh]
### Adding a Python Dependency ### Adding a Python Dependency
``` ```sh
# Create a new virtualenv and activate it # Create a new virtualenv and activate it
pyenv virtualenv 2.7.11 quay-deps pyenv virtualenv 2.7.11 quay-deps
pyenv activate quay-deps pyenv activate quay-deps
@ -203,20 +200,23 @@ pip install -r requirements-nover.txt
# Freeze the versions of all of the dependencies # Freeze the versions of all of the dependencies
pip freeze > requirements.txt pip freeze > requirements.txt
# Delete the virtualenv
pyenv uninstall quay-deps
``` ```
### Running the Build System ### Running the Build System
TODO TODO
``` ```sh
# Run an instance of redis # Run an instance of redis
docker run -d -p 6379:6379 quay.io/quay/redis docker run -d -p 6379:6379 quay.io/quay/redis
``` ```
### To run individual tests ### To run individual tests
``` ```sh
# To run a specific suite # To run a specific suite
TEST=true python -m test.test_api_usage -f TEST=true python -m test.test_api_usage -f
@ -225,7 +225,7 @@ TEST=true python -m test.test_api_usage -f SuiteName
``` ```
#### Pytest #### Pytest
``` ```sh
# To run all tests # To run all tests
TEST=true PYTHONPATH="." py.test --verbose TEST=true PYTHONPATH="." py.test --verbose
@ -246,14 +246,14 @@ TEST=true PYTHONPATH="." py.test --cov="." --cov-report=html --cov-report=term-m
# Don't capture stdout (-s) # Don't capture stdout (-s)
TEST=true PYTHONPATH="." py.test --verbose -s TEST=true PYTHONPATH="." py.test --verbose -s
``` ```
#### Tox #### Tox
To create a virtualenv to run the tests. 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 It allows to test the code on multiple env like python2.x and python3.x or different library versions
``` ```sh
# Test all tox env: # Test all tox env:
tox tox
@ -267,7 +267,7 @@ tox -e py27-api
### Running migrations ### Running migrations
``` ```sh
# To create a new migration with this description. # To create a new migration with this description.
# Note there might be some errors about unique id being to long # Note there might be some errors about unique id being to long
# That's okay as long as the migration file is created # That's okay as long as the migration file is created
@ -291,21 +291,22 @@ python initdb.py
### Running tests for migrations ### Running tests for migrations
Use AWS/RDS to create a test image. Use AWS/RDS to create a test image.
To create a new database from a snapshot to test against see To create a new database from a snapshot to test against see
[this](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_RestoreFromSnapshot.html). [this](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_RestoreFromSnapshot.html).
Then point the migrations to the new instance using Then point the migrations to the new instance using
quay-config/local/config.yaml quay-config/local/config.yaml
Remember to run this from the root of the quay directory and to set your Remember to run this from the root of the quay directory and to set your
python environment first. python environment first.
``` ```sh
PYTHONPATH=. alembic upgrade head PYTHONPATH=. alembic upgrade head
``` ```
### How to run a build with tests for a push or merge ### How to run a build with tests for a push or merge
```
```sh
# Inside the quay directory. # Inside the quay directory.
export QUAY_TAG=quay.io/quay/quay:localtest export QUAY_TAG=quay.io/quay/quay:localtest
docker build -t $QUAY_TAG --build-arg RUN_TESTS=true . docker build -t $QUAY_TAG --build-arg RUN_TESTS=true .
@ -322,7 +323,6 @@ docker build -t $QUAY_TAG --build-arg RUN_TESTS=true .
Edit chart on Google Docs at [Architecture at a Glance](https://docs.google.com/a/coreos.com/drawings/d/1J-YZs7aun1lLy-1wFwIZcBma5IJmZQ8WfgtEftHCKJ0/edit?usp=sharing). Edit chart on Google Docs at [Architecture at a Glance](https://docs.google.com/a/coreos.com/drawings/d/1J-YZs7aun1lLy-1wFwIZcBma5IJmZQ8WfgtEftHCKJ0/edit?usp=sharing).
### Terminology ### Terminology
#### Organizations #### Organizations