Skip to content

Commit

Permalink
use right ports for pulp in http config
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni authored and archanaserver committed Nov 5, 2024
1 parent c0a052c commit ced9c95
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 34 deletions.
4 changes: 2 additions & 2 deletions roles/httpd/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
httpd_ssl_dir: /etc/pki/httpd
httpd_pulp_api_backend: http://localhost:8080
httpd_pulp_content_backend: http://localhost:8080
httpd_pulp_api_backend: http://localhost:24817
httpd_pulp_content_backend: http://localhost:24816
httpd_foreman_backend: http://localhost:3000
8 changes: 4 additions & 4 deletions roles/pulp/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
pulp_api_image: quay.io/pulp/pulp-minimal:stable
pulp_content_image: quay.io/pulp/pulp-minimal:stable
pulp_worker_image: quay.io/pulp/pulp-minimal:stable
pulp_image: quay.io/pulp/pulp-minimal:stable
pulp_api_image: "{{ pulp_image }}"
pulp_content_image: "{{ pulp_image }}"
pulp_worker_image: "{{ pulp_image }}"

pulp_api_ports:
- "24817:80"
Expand All @@ -11,7 +12,6 @@ pulp_worker_count: 2

pulp_volumes:
- /var/lib/pulp/pulp_storage:/var/lib/pulp
- /var/lib/pulp/containers:/var/lib/containers

pulp_api_container_name: pulp-api
pulp_content_container_name: pulp-content
Expand Down
5 changes: 4 additions & 1 deletion roles/pulp/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
- |
[Install]
WantedBy=default.target
Wants=postgresql.service
- name: Deploy Pulp Content Container
containers.podman.podman_container:
Expand All @@ -92,6 +93,7 @@
- |
[Install]
WantedBy=default.target
Wants=postgresql.service
- name: Deploy Pulp Worker Container
containers.podman.podman_container:
Expand All @@ -110,6 +112,7 @@
- |
[Install]
WantedBy=default.target
Wants=postgresql.service
- name: Run daemon reload to make Quadlet create the service files
ansible.builtin.systemd:
Expand All @@ -121,7 +124,7 @@
enabled: true
state: started

- name: Migrate the Pylp database
- name: Migrate the Pulp database
containers.podman.podman_container_exec:
name: "{{ pulp_api_container_name }}"
command: pulpcore-manager migrate --noinput
Expand Down
5 changes: 2 additions & 3 deletions roles/pulp/templates/settings.py.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
CONTENT_ORIGIN="http://{{ ansible_hostname }}:8080"
API_CONTENT_ORIGIN="http://{{ ansible_hostname }}:24817"
CONTENT_SERVICE_ORIGIN="http://{{ ansible_hostname }}:24816"
CONTENT_ORIGIN="http://{{ ansible_hostname }}:24816"
CACHE_ENABLED=True
REDIS_HOST="localhost"
REDIS_PORT=6379
REDIS_DB=8

DATABASES = {
'default': {
Expand Down
33 changes: 9 additions & 24 deletions tests/pulp_test.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
import json
import pytest


PULP_HOST = 'localhost'
PULP_PORT = 8080
PULP_API_PORT = 24817
PULP_CONTENT_PORT = 24816

@pytest.fixture(scope="module")
def pulp_status_curl(host):
return host.run(f"curl -k -s -w '%{{stderr}}%{{http_code}}' http://{PULP_HOST}:{PULP_PORT}/pulp/api/v3/status/")

return host.run(f"curl -k -s -w '%{{stderr}}%{{http_code}}' http://{PULP_HOST}:{PULP_API_PORT}/pulp/api/v3/status/")

@pytest.fixture(scope="module")
def pulp_status(pulp_status_curl):
return json.loads(pulp_status_curl.stdout)


def test_pulp_service(host):
pulp = host.service("pulp")
assert pulp.is_running
assert pulp.is_enabled

def test_pulp_api_service(host):
pulp_api = host.service("pulp-api")
assert pulp_api.is_running
Expand All @@ -32,15 +23,10 @@ def test_pulp_content_service(host):
assert pulp_content.is_running
assert pulp_content.is_enabled

def test_pulp_worker_services(host):
for i in range(1, 3):
pulp_worker = host.service(f"pulp-worker@{i}")
assert pulp_worker.is_running
assert pulp_worker.is_enabled

def test_pulp_port(host):
pulp = host.addr(PULP_HOST)
assert pulp.port(PULP_PORT).is_reachable
def test_pulp_worker_service(host):
pulp_worker = host.service("pulp-worker")
assert pulp_worker.is_running
assert pulp_worker.is_enabled

def test_pulp_api_port(host):
pulp_api = host.addr(PULP_HOST)
Expand All @@ -50,10 +36,6 @@ def test_pulp_content_port(host):
pulp_content = host.addr(PULP_HOST)
assert pulp_content.port(PULP_CONTENT_PORT).is_reachable

def test_pulp_status(pulp_status_curl):
assert pulp_status_curl.succeeded
assert pulp_status_curl.stderr == '200'

def test_pulp_status_database_connection(pulp_status):
assert pulp_status['database_connection']['connected']

Expand All @@ -75,6 +57,9 @@ def test_pulp_status_workers(pulp_status):

@pytest.mark.xfail(reason='password auth is deactivated when we use cert auth')
def test_pulp_admin_auth(host):
cmd = host.run(f"curl --silent --write-out '%{{stderr}}%{{http_code}}' --user admin:CHANGEME http://{PULP_HOST}:{PULP_PORT}/pulp/api/v3/users/")
cmd = host.run(f"curl --silent --write-out '%{{stderr}}%{{http_code}}' --user admin:CHANGEME http://{PULP_HOST}:{PULP_API_PORT}/pulp/api/v3/users/")
assert cmd.succeeded
assert cmd.stderr == '200'

def test_pulp_volumes(host):
assert host.file("/var/lib/pulp").is_directory

0 comments on commit ced9c95

Please sign in to comment.