Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ cypress/videos/*
dist/
node_modules/
npm-debug.log*
tests/settings
Copy link
Collaborator

@himdel himdel Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

squeezer does actually have tests/settings, which are NOT gitignored .. sounds like a meaningful difference given https://github.com/pulp/pulp-ui/pull/250/files#r2231553649

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my mistake, I've added tests/testtings/settings.py and changed .gitignore to exclude the tests/settings/certs/ directory.

53 changes: 13 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,37 @@ A community driven UI for [Pulp](https://pulpproject.org/).

## How to run

### backend
### Backend

You can follow the [pulp-oci-images quickstart](https://pulpproject.org/pulp-oci-images/docs/admin/tutorials/quickstart/),
TLDR:
The `tests/run_container.sh` script is provided and allows you to run a command with a [Pulp in one](https://pulpproject.org/pulp-in-one-container/) container active.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your link does not work. Keep the one that does please.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have re-added original setup documentation

It requires Docker or Podman to be installed.
The default credentials are:
Username: admin
Password: password

#### setup:

```sh
mkdir -p ~/pulp-backend-oci/{settings/certs,pulp_storage,pgsql,containers}
cd ~/pulp-backend-oci/
echo "
CONTENT_ORIGIN='http://$(hostname):8080'
ANSIBLE_API_HOSTNAME='http://$(hostname):8080'
ANSIBLE_CONTENT_HOSTNAME='http://$(hostname):8080/pulp/content'
" >> settings/settings.py
```

#### run:

```sh
cd ~/pulp-backend-oci/
podman run --publish 8080:80 \
--replace --name pulp \
--volume "$(pwd)/settings":/etc/pulp \
--volume "$(pwd)/pulp_storage":/var/lib/pulp \
--volume "$(pwd)/pgsql":/var/lib/pgsql \
--volume "$(pwd)/containers":/var/lib/containers \
docker.io/pulp/pulp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the minimal setup documented please

It's more useful as 20 lines of docs, than 100 lines of script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have re-added original setup documentation

./tests/run_container sleep inf
```

#### check:
#### Check:

```sh
curl localhost:8080/pulp/api/v3/status/ | jq
```

or open http://localhost:8080/pulp/api/v3/status/

#### change password:

```sh
podman exec -it pulp pulpcore-manager reset-admin-password --password admin
```
```sh
docker exec -it compose-pulp_api-1 pulpcore-manager reset-admin-password --password admin
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this please. This is where I look when I need to change the backend password, it's not so useful when hidden inside a script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back to readme

#### configure `pulp-cli`:
#### Configure `pulp-cli`:

```sh
pip install pulp-cli[pygments]
pulp config create --username admin --base-url http://localhost:8080 --password admin
pulp config create --username admin --base-url http://localhost:8080 --password password

pulp --help
pulp user list
```

### frontend
### Frontend

You can clone the frontend from https://github.com/pulp/pulp-ui .

Expand All @@ -72,12 +45,12 @@ npm run start

and open http://localhost:8002/ :tada: :)

If your API listens elsewhere, you can use `API_PROXY=http://elsewhere:12345 npm run start` instead. Do note that the server at `elsewhere` has to be configured to allow CORS requests for `localhost` (where UI actually listens); using something like `changeOrigin` is out of scope for pulp-ui, and breaks pulp API URLs (because the domains are based on the Origin header). Do NOT use webpack proxy in production.
If your PULP API listens elsewhere, you can use `API_PROXY=http://elsewhere:12345 npm run start` instead. Do note that the server at `elsewhere` has to be configured to allow CORS requests for `localhost` (where UI actually listens); using something like `changeOrigin` is out of scope for pulp-ui, and breaks pulp API URLs (because the domains are based on the Origin header). Do NOT use webpack proxy in production.


## Misc

### post-build configuration
### Post-build configuration

The UI builds produced by `npm run build` can be further configured by serving a `/pulp-ui-config.json` alongside the built UI.
(Note it has to be mapped at `/`, not just wherever `index.html` is served from.)
Expand Down
97 changes: 97 additions & 0 deletions tests/run_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#!/bin/sh
#!/bin/bash

given the rest of the script, this has to be bash not sh - at least $() won't work in plain sh, and I'm not sure about all those ${:+} either.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the original author wrote this with sh as a symlink to bash. Have updated it point directly to bash.


# This file is shared between some projects please keep all copies in sync
# Known places:
# - https://github.com/pulp/pulp-cli/blob/main/.ci/run_container.sh
# - https://github.com/pulp/pulp-cli-deb/blob/main/.ci/run_container.sh
# - https://github.com/pulp/pulp-cli-ostree/blob/main/.ci/run_container.sh
# - https://github.com/pulp/squeezer/blob/develop/tests/run_container.sh
# - https://github.com/pulp/pulp-ui/blob/main/tests/run_container.sh

set -eu

BASEPATH="$(dirname "$(readlink -f "$0")")"
export BASEPATH

if [ -z "${CONTAINER_RUNTIME:+x}" ]
then
if ls /usr/bin/podman
then
CONTAINER_RUNTIME=podman
else
CONTAINER_RUNTIME=docker
fi
fi
export CONTAINER_RUNTIME

if [ -z "${KEEP_CONTAINER:+x}" ]
then
RM="yes"
else
RM=""
fi

IMAGE_TAG="${IMAGE_TAG:-latest}"
FROM_TAG="${FROM_TAG:-latest}"

if [ "${CONTAINER_FILE:+x}" ]
then
IMAGE_TAG="ephemeral-build"
"${CONTAINER_RUNTIME}" build --file "${BASEPATH}/assets/${CONTAINER_FILE}" --build-arg FROM_TAG="${FROM_TAG}" --tag ghcr.io/pulp/pulp:"${IMAGE_TAG}" .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--tag ghcr.io/pulp/pulp:"${IMAGE_TAG}"

This looks wrong, nothing in this repo should be building a pulp/pulp image.

And it very clearly doesn't come from ghcr.io, so maybe not that either? Just name it pulp-ui or something?

Copy link
Author

@glisignoli glisignoli Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed from run_container.sh script.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BASEPATH points to pulp-ui/tests/, which is empty except for run_container.sh

Which /assets/ are we talking about?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed from run_container.sh script.

fi

if [ "$(getenforce)" = "Enforcing" ]; then
Copy link
Collaborator

@himdel himdel Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bash: getenforce: command not found

you will need to check for its existence first

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a check to determine if getenforce is present

SELINUX="yes"
else
SELINUX=""
fi;

"${CONTAINER_RUNTIME}" \
run ${RM:+--rm} \
--env S6_KEEP_ENV=1 \
${PULP_API_ROOT:+--env PULP_API_ROOT} \
--detach \
--name "pulp-ephemeral" \
--volume "${BASEPATH}/settings:/etc/pulp${SELINUX:+:Z}" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and here, there is no pulp-ui/tests/settings)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my mistake, I've added settings.py and changed .gitignore to exclude the tests/settings/certs/ directory.

--publish "8080:80" \
--network "bridge" \
"ghcr.io/pulp/pulp:${IMAGE_TAG}"
Copy link
Collaborator

@himdel himdel Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and here, ghcr.io/pulp/pulp is not the right name)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this to docker.io


# shellcheck disable=SC2064
trap "${CONTAINER_RUNTIME} stop pulp-ephemeral" EXIT
# shellcheck disable=SC2064
trap "${CONTAINER_RUNTIME} stop pulp-ephemeral" INT

echo "Wait for pulp to start."
for counter in $(seq 40 -1 0)
do
if [ "$counter" = "0" ]
then
echo "FAIL."
"${CONTAINER_RUNTIME}" images
"${CONTAINER_RUNTIME}" ps -a
"${CONTAINER_RUNTIME}" logs "pulp-ephemeral"
exit 1
fi

sleep 3
if curl --fail "http://localhost:8080${PULP_API_ROOT:-/pulp/}api/v3/status/" > /dev/null 2>&1
then
echo "SUCCESS."
break
fi
echo "."
done

# show pulpcore/plugin versions we're using
curl -s "http://localhost:8080${PULP_API_ROOT:-/pulp/}api/v3/status/" | jq '.versions|map({key: .component, value: .version})|from_entries'

# Set admin password
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" pulpcore-manager reset-admin-password --password password

if [ -d "${BASEPATH}/container_setup.d/" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and here, there is no pulp-ui/tests/container_setup.d/)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed from run_container.sh script.

then
run-parts --regex '^[0-9]+-[-_[:alnum:]]*\.sh$' "${BASEPATH}/container_setup.d/"
fi

PULP_LOGGING="${CONTAINER_RUNTIME}" "$@"
Copy link
Collaborator

@himdel himdel Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PULP_LOGGING="${CONTAINER_RUNTIME}" "$@"
echo Press ^C to stop the container 1>&2
sleep inf

and we don't need to document any params for it :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think of this. But one way this script can be use is running it with test software, Squeezer (ansible module) does it like this:

./tests/run_container.sh make livetest

This allows a user to start a pulp oci container, run tests against it and automatically have it remove itself when complete.

This script could be used in the same way for this repository in the future.