-
Notifications
You must be signed in to change notification settings - Fork 16
Added run_container.sh script, formatted README #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
34b7cfd
e67ee06
2293cf1
7157aae
8db5407
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ cypress/videos/* | |
| dist/ | ||
| node_modules/ | ||
| npm-debug.log* | ||
| tests/settings/certs/ | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,85 @@ | ||||||||
| #!/bin/bash | ||||||||
|
|
||||||||
| # This script was originally taken from the https://github.com/pulp/squeezer repository and adapted for pulp-ui | ||||||||
|
|
||||||||
| set -eu | ||||||||
|
|
||||||||
| BASEPATH="$(dirname "$(readlink -f "$0")")" | ||||||||
| export BASEPATH | ||||||||
|
|
||||||||
| if [ -z "${CONTAINER_RUNTIME:+x}" ] | ||||||||
| then | ||||||||
| if command -v podman > /dev/null 2>&1 | ||||||||
| 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}" | ||||||||
|
|
||||||||
| # Check if getenforce is available and set SELINUX accordingly | ||||||||
| if command -v getenforce > /dev/null 2>&1 | ||||||||
| then | ||||||||
| if [ "$(getenforce)" = "Enforcing" ] | ||||||||
| then | ||||||||
| SELINUX="yes" | ||||||||
| else | ||||||||
| SELINUX="" | ||||||||
| fi | ||||||||
| else | ||||||||
| SELINUX="" | ||||||||
| fi | ||||||||
|
|
||||||||
| "${CONTAINER_RUNTIME}" \ | ||||||||
| run ${RM:+--rm} \ | ||||||||
| --env S6_KEEP_ENV=1 \ | ||||||||
| --detach \ | ||||||||
| --name "pulp-ephemeral" \ | ||||||||
| --volume "${BASEPATH}/settings:/etc/pulp${SELINUX:+:Z}" \ | ||||||||
| --publish "8080:80" \ | ||||||||
| --network "bridge" \ | ||||||||
| "docker.io/pulp/pulp:${IMAGE_TAG}" | ||||||||
|
|
||||||||
| # 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/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/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 admin | ||||||||
|
|
||||||||
| PULP_LOGGING="${CONTAINER_RUNTIME}" "$@" | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
and we don't need to document any params for it :)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: 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. |
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| CONTENT_ORIGIN = "http://localhost:8080/" | ||
| ALLOWED_EXPORT_PATHS = ["/tmp"] | ||
| CACHE_ENABLED = True | ||
| REDIS_HOST = "localhost" | ||
| REDIS_PORT = 6379 |
There was a problem hiding this comment.
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)There was a problem hiding this comment.
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.pyand changed.gitignoreto exclude thetests/settings/certs/directory.