Skip to content
Martin Hradil edited this page Jun 9, 2021 · 20 revisions

guidelines
project wiki
Devel setup

Prelude

First set up your github account to

And remember to sign any commits pushed to the galaxy_ng repo.

Install

Fork backend and the UI, and clone...

GITHUB_USER=himdel # update accordingly

git clone [email protected]:$GITHUB_USER/galaxy_ng.git
git clone [email protected]:$GITHUB_USER/ansible-hub-ui.git

cd galaxy_ng
git remote add upstream https://github.com/ansible/galaxy_ng

cd ../ansible-hub-ui
git remote add upstream https://github.com/ansible/ansible-hub-ui

Set up..

# copy the example env
cd galaxy_ng
cp .compose.env.example .compose.env

# build
./compose build

# load initial data
./compose up -d postgres redis
./compose run --rm api manage migrate
#./compose run --rm -e PULP_FIXTURE_DIRS='["/src/galaxy_ng/dev/automation-hub"]' api manage loaddata initial_data.json # TODO not anymore?
./compose run --rm api manage reset-admin-password --password admin
./compose down

Get more than initial data

https://github.com/himdel/ansible-hub-ui/wiki/Getting-Data

Rebuild after update

cd galaxy_ng
./compose down # if running
./compose build

Run

The backend...

cd galaxy_ng
./compose up

Just ^C to stop (foreground), or ./compose down when running ./compose up -d (background).

...And the UI:

cd ansible-hub-ui
npm run start-standalone

Run integration tests

tests readme

Create ansible-hub-ui/test/cypress.env.json:

{
    "prefix": "/api/automation-hub/",
    "username": "admin",
    "password": "admin"
}

(Don't forget the trailing slash ;).)

Run

# while backend & ui are running
cd ansible-hub-ui/test # test/
npm ci
npm run cypress:chrome # or cypress:chromium or cypress:firefox

Run python console

cd galaxy_ng
./compose run --rm api manage shell # skip shell to see more tasks

Run database console, dump database

cd galaxy_ng
# compose up must be running already
./compose exec postgres psql -U galaxy_ng galaxy_ng

the credentials come from galaxy_ng/dev/common/postgres.env.

For pg_dump:

cd galaxy_ng
# compose up must be running already
./compose exec postgres pg_dump -U galaxy_ng galaxy_ng -Fc > pg.dump

Ang pg_restore:

cd galaxy_ng
# compose must be down
./compose up -d postgres redis
./compose exec -T postgres pg_restore -U galaxy_ng -d galaxy_ng -cC /dev/stdin < pg.dump
./compose run --rm api manage migrate
./compose down

FIXME: does this ^ work yet? needs pg superuser?

Run a second/third environment

PR

cd galaxy_ng
./compose down  # can't run both at the same time
export DEV_IMAGE_SUFFIX=any_unique_string
./compose build
# see "load initial data"..
./compose up
unset DEV_IMAGE_SUFFIX

Cleanup

cd galaxy_ng
./compose down -v # stop and drop data
# see "load initial data" above

or

docker system prune -v # remove all built containers and data
# see "build" and "load initial data" above

Debugging pulp workers

http://localhost:5001/pulp/api/v3/status/

Common errors

VersionConflict during ./compose up: `pkg_resources.VersionConflict: (pulp-ansible 0.7.0 (/venv/lib/python3.6/site-packages), Requirement.parse('pulp-ansible==0.7.1')) Solution: rebuild

Hang during ./compose build (but not the ~10 minutes on chown): check the firewall is allowing connections betweeen docker containers, or disable firewall

Clone this wiki locally