Please visit the Galaxy NextGen project
Backend project for Automation Hub. The frontend UI project is ansible-hub-ui.
View the latest version of the spec by clicking here.
To configure and run the API locally follow these steps:
-
Clone
galaxy-dev
repository$ git clone [email protected]:ansible/galaxy-dev.git
-
Clone submodule
$ cd galaxy-dev/ $ git submodule update --init --remote
-
(Workaround) Checkout pulp_ansible version 0.2.0b3
$ cd pulp-ansible/ $ git checkout 0.2.0b3
-
Build development docker image
$ make docker/build
-
Run migrations
$ make docker/run-migrations
-
Run development environment
$ make docker/up
-
Create galaxy admin user
$ docker-compose run --rm galaxy-api manage createsuperuser Username: admin Password: admin
-
Create pulp admin user
Note If you want to use different user credentials, make sure pulp credentials are updated in
galaxy-api/galaxy_api/settings.py
.$ docker-compose run --rm pulp-api manage createsuperuser Username: admin Password: admin
-
Create pulp repository and distribution
$ docker-compose run --rm pulp-api manage shell Python 3.6.8 (default, Aug 7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from pulp_ansible.app.models import AnsibleRepository, AnsibleDistribution >>> repo = AnsibleRepository.objects.create(name='automation-hub') >>> AnsibleDistribution.objects.create(name='automation-hub', base_path='automation-hub', repository=repo) <AnsibleDistribution: automation-hub> >>> # Press <CTRL+D> to exit.
Note If the API is running without a UI, authorization can be disabled for testing
purposes by commenting default permission classes in galaxy-api/galaxy_api/settings.py
REST_FRAMEWORK = {
# ...
'DEFAULT_PERMISSION_CLASSES': [
# 'rest_framework.permissions.IsAuthenticated',
# 'galaxy_api.auth.auth.RHEntitlementRequired',
],
# ...
}
- Galaxy API URL: http://localhost:5001/api/automation-hub/v3/
- Galaxy admin site URL: http://localhost:5001/admin/
- Pulp API URL: http://localhost:5002/
To be able to run unit tests, database user permission to create a database need to be changed:
- make sure you have the right permissions for Docker file volumes
- open Postgres client from
pulp
Docker image:docker-compose exec postgres psql -U postgres pulp
- give
galaxy
user permission to runcreatedb
:ALTER USER galaxy CREATEDB;
To run unit tests:
- install
tox
:pip install --user tox
- run the unit tests:
galaxy-dev/galaxy-api/ $ tox -e py36,flake8
For instructions on how to add the Automation Hub UI to your local environment, visit the ansible-hub-ui frontend project.