From 3d6b9bdd1d923b79ca78428d05ce70e4b475f251 Mon Sep 17 00:00:00 2001 From: Bruno Rocha Date: Wed, 30 Oct 2024 12:58:33 +0000 Subject: [PATCH] Insights profile --- dev/compose/insights.yaml | 287 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100644 dev/compose/insights.yaml diff --git a/dev/compose/insights.yaml b/dev/compose/insights.yaml new file mode 100644 index 0000000000..ae56fe8abe --- /dev/null +++ b/dev/compose/insights.yaml @@ -0,0 +1,287 @@ +x-common-env: &common-env + + GNUPGHOME: /root/.gnupg/ + GALAXY_IMPORTER_CONFIG: /src/galaxy_ng/profiles/insights/galaxy-importer/galaxy-importer.cfg + + DJANGO_SUPERUSER_USERNAME: admin + DJANGO_SUPERUSER_EMAIL: admin@example.com + DJANGO_SUPERUSER_PASSWORD: admin + + POSTGRES_USER: galaxy_ng + POSTGRES_PASSWORD: galaxy_ng + POSTGRES_DB: galaxy_ng + + # no spying + PULP_ANALYTICS: 'false' + + # normally goes into settings.py ... + PULP_DATABASES__default__ENGINE: django.db.backends.postgresql + PULP_DATABASES__default__NAME: galaxy_ng + PULP_DATABASES__default__USER: galaxy_ng + PULP_DATABASES__default__PASSWORD: galaxy_ng + PULP_DATABASES__default__HOST: postgres + PULP_DATABASES__default__PORT: 5432 + + PULP_DEBUG: 1 + PULP_GALAXY_DEPLOYMENT_MODE: 'insights' + PULP_RH_ENTITLEMENT_REQUIRED: 'insights' + PULP_DEFAULT_FILE_STORAGE: "pulpcore.app.models.storage.FileSystem" + PULP_REDIRECT_TO_OBJECT_STORAGE: 'false' + + # Hostname and prefix has to be correct + PULP_GALAXY_API_PATH_PREFIX: '/api/automation-hub/' + PULP_CONTENT_PATH_PREFIX: '/pulp/content/' + PULP_ANSIBLE_API_HOSTNAME: 'https://localhost' + PULP_ANSIBLE_CONTENT_HOSTNAME: "https://localhost" + PULP_CONTENT_ORIGIN: "https://localhost" + PULP_CSRF_TRUSTED_ORIGINS: "['https://localhost']" + + # auth ... + PULP_GALAXY_AUTHENTICATION_CLASSES: "['galaxy_ng.app.auth.auth.RHIdentityAuthentication']" + + PULP_GALAXY_FEATURE_FLAGS__dab_resource_registry: 'false' + PULP_GALAXY_REQUIRE_CONTENT_APPROVAL: 'true' + PULP_GALAXY_AUTO_SIGN_COLLECTIONS: 'false' + + # Resource server + # This disables the attempt for resource syncing + PULP_RESOURCE_SERVER_SYNC_ENABLED: 'false' + # Set above to 'true' if/when RESOURCE_SERVER is configured + # The next variables must be configured to enable resource sync + # PULP_RESOURCE_SERVER__URL='https://localhost' + # PULP_RESOURCE_SERVER__SECRET_KEY='?' + # PULP_RESOURCE_SERVER__VALIDATE_HTTPS='false' + + # Integration test settings + HUB_AUTH_URL: "{API_PROTOCOL}://{API_HOST}:{INSIGHTS_PROXY_PORT}/auth/realms/redhat-external/protocol/openid-connect/token" + HUB_API_ROOT: "{API_PROTOCOL}://{API_HOST}:{INSIGHTS_PROXY_PORT}{PULP_GALAXY_API_PATH_PREFIX}" + HUB_LOCAL: 0 + HUB_TEST_MARKS: deployment_cloud or all + + # Unpin dependencies on setup.py if set to 0 + LOCK_REQUIREMENTS: 0 + + # DEV EDITABLE STUFF + # To enable editable to install local checkouts set DEV_SOURCE_PATH keeping the ordering as follows: + # "dynaconf:pulpcore:galaxy_importer:pulp_ansible:pulp_container:galaxy_ng:django-ansible-base" + # This can be done as part of the `docker compose` call: + # $ DEV_SOURCE_PATH="pulp_container:galaxy_ng" docker compose -f dev/compose/aap.yaml up + DEV_SOURCE_PATH: + + +services: + base_img: + build: + context: ../../ + dockerfile: Dockerfile + image: "localhost/galaxy_ng/galaxy_ng:base" + + base_img_dev: # Extends base_img with extra files and dev tools + depends_on: + - base_img + build: + context: . + dockerfile: Dockerfile.dev + args: + <<: *common-env + image: "localhost/galaxy_ng/galaxy_ng:dev" + + proxy: + build: + context: "../../profiles/insights/proxy" + ports: + - "8080:8080" + environment: + UPSTREAM_URL: "http://api:24817" + PROXY_PORT: "8080" + volumes: + - "../../profiles/insights/proxy:/app:ro" + + redis: + image: "redis:5" + + postgres: + image: "postgres:13" + ports: + - '5433:5432' + environment: + <<: *common-env + healthcheck: + test: ["CMD", "pg_isready", "-U", "galaxy_ng"] + interval: 10s + retries: 5 + # Uncomment below to spam out every DB statement to the service stderr + # WARNING: enabling log_statement=all makes database slower + # command: ["postgres", "-c", "log_statement=ddl", "-c", "log_destination=stderr"] + + migrations: + image: "localhost/galaxy_ng/galaxy_ng:dev" + depends_on: + - base_img_dev + - postgres + volumes: + - "etc_pulp_certs:/etc/pulp/certs" + - "var_lib_pulp:/var/lib/pulp" + - "../../../:/src" + - "../../:/app" + environment: + <<: *common-env + user: root + command: | + bash -c " + set -e; + rm -rf /var/lib/pulp/.migrated; + /src/galaxy_ng/dev/compose/bin/devinstall; + + pulpcore-manager check --database default; + pulpcore-manager migrate; + pulpcore-manager shell < /src/galaxy_ng/dev/common/setup_test_data.py; + pulpcore-manager createsuperuser --noinput || true; + + touch /var/lib/pulp/.migrated; + " + + api: + image: "localhost/galaxy_ng/galaxy_ng:dev" + depends_on: + - base_img_dev + - postgres + - migrations + volumes: + - "etc_pulp_certs:/etc/pulp/certs" + - "var_lib_pulp:/var/lib/pulp" + - "../../../:/src" + - "../../:/app" + environment: + <<: *common-env + extra_hosts: + localhost: "host-gateway" + networks: + - default + - service-mesh + user: root + command: | + bash -c " + /src/galaxy_ng/dev/compose/bin/wait /var/lib/pulp/.migrated; + /src/galaxy_ng/dev/compose/bin/devinstall; + /src/galaxy_ng/dev/compose/bin/reloader /venv/bin/pulpcore-api + " + + content: + image: "localhost/galaxy_ng/galaxy_ng:dev" + depends_on: + - base_img_dev + - postgres + - migrations + volumes: + - "etc_pulp_certs:/etc/pulp/certs" + - "var_lib_pulp:/var/lib/pulp" + - "../../../:/src" + - "../../:/app" + environment: + <<: *common-env + extra_hosts: + localhost: "host-gateway" + networks: + - default + - service-mesh + user: root + command: | + bash -c " + /src/galaxy_ng/dev/compose/bin/wait /var/lib/pulp/.migrated; + /src/galaxy_ng/dev/compose/bin/devinstall; + /src/galaxy_ng/dev/compose/bin/reloader /venv/bin/pulpcore-content + " + + worker: + image: "localhost/galaxy_ng/galaxy_ng:dev" + depends_on: + - base_img_dev + - postgres + - migrations + volumes: + - "etc_pulp_certs:/etc/pulp/certs" + - "var_lib_pulp:/var/lib/pulp" + - "../../../:/src" + - "../../:/app" + environment: + <<: *common-env + user: root + command: | + bash -c " + /src/galaxy_ng/dev/compose/bin/wait /var/lib/pulp/.migrated; + /src/galaxy_ng/dev/compose/bin/devinstall; + + # Worker needs gpg in order to consume signing tasks; + gpg --list-secret-keys; + + /src/galaxy_ng/dev/compose/bin/reloader /venv/bin/pulpcore-worker + " + + manager: + image: "localhost/galaxy_ng/galaxy_ng:dev" + depends_on: + - base_img_dev + - postgres + - migrations + - worker + volumes: + - "etc_pulp_certs:/etc/pulp/certs" + - "var_lib_pulp:/var/lib/pulp" + - "../../../:/src" + - "../../:/app" + environment: + <<: *common-env + user: root + command: | + bash -c " + /src/galaxy_ng/dev/compose/bin/wait /var/lib/pulp/.migrated; + /src/galaxy_ng/dev/compose/bin/devinstall; + + # Give some time for API to start; + sleep 5; + + # Setup repository gpgkey for upload verification; + /src/galaxy_ng/dev/compose/signing/setup_repo_keyring.sh; + + echo ' '; + echo '###################### API ROOT ##############################'; + curl -s -k -u org-admin:redhat http://proxy:8080/api/automation-hub/ | python -m json.tool; + echo '################### DEV_SOURCE_PATH ##########################'; + echo $$DEV_SOURCE_PATH; + echo ' '; + echo '######################## READY ###############################'; + echo ' '; + echo 'Credentials: org-admin:redhat OR jdoe:redhat'; + echo 'API Spec: http://localhost:5001/api/automation-hub/v3/swagger-ui/'; + echo 'API Spec proxy:http://localhost:8080/api/automation-hub/v3/swagger-ui/'; + echo 'Django Admin: docker compose -f dev/compose/aap.yaml exec manager pulpcore-manager'; + echo 'Settings list: docker compose -f dev/compose/aap.yaml exec manager dynaconf list'; + echo 'Docs: https://github.com/ansible/galaxy_ng/blob/master/dev/compose/README.md'; + echo '##############################################################'; + + # Keep it running indefinitely to enable `docker compose -f ... exec manager /bin/bash`; + tail -f /dev/null + " + + nginx: + image: "nginx:latest" + depends_on: + - postgres + - migrations + - api + - content + ports: + - '5001:5001' + volumes: + - '../nginx/nginx.conf:/etc/nginx/nginx.conf:ro' + +volumes: + var_lib_pulp: + name: var_lib_pulp + etc_pulp_certs: + name: etc_pulp_certs + +networks: + service-mesh: + name: service-mesh