### Install Dependencies and Start Community UI Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Installs Node.js dependencies and starts the Ansible Hub UI in development mode for community integration. Assumes the UI repository is cloned and accessible. ```bash cd ansible-hub-ui npm install npm run start-community ``` -------------------------------- ### Install and Run Tox for Unit Tests Source: https://github.com/ansible/galaxy_ng/blob/main/docs/dev/tests/unit.md Set up a virtual environment, install tox, and execute unit tests using the tox command. Ensure you have Python 3 and pip installed. ```bash python3 -m venv gng_unit_testing source gng_unit_testing/bin/activate pip install tox # run unit tests tox ``` -------------------------------- ### Create and Install Bindings Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Use this alias to create and install bindings. Provide the desired package and language as arguments. ```bash pbindings pulpcore python ``` -------------------------------- ### Pulp Installer Configuration File Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Example content for the 'local.dev-config.yml' file, used to configure Pulp and Galaxy NG installation. It specifies source directories, Git URLs, versions, and various configuration settings. ```yaml --- # Pulp Source pulp_source_dir: "/home/vagrant/devel/pulpcore" pulp_pip_editable: true pulp_git_url: https://github.com/pulp/pulpcore.git pulp_git_revision: "3.14.4" # Pulp plugins and Python libs pulp_install_plugins: pulp-ansible: source_dir: "/home/vagrant/devel/pulp_ansible" pulp-container: source_dir: "/home/vagrant/devel/pulp_container" galaxy-importer: source_dir: "/home/vagrant/devel/galaxy-importer" galaxy-ng: source_dir: "/home/vagrant/devel/galaxy_ng" # Pulp configuration pulpcore_version: 3.14.4 pulp_devel_supplement_bashrc: true pulp_default_admin_password: password pulp_webserver_disable_https: true pulp_user: "vagrant" developer_user: "vagrant" developer_user_home: "/home/vagrant" pulp_workers: 4 pulp_api_workers: 4 pulp_settings: secret_key: "unsafe_default" content_origin: "http://{{ ansible_fqdn }}" x_pulp_api_host: 127.0.0.1 x_pulp_api_port: 24817 x_pulp_api_user: "admin" x_pulp_api_password: "{{ pulp_default_admin_password }}" x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api" galaxy_require_content_approval: "False" pulp_token_auth_disabled: "True" galaxy_api_default_distribution_base_path: "published" # Galaxy Configuration # Set this __galaxy variables according to your needs. # __galaxy_profile: 'insights'or 'standalone' __galaxy_profile: 'standalone' # __galaxy_dev_source_path: `:` separated relative paths to the repos you cloned. __galaxy_dev_source_path: 'pulpcore:pulp_ansible:pulp_container:galaxy_ng:galaxy-importer' # __galaxy_lock_requirements: Set to 0 to avoid pinning of galaxy_ng/setup.py versions __galaxy_lock_requirements: '0' ``` -------------------------------- ### Start Vagrant VM and Docker Source: https://github.com/ansible/galaxy_ng/blob/main/docs/dev/docker_environment.md Navigate to the 'local-env' directory and run 'vagrant up' with your QUAY_TOKEN to set up the VM and start Docker. Then, SSH into the VM to verify Docker. ```sh cd local-env QUAY_TOKEN="your_token_here" vagrant up ``` ```sh vagrant ssh ``` ```sh docker --version docker ps ``` -------------------------------- ### Run API Container with sdb Source: https://github.com/ansible/galaxy_ng/wiki/Debugging-with-PDB Start the Django server in the API container with sdb for debugging. This command maps ports, sets environment variables for sdb, installs sdb, and runs the server. Note potential IP address adjustments for Mac users. ```bash ./compose run --rm -p "5001:8000" -p "6899:6899" -e SDB_HOST=0.0.0.0 -e SDB_PORT=6899 -e "SDB_NOTIFY_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" api /bin/bash -c "pip install sdb && ./entrypoint.sh manage runserver 0.0.0.0:8000" ``` -------------------------------- ### Listen for sdb Sessions Locally Source: https://github.com/ansible/galaxy_ng/wiki/Debugging-with-PDB Install the sdb client locally and start listening for debug sessions on the specified port. This is used in conjunction with the API container running with sdb enabled. ```bash $ pip install sdb $ sdb-listen listening for sdb notifications on :6899... ``` -------------------------------- ### Run Galaxy NG with Docker Compose Source: https://github.com/ansible/galaxy_ng/blob/main/docs/usage_guide/installation.md Clone the repository, navigate to the directory, and start Galaxy NG using the provided Docker Compose file. Ensure Docker is installed and running. ```bash git clone https://github.com/ansible/galaxy_ng cd galaxy_ng docker compose -f dev/compose/standalone.yaml up ``` -------------------------------- ### Install Optional Vagrant Plugins Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Installs optional Vagrant plugins for libvirt and host management. ```bash vagrant plugin install vagrant-libvirt # to connect to libvirt vagrant plugin install vagrant-hostmanager # to manage local dns ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/ansible/galaxy_ng/blob/main/docs/dev/writing_docs.md Installs the necessary Python packages for building the documentation. It is recommended to use a Python virtual environment. ```bash make docs/install ``` -------------------------------- ### Install Pulp Client Bindings Source: https://github.com/ansible/galaxy_ng/wiki/Writing-Functional-Tests Installs the necessary pulp client libraries using pip, specifying the versions exported in the previous step. ```bash pip install pulpcore-client==$CORE_VERSION pip install pulp-ansible-client==$ANSIBLE_VERSION pip install pulp-container-client==$CONTAINER_VERSION ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/ansible/galaxy_ng/blob/main/docs/dev/writing_docs.md Starts a local development server to preview the documentation site. Navigate to http://localhost:8000 to view the site. ```bash make docs/serve ``` -------------------------------- ### Run API Container with ipdb Source: https://github.com/ansible/galaxy_ng/wiki/Debugging-with-PDB Start the Django server in the API container with ipdb for debugging. This command installs ipython and ipdb, then runs the server. Debugging sessions will appear in the same terminal. ```bash ./compose run --rm --service-ports api /bin/bash -c "pip install ipython ipdb && ./entrypoint.sh manage runserver 0.0.0.0:8000" ``` -------------------------------- ### Initial Node Setup and Signing Services Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/signing/README.md Execute these commands once after workers are active to initialize GPG keys, signing services, and the repository keyring. ```bash ./setup_gpg_keys.sh ./setup_signing_services.sh ./setup_repo_keyring.sh ``` -------------------------------- ### Start Vagrant VM and Docker Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Navigate to the 'local-env' directory and start the Vagrant virtual machine using 'vagrant up'. Set the QUAY_TOKEN environment variable if required. Once the VM is running, SSH into it. ```sh cd local-env QUAY_TOKEN="your_token_here" vagrant up ``` -------------------------------- ### Start Pulp Services Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Use this alias to start all Pulp-related services. Ensure the virtual environment is activated before running. ```bash pstart ``` -------------------------------- ### Install Node.js Version 18 with NVM Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/devstack.md Use NVM to install and set the Node.js version to 18. This is a prerequisite for running the UI development server. ```bash nvm install 18 ``` -------------------------------- ### Install Integration Requirements Source: https://github.com/ansible/galaxy_ng/blob/main/docs/dev/tests/integration.md Installs the necessary Python packages for integration testing within a virtual environment. ```bash python3 -m venv gng_int_testing source gng_int_testing/bin/activate pip install -r integration_requirements.txt ``` -------------------------------- ### Start a fresh insights database Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/data/README.md Use these commands to stop the existing stack and start a fresh PostgreSQL instance for the insights database. ```bash docker compose -f dev/compose/certified-sync.yaml down -v docker compose -f dev/compose/certified-sync.yaml up -d insights-postgres ``` -------------------------------- ### Install Ansible, Vagrant, and Virtualization on Fedora Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Installs Ansible, Vagrant with libvirt and sshfs plugins, and virtualization packages on a Fedora system. ```bash sudo dnf install ansible vagrant-libvirt vagrant-sshfs @virtualization ``` -------------------------------- ### Start Dependency Containers Source: https://github.com/ansible/galaxy_ng/wiki/Debugging-with-PDB Run all necessary dependency containers except for the API itself. Use `-d` for background execution. Ensure TCP services are up before proceeding. ```bash ./compose up resource-manager worker content-app ``` -------------------------------- ### Setup GPG Keys for Signing Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/signing/README.md Run this script to set up GPG keys required for signing operations. Ensure a GPG agent is running and necessary files are in place. ```bash ./setup_gpg_keys.sh ``` -------------------------------- ### Install Podman-Docker and Configure Galaxy Importer Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment These commands are executed within the Vagrant guest. They install `podman-docker`, create a configuration directory, and set up a configuration file for `galaxy-importer` to enable features like running flake8 and ansible-test. ```bash sudo yum install podman-docker sudo mkdir /etc/galaxy-importer ``` ```ini [galaxy-importer] LOG_LEVEL_MAIN = INFO RUN_FLAKE8 = True RUN_ANSIBLE_TEST = True INFRA_LOCAL_IMAGE = True INFRA_LOCAL_DOCKER = False INFRA_OSD = False ``` -------------------------------- ### Install and Compile entr Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/bin/README.md Installs 'entr' by cloning the repository, checking out a specific commit to fix a compilation error, copying the Makefile, and then compiling the binary. This is typically run inside a container. ```bash RUN git clone https://github.com/eradman/entr && \ cd entr && \ git checkout 0d2d92d6052624a1e03a2a654e98e1c49f9955d9 && \ cp Makefile.linux Makefile && \ make ``` -------------------------------- ### Generate and Install Galaxy Bindings Source: https://github.com/ansible/galaxy_ng/wiki/Writing-Functional-Tests Generates and installs the Galaxy Python bindings using the pulp-openapi-generator. This process involves running a script, building the wheel, and installing it via pip. These bindings may need regeneration if the OpenAPI spec changes. ```bash cd pulp-openapi-generator rm -rf galaxy_ng-client ./generate.sh galaxy_ng python $GALAXY_VERSION cd galaxy_ng-client python setup.py sdist bdist_wheel --python-tag py3 find . -name "*.whl" -exec pip install {} \; cd ../../galaxy_ng ``` -------------------------------- ### Install Vagrant SSHFS Plugin Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Installs the required 'vagrant-sshfs' plugin for Vagrant. ```bash vagrant plugin install vagrant-sshfs ``` -------------------------------- ### Install a Collection using Ansible Galaxy CLI Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/userguide.md Install a collection using the ansible-galaxy CLI. This command is analogous to installing collections from the original Ansible Galaxy server. ```bash ansible-galaxy collection install community.general ``` -------------------------------- ### Run API Container with remote_pdb Source: https://github.com/ansible/galaxy_ng/wiki/Debugging-with-PDB Start the Django server in the API container with remote_pdb for debugging. This command maps ports, sets environment variables for remote_pdb, installs the package, and runs the server. ```bash ./compose run --rm -p "5001:8000" -p "4444:4444" -e REMOTE_PDB_HOST=0.0.0.0 -e REMOTE_PDB_PORT=4444 api /bin/bash -c "pip install remote-pdb && ./entrypoint.sh manage runserver 0.0.0.0:8000" ``` -------------------------------- ### Install Ansible, VirtualBox, and Vagrant on macOS Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Installs Ansible, VirtualBox, and Vagrant on a macOS system using Homebrew. ```bash brew install ansible brew cask install virtualbox brew cask install vagrant ``` -------------------------------- ### Full Example Script for Collection Signing Source: https://github.com/ansible/galaxy_ng/blob/main/docs/config/collection_signing.md This comprehensive script demonstrates the entire process of setting up GPG keys, creating a signing script, and configuring Galaxy for collection signing. ```bash gpg --full-gen-key # Please select what kind of key you want: # (4) RSA (sign only) # Your selection? 4 # # What keysize do you want? (2048) # Requested keysize is 2048 bits # # Please specify how long the key should be valid. # Key is valid for? (0) # Key does not expire at all # # Is this correct? (y/N) y # # Inform extra data such as Real Name, Company and email address. ############################################# # 2. List the keys to fetch the KEY_FINGERPRINT ############################################# # replace KEY with the key id from previous output or email. export KEY_FINGERPRINT=\ $(gpg -k --with-fingerprint --with-colons KEY|awk -F: '$1 == "fpr" {print $10;}"|head -n1) ############################################# # 3. Set the trust level ############################################# echo "${KEY_FINGERPRINT}:6:" | gpg --batch --import-ownertrust ############################################# # Create the signing script ############################################# cat <> /etc/pulp/scripts/collection_sign.sh #!/usr/bin/env bash FILE_PATH=$1 SIGNATURE_PATH="$1.asc" ADMIN_ID="${KEY_FINGERPRINT}" PASSWORD="password if needed" # Create a detached signature gpg --quiet --batch --pinentry-mode loopback --yes --passphrase \ $PASSWORD --homedir ~/.gnupg/ --detach-sign --default-key $ADMIN_ID \ --armor --output $SIGNATURE_PATH $FILE_PATH # Check the exit status STATUS=$? if [ $STATUS -eq 0 ]; then echo {"file": "$FILE_PATH", "signature": "$SIGNATURE_PATH"} else exit $STATUS fi EOF ########################################## # Create the signing service ########################################## django-admin add-signing-service \ ansible-default \ /etc/pulp/scripts/collection_sign.sh \ $KEY_FINGERPRINT ################################################ # Enable the signing service on galaxy settings ################################################ echo "GALAXY_COLLECTION_SIGNING_SERVICE='ansible-default'" >> /etc/pulp/settings.py # OR export PULP_GALAXY_COLLECTION_SIGNING_SERVICE=ansible-default #################################################### # Optionally enable automatic signing upon approval # NOTE: this must be enabled only if # `GALAXY_REQUIRE_CONTENT_APPROVAL` is True. #################################################### echo "GALAXY_AUTO_SIGN_COLLECTIONS=True" >> /etc/pulp/settings.py # OR export PULP_GALAXY_AUTO_SIGN_COLLECTIONS=True ``` -------------------------------- ### Start Compose with Local Checkouts (Single Line) Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Starts the Galaxy NG compose stack with local checkouts and auto-reloading enabled, all in a single command line. Ensure DEV_SOURCE_PATH is correctly set. ```bash DEV_SOURCE_PATH="dynaconf:pulp_ansible:galaxy_ng" docker compose -f dev/compose/app.yaml up --build ``` -------------------------------- ### Install Ansible, Vagrant, and Virtualization on Debian (Libvirt) Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Installs Ansible, Vagrant with sshfs and libvirt, along with necessary libvirt and QEMU packages on a Debian system. Adds the current user to libvirt groups. ```bash # libvirt sudo apt install ansible vagrant vagrant-sshfs vagrant-libvirt dnsmasq libvirt-clients libvirt-daemon libvirt-dbus qemu-system-x86 qemu-utils sudo usermod -aG libvirt,libvirt-qemu,libvirtdbus $USER ``` -------------------------------- ### Install Ansible, Vagrant, and Virtualization on Debian (VirtualBox) Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Installs Ansible, Vagrant with sshfs and VirtualBox on a Debian system. Requires 'sid' in sources for VirtualBox. ```bash # virtualbox (requires sid in sources) sudo apt install ansible vagrant vagrant-sshfs virtualbox/sid ``` -------------------------------- ### Build and Spin Up Community Stack with Make Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/devstack.md Use the provided Makefile target to build the Docker images and start the community API stack. This command initiates the development environment. ```bash cd src/galaxy_ng make compose/community ``` -------------------------------- ### Install Local Galaxy Importer and Restart Pulp Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment These commands are executed within the Vagrant box after SSHing into it. They activate a Python virtual environment, navigate to the local `galaxy-importer` development directory, install it in editable mode, and restart the Pulp service. ```bash source /usr/local/lib/pulp/bin/activate cd /home/vagrant/devel/galaxy-importer pip install --upgrade -e . prestart ``` -------------------------------- ### Navigate to Pulp Installer Directory Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Changes the current working directory to the 'pulp_installer' directory. ```bash cd pulp_installer ``` -------------------------------- ### Install Python Testing Packages Source: https://github.com/ansible/galaxy_ng/wiki/Writing-Functional-Tests Installs the necessary Python packages for running functional tests. Ensure your virtual environment is activated before running these commands. ```bash cd galaxy_ng # the root of the repository # ACTIVATE THE VIRTUALENV YOU USE FOR YOUR LOCAL GALAXY DEVELOPMENT # ex: `source venv/bin/activate` or `workon galaxy_ng` pip install -r unittest_requirements.txt pip install -r functest_requirements.txt ``` -------------------------------- ### Start Ansible Hub UI Development Server Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/devstack.md Run the npm start script to launch the webpack dev server for the Ansible Hub UI. This script will redirect API calls to http://localhost:5001 by default. ```bash npm run start-community ``` -------------------------------- ### Verify Docker Installation in Vagrant VM Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md After SSHing into the Vagrant VM, verify that Docker is installed and running by checking its version and listing the running containers. ```sh docker --version docker ps ``` -------------------------------- ### Start Debugging with Docker Compose (ipdb) Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Starts a Docker Compose service and stops execution at the inserted breakpoint. The container will remain running, allowing for debugging. ```bash $ export DEV_SOURCE_PATH=galaxy_ng $ docker compose -f dev/compose/aap.yaml up migrations ``` -------------------------------- ### List Collections Response Example Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/api_v3.md Example JSON response when listing published Ansible collections. Includes metadata, pagination links, and a list of collection objects. ```json { "meta":{ "count":2346 }, "links":{ "first":"/api/v3/plugin/ansible/content/published/collections/index/?limit=2&offset=0", "previous":null, "next":"/api/v3/plugin/ansible/content/published/collections/index/?limit=2&offset=2", "last":"/api/v3/plugin/ansible/content/published/collections/index/?limit=2&offset=2344" }, "data":[ { "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/", "namespace":"namespace", "name":"collection_name", "deprecated":false, "versions_url":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/versions/", "highest_version":{ "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/versions/1.0.4/", "version":"1.0.4" }, "created_at":"2023-04-13T17:57:18.960283Z", "updated_at":"2023-04-13T18:10:23.981051Z" }, { "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/nicecollection/", "namespace":"namespace", "name":"nicecollection", "deprecated":false, "versions_url":"/api/v3/plugin/ansible/content/published/collections/index/namespace/nicecollection/versions/", "highest_version":{ "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/nicecollection/versions/1.0.1/", "version":"1.0.1" }, "created_at":"2023-04-13T17:51:57.476396Z", "updated_at":"2023-04-13T18:10:23.981051Z" } ] } ``` -------------------------------- ### Client Verifying Container Image Signature Source: https://github.com/ansible/galaxy_ng/blob/main/docs/config/container_signing.md Example of a client command to pull a container image and verify its signature. The output shows the process of fetching signatures and storing them. ```bash podman pull fluffy.example.com/myrepo/test-image:foo Trying to pull fluffy.example.com/myrepo/test-image:foo... Getting image source signatures Checking if image destination supports signatures Copying blob 58147e24f776 skipped: already exists Copying config 829374d342 done Writing manifest to image destination Storing signatures 829374d342ae65a12f3a95911bc04a001894349f70783fda841b1a784008727d ``` -------------------------------- ### Clean Pulp Installation Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Use this alias to restore Pulp to a clean-installed state. **Warning:** This action destroys all Pulp data. ```bash pclean ``` -------------------------------- ### Sign Commits with GPG Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/devstack.md Start your commit messages with this command to ensure they are cryptographically signed. This is a strict check for proper referencing and security. ```bash git commit -s -S ``` -------------------------------- ### Checkout Latest Compatible Pulp Installer Version Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Updates the 'pulp_installer' repository to the '3.11' branch to ensure the latest compatible version is used. ```bash git checkout 3.11 ``` -------------------------------- ### Run Galaxy Compose Stack Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Starts the Galaxy Simplified Compose Stack. Use the `-d` flag to run in detached mode and release the terminal. ```bash docker compose -f dev/compose/aap.yaml up ``` -------------------------------- ### Get Specific Collection Response Example Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/api_v3.md Example JSON response when retrieving details for a single Ansible collection. ```json { "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/", "namespace":"namespace", "name":"collection_name", "deprecated":false, "versions_url":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/versions/", "highest_version":{ "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/versions/1.0.4/", "version":"1.0.4" }, "created_at":"2023-04-13T17:57:18.960283Z", "updated_at":"2023-04-13T18:10:23.981051Z" } ``` -------------------------------- ### Run Community Compose Stack Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Starts the Galaxy NG stack using the community profile. This should be run in a separate terminal from the UI development setup. ```bash cd galaxy_ng docker compose -f dev/compose/community.yaml up ``` -------------------------------- ### Run Ansible Galaxy NG with Docker Compose Source: https://github.com/ansible/galaxy_ng/blob/main/README.md This command starts the Ansible Galaxy NG project using a standalone Docker Compose configuration. Ensure Docker is installed and running. ```console $ docker compose -f dev/compose/standalone.yaml up ``` -------------------------------- ### Start Vagrant VM with Libvirt Provider Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Use this command to provision a virtual machine using the libvirt provider. Ensure the libvirt service is running and accessible. This command configures the VM using `local.dev-config.yml`. ```bash vagrant up --provider=libvirt pulp3-source-fedora33 ``` -------------------------------- ### Start Vagrant VM with Libvirt for RHEL Features Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment If RHEL-specific features are required, use this command to provision a virtual machine with the libvirt provider. Ensure the libvirt service is running and accessible. ```bash vagrant up --provider=libvirt pulp3-source-centos8 ``` -------------------------------- ### Install a Role using Ansible Galaxy CLI Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/userguide.md Install a role using the ansible-galaxy CLI. This command works similarly to installations from the original Ansible Galaxy server. ```bash ansible-galaxy role install geerlingguy.docker ``` -------------------------------- ### Container Policy Configuration Source: https://github.com/ansible/galaxy_ng/blob/main/docs/config/container_signing.md Configure the policy file for container image signature verification. This example defines default rejection and specific rules for 'fluffy.example.com' using GPG keys, and allows any image from local container storage. ```bash cat /etc/containers/policy.json { "default": [{"type": "reject"}], "transports": { "docker": { "fluffy.example.com": [ { "type": "signedBy", "keyType": "GPGKeys", "keyPath": "/path-to-pupsik-key.gpg" } ] }, "containers-storage": { "": [{"type": "insecureAcceptAnything"}] /* Allow copy operations on any images stored in containers storage (e.g. podman push) */ } } } ``` -------------------------------- ### Create Signing Service with Script and Key Source: https://github.com/ansible/galaxy_ng/blob/main/docs/config/container_signing.md This command creates a signing service named `container-default` using a specific script and GPG fingerprint. Ensure the script path and fingerprint are correct. ```bash django-admin add-signing-service container-default \ /var/lib/pulp/scripts/container_sign.sh \ ${FINGERPRINT} \ --class container:ManifestSigningService ``` -------------------------------- ### Populate Pulp 2 ISO Repositories Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Use this alias to sync 4 ISO repositories for Pulp 2. Ensure the virtual environment is activated before running. ```bash populate_pulp2_iso ``` -------------------------------- ### Install Ansible Collection Source: https://github.com/ansible/galaxy_ng/blob/main/docs/usage_guide/collections.md Use this command to install a specific version of an Ansible collection from Galaxy NG. Ensure your CLI is configured first. ```shell ansible-galaxy collection install namespace.name:1.0.3 ``` -------------------------------- ### Example Container Signing Script Source: https://github.com/ansible/galaxy_ng/blob/main/docs/config/container_signing.md This bash script uses `skopeo` to create container signatures. It receives manifest path, GPG key fingerprint, image reference, and signature path as arguments. The script should output a JSON containing the signature path on success. ```bash #!/usr/bin/env bash # This GPG_TTY variable might be needed on a container image that is not running as root. # export GPG_TTY=$(tty) # pulp_container SigningService will pass the next 4 variables to the script. MANIFEST_PATH=$1 FINGERPRINT="$PULP_SIGNING_KEY_FINGERPRINT" IMAGE_REFERENCE="$REFERENCE" SIGNATURE_PATH="$SIG_PATH" # Create container signature using skopeo skopeo standalone-sign \ $MANIFEST_PATH \ $IMAGE_REFERENCE \ $FINGERPRINT \ --output $SIGNATURE_PATH # Optionally pass the passphrase to the key if password protected. # --passphrase-file /path/to/key_password.txt # Check the exit status STATUS=$? if [ $STATUS -eq 0 ]; then echo {"signature_path": "$SIGNATURE_PATH"} else exit $STATUS fi ``` -------------------------------- ### Start Debugging Async Code with Docker Compose (rpdb) Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Starts a Docker Compose service for asynchronous code debugging. Execution will pause at the 'rpdb' breakpoint. ```bash $ export DEV_SOURCE_PATH="galaxy_ng:pulp_ansible" $ docker compose -f dev/compose/aap.yaml up worker ``` -------------------------------- ### Set Repository GPG Keyring Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/signing/README.md Configure a repository with a public GPG key. Use either a public key file or a keyring file. ```bash pulpcore-manager set-repo-keyring --repository staging --publickeypath /etc/pulp/certs/signing-public.key -y; ``` ```bash pulpcore-manager set-repo-keyring --repository staging --keyring ~/.gnupg/pubring.kbx -y; ``` -------------------------------- ### Initialize Git Submodules Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Updates and initializes all Git submodules for the project. ```bash git submodule update --init ``` -------------------------------- ### Verify Repository Structure Source: https://github.com/ansible/galaxy_ng/wiki/Using-the-Vagrant-Dev-Environment Displays the directory structure to ensure all cloned repositories are at the same level. ```bash tree -a -L 1 ``` -------------------------------- ### Configure Vagrantfile for Development Environment Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md This Vagrantfile configures a virtual machine with Ubuntu, sets up networking, shared folders, and installs Docker, Node.js, and Ansible. Ensure you update bridge, memory, and CPU values as needed. ```ruby Vagrant.configure("2") do |config| config.vm.box = "ubuntu/jammy64" config.ssh.forward_agent = true config.vm.network "public_network", bridge: "" config.vm.provider "virtualbox" do |vb| vb.memory = "" vb.cpus = end config.vm.synced_folder "./source", "/home/vagrant/source" config.vm.provision "shell", inline: <<-SHELL sudo apt-get update sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common git make sudo apt-get remove -y docker docker-engine docker.io containerd runc curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install -y python3 python3-pip docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install nodejs -y sudo usermod -aG docker vagrant docker login -u='mmagnani' -p="$QUAY_TOKEN" quay.io sudo apt-add-repository --yes --update ppa:ansible/ansible sudo apt-get install -y ansible SHELL end ``` -------------------------------- ### Pulp API Access Policy Example Source: https://github.com/ansible/galaxy_ng/blob/main/docs/dev/developer_guide/rbac.md Example of an access policy for Pulp API endpoints, specifically for the 'groups/roles' URL pattern. This policy grants permissions based on authenticated status, admin privileges, and specific model permissions. ```python 'groups/roles': [ { "action": ["list", "retrieve"], "principal": "authenticated", "effect": "allow", "condition": "has_model_perms:galaxy.view_group" }, { "action": "create", "principal": "authenticated", "effect": "allow", "condition": "has_model_perms:galaxy.change_group" }, { "action": "*", "principal": "admin", "effect": "allow" } ], ``` -------------------------------- ### Start Compose with Local Checkouts and Auto Reload Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Starts the Galaxy NG compose stack with local checkouts of dependencies. Sets the DEV_SOURCE_PATH environment variable to enable auto-reloading for 'api', 'worker', and 'content' services when source code changes. ```bash cd ~/projects/galaxy_ng export DEV_SOURCE_PATH="dynaconf:pulp_ansible:galaxy_ng" docker compose -f dev/compose/app.yaml up --build ``` -------------------------------- ### Get Namespace API Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/api_v3.md Retrieves details for a specific namespace by its ID. ```APIDOC ## GET /api/v3/namespaces/{namespace_id}/ ### Description Retrieves detailed information about a specific namespace using its unique identifier. ### Method GET ### Endpoint /api/v3/namespaces/{namespace_id}/ #### Path Parameters - **namespace_id** (string) - Required - The identifier of the namespace to retrieve. ### Request Example ```bash curl -X 'GET' \ 'https://beta-galaxy.ansible.com/api/v3/namespaces/ansible/' \ -H 'accept: application/json' \ -H 'Authorization: Token YOURTOKEN' ``` ### Response #### Success Response (200) - **pulp_href** (string) - The Pulp HATEOAS link for the namespace. - **id** (number) - The unique identifier for the namespace. - **name** (string) - The name of the namespace. - **company** (string) - The company associated with the namespace. - **email** (string) - The email address for the namespace. - **avatar_url** (string) - URL for the namespace's avatar. - **description** (string) - Description of the namespace. - **links** (array) - Links related to the namespace. - **groups** (array) - List of groups associated with the namespace. - **resources** (string) - Resources associated with the namespace. - **related_fields** (object) - Contains related fields information. - **metadata_sha256** (string) - SHA256 hash of the namespace metadata. - **avatar_sha256** (string) - SHA256 hash of the namespace avatar. #### Response Example ```json { "pulp_href":"/api/pulp/api/v3/pulp_ansible/namespaces/2/", "id":2, "name":"ansible", "company":"", "email":"", "avatar_url":"", "description":"", "links":[ ], "groups":[ ], "resources":"", "related_fields":{ }, "metadata_sha256":"68073fd148635456d3810a0367602ebfcd4a6f48736c93ffdcd48777cd1e0aeb", "avatar_sha256":null } ``` ``` -------------------------------- ### List Configuration Settings Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/README.md Lists all available configuration settings for the Galaxy NG application using 'dynaconf list'. ```bash docker compose -f dev/compose/aap.yaml exec manager dynaconf list ``` -------------------------------- ### Get AAP Version Source: https://github.com/ansible/galaxy_ng/blob/main/CHANGES.md Retrieves the Ansible Automation Platform version from the /etc/ansible-automation-platform/VERSION file. ```APIDOC ## GET /api/v1/version/ ### Description Retrieves the Ansible Automation Platform version. ### Method GET ### Endpoint /api/v1/version/ ### Response #### Success Response (200) - **version** (string) - The current Ansible Automation Platform version. #### Response Example { "version": "4.6.0" } ``` -------------------------------- ### Import GPG Public Key to Keyring Source: https://github.com/ansible/galaxy_ng/blob/main/docs/config/collection_signing.md Import a GPG public key into a specified keyring for signature verification during upload. Ensure the keyring path and key file are correct. ```bash gpg --batch --no-default-keyring \ --keyring /etc/pulp/certs/galaxy.kbx \ --import path_to_your_public.key ``` -------------------------------- ### GET /api/v1/roles/ Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/api_v3.md Retrieves a list of legacy roles from Ansible Galaxy. Supports pagination and filtering. ```APIDOC ## GET /api/v1/roles/ ### Description Retrieves a list of legacy roles from Ansible Galaxy. This endpoint supports pagination via `page_size` and `page` query parameters. ### Method GET ### Endpoint /api/v1/roles/ ### Query Parameters - **page_size** (integer) - Optional - Number of results to return per page. ### Request Example ```bash curl -X 'GET' \ 'https://beta-galaxy.ansible.com/api/v1/roles/?page_size=2' \ -H 'accept: application/json' \ -H 'Authorization: Token YOURTOKEN' ``` ### Response #### Success Response (200) - **count** (integer) - The total number of roles available. - **next** (string) - URL for the next page of results, or null if none. - **previous** (string) - URL for the previous page of results, or null if none. - **results** (array) - A list of role objects. - **id** (integer) - Unique identifier for the role. - **upstream_id** (integer) - The ID from the upstream source (e.g., GitHub). - **created** (string) - Timestamp when the role was created. - **modified** (string) - Timestamp when the role was last modified. - **github_user** (string) - The GitHub username associated with the role. - **username** (string) - The username associated with the role. - **github_repo** (string) - The GitHub repository name for the role. - **github_branch** (string) - The GitHub branch for the role (can be null). - **commit** (string) - The commit hash of the role. - **name** (string) - The name of the role. - **description** (string) - A brief description of the role. - **summary_fields** (object) - Contains summary information about related resources. - **dependencies** (array) - List of role dependencies. - **namespace** (object) - Information about the role's namespace. - **id** (integer) - Namespace ID. - **name** (string) - Namespace name. - **avatar_url** (string) - URL of the namespace's avatar. - **provider_namespace** (object) - Information about the provider's namespace. - **id** (integer) - Provider namespace ID. - **name** (string) - Provider namespace name. - **repository** (object) - Information about the associated repository. - **name** (string) - Repository name. - **original_name** (string) - Original repository name. - **tags** (array) - List of tags associated with the role. - **versions** (array) - List of role versions. - **id** (integer) - Version ID. - **url** (string) - URL for the version. - **name** (string) - Version name (e.g., "1.0.0"). - **active** (boolean) - Indicates if the version is active. - **created** (string) - Timestamp of version creation. - **related** (object) - Related version information. - **version** (string) - Version string. - **modified** (string) - Timestamp of version modification. - **commit_sha** (string) - Commit SHA for this version. - **commit_date** (string) - Date of the commit. - **download_url** (string) - URL to download the version. - **summary_fields** (object) - Summary fields for the version. #### Response Example ```json { "count": 31888, "next": "http://beta-galaxy.ansible.com/api/v1/roles/?page=2&page_size=2", "previous": null, "results": [ { "id": 1, "upstream_id": 24559, "created": "2023-02-06T14:33:16.015752Z", "modified": "2023-02-06T14:33:16.018665Z", "github_user": "00willo", "username": "00willo", "github_repo": "ansible-role_sublimetext", "github_branch": null, "commit": "a1c5df38855094dbd9b09e1d2f576cb4644942d3", "name": "sublimetext-3", "description": "Install Sublime Text 3 on your machine. Supports both the dev and stable release channels.", "summary_fields": { "dependencies": [], "namespace": { "id": 1, "name": "00willo", "avatar_url": "https://github.com/00willo.png" }, "provider_namespace": { "id": 1, "name": "00willo" }, "repository": { "name": "sublimetext-3", "original_name": "ansible-role_sublimetext" }, "tags": [ "development", "editor", "ide", "workstation" ], "versions": [] } } ] } ``` ``` -------------------------------- ### Get a specific collection Source: https://github.com/ansible/galaxy_ng/blob/main/docs/community/api_v3.md Retrieves detailed information for a specific Ansible collection identified by its namespace and name. ```APIDOC ## GET /api/v3/plugin/ansible/content/published/collections/index/{namespace}/{name}/ ### Description Retrieves detailed information about a specific Ansible collection. ### Method GET ### Endpoint `/api/v3/plugin/ansible/content/published/collections/index/{namespace}/{name}/` ### Path Parameters - **namespace** (string) - Required - The namespace of the collection. - **name** (string) - Required - The name of the collection. ### Query Parameters - **fields** (string) - Optional - A comma-separated list of fields to include in the response. - **exclude_fields** (string) - Optional - A comma-separated list of fields to exclude from the response. ### Request Example ```bash curl -X 'GET' \ 'https://beta-galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/' \ -H 'accept: application/json' \ -H 'Authorization: Token YOURTOKEN' ``` ### Response #### Success Response (200) - **href** (string) - URL to the specific collection resource. - **namespace** (string) - The namespace of the collection. - **name** (string) - The name of the collection. - **deprecated** (boolean) - Indicates if the collection is deprecated. - **versions_url** (string) - URL to the collection's versions. - **highest_version** (object) - Information about the highest version of the collection. - **created_at** (string) - Timestamp when the collection was created. - **updated_at** (string) - Timestamp when the collection was last updated. #### Response Example ```json { "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/", "namespace":"namespace", "name":"collection_name", "deprecated":false, "versions_url":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/versions/", "highest_version":{ "href":"/api/v3/plugin/ansible/content/published/collections/index/namespace/collection_name/versions/1.0.4/", "version":"1.0.4" }, "created_at":"2023-04-13T17:57:18.960283Z", "updated_at":"2023-04-13T18:10:23.981051Z" } ``` ``` -------------------------------- ### Restore the old fixture Source: https://github.com/ansible/galaxy_ng/blob/main/dev/compose/data/README.md This command starts the `load-sync-data` service to restore the existing fixture data into the insights database. ```bash docker compose -f dev/compose/certified-sync.yaml up load-sync-data ``` -------------------------------- ### Enable TLS Verification for LDAP Connections Source: https://github.com/ansible/galaxy_ng/blob/main/docs/integration/ldap.md Enables the StartTLS command for LDAP connections, which upgrades an insecure connection to a secure one. Set to true to enable. ```bash PULP_AUTH_LDAP_START_TLS=true ``` -------------------------------- ### List LDAP Users and Groups Source: https://github.com/ansible/galaxy_ng/blob/main/docs/integration/ldap.md Use ldapsearch to check if your LDAP server is running and accessible. Ensure ldap-utils is installed. ```bash # List all users ldapsearch -H ldap://localhost:10389 -x -b "ou=people,dc=planetexpress,dc=com" -D "cn=admin,dc=planetexpress,dc=com" -w GoodNewsEveryone "(objectClass=inetOrgPerson)" ``` ```bash # List all groups ldapsearch -H ldap://localhost:10389 -x -b "ou=people,dc=planetexpress,dc=com" -D "cn=admin,dc=planetexpress,dc=com" -w GoodNewsEveryone "(objectClass=Group)" ```