Skip to content
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

default admin password #543

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 CHANGES/417.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added logic for ``PULP_DEFAULT_ADMIN_PASSWORD`` to the pulp-minimal startup scripts.
4 changes: 0 additions & 4 deletions images/Containerfile.core.base
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,11 @@ COPY images/assets/readyz.py /usr/bin/readyz.py
COPY images/assets/route_paths.py /usr/bin/route_paths.py
COPY images/assets/wait_on_postgres.py /usr/bin/wait_on_postgres.py
COPY images/assets/wait_on_database_migrations.sh /usr/bin/wait_on_database_migrations.sh
COPY images/assets/pulp-common-entrypoint.sh /pulp-common-entrypoint.sh
COPY images/assets/pulp-api /usr/bin/pulp-api
COPY images/assets/pulp-content /usr/bin/pulp-content
COPY images/assets/pulp-resource-manager /usr/bin/pulp-resource-manager
COPY images/assets/pulp-worker /usr/bin/pulp-worker

# Need to precreate when running pulp as the pulp user
RUN touch /var/log/galaxy_api_access.log && \
chown pulp:pulp /var/log/galaxy_api_access.log && \
chmod u+rw /var/log/galaxy_api_access.log

ENTRYPOINT ["/pulp-common-entrypoint.sh"]
25 changes: 17 additions & 8 deletions images/assets/pulp-api
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,23 @@ if [ -n "${PULP_SIGNING_KEY_FINGERPRINT}" ]; then
/usr/local/bin/pulpcore-manager add-signing-service "${CONTAINER_SIGNING_SERVICE}" /var/lib/pulp/scripts/container_sign.sh "${PULP_SIGNING_KEY_FINGERPRINT}" --class container:ManifestSigningService
fi

ADMIN_PASSWORD_FILE=/etc/pulp/pulp-admin-password
if [[ -f "$ADMIN_PASSWORD_FILE" ]]; then
echo "pulp admin can be initialized."
PULP_ADMIN_PASSWORD=$(cat $ADMIN_PASSWORD_FILE)
fi

if [ -n "${PULP_ADMIN_PASSWORD}" ]; then
/usr/local/bin/pulpcore-manager reset-admin-password --password "${PULP_ADMIN_PASSWORD}"
if [[ -n "$PULP_DEFAULT_ADMIN_PASSWORD" ]]
then
PASSWORD_SET=$(/usr/local/bin/pulpcore-manager shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username=\"admin\").exists())")
if [ "$PASSWORD_SET" = "False" ]
then
/usr/local/bin/pulpcore-manager reset-admin-password --password "${PULP_DEFAULT_ADMIN_PASSWORD}"
fi
else
ADMIN_PASSWORD_FILE=/etc/pulp/pulp-admin-password
if [[ -f "$ADMIN_PASSWORD_FILE" ]]; then
echo "pulp admin can be initialized."
PULP_ADMIN_PASSWORD=$(cat $ADMIN_PASSWORD_FILE)
fi

if [ -n "${PULP_ADMIN_PASSWORD}" ]; then
/usr/local/bin/pulpcore-manager reset-admin-password --password "${PULP_ADMIN_PASSWORD}"
fi
fi
set -x

Expand Down
14 changes: 0 additions & 14 deletions images/assets/pulp-common-entrypoint.sh

This file was deleted.

14 changes: 0 additions & 14 deletions images/assets/pulp-resource-manager

This file was deleted.

1 change: 0 additions & 1 deletion images/assets/pulp-worker
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
/usr/bin/wait_on_postgres.py
/usr/bin/wait_on_database_migrations.sh

export PULP_SETTINGS=/etc/pulp/settings.py
export PATH=/usr/local/bin:/usr/bin/
exec pulpcore-worker
2 changes: 1 addition & 1 deletion images/assets/readyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def is_content_healthy(path):
The cmdline value for this PID looks like:
```
# pip installation
gunicorn: master \[pulp-{content,api,worker,resource-manager}\]
gunicorn: master \[pulp-{content,api}\]
```
OR
```
Expand Down
2 changes: 1 addition & 1 deletion images/compose/compose.folders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
- "./assets/certs:/etc/pulp/certs:z"
- "../../pulp_storage:/var/lib/pulp:z"
environment:
PULP_ADMIN_PASSWORD: password
PULP_DEFAULT_ADMIN_PASSWORD: password

pulp_content:
image: "pulp/pulp-minimal:latest"
Expand Down
2 changes: 1 addition & 1 deletion images/compose/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
- "./assets/certs:/etc/pulp/certs:z"
- "pulp:/var/lib/pulp"
environment:
PULP_ADMIN_PASSWORD: password
PULP_DEFAULT_ADMIN_PASSWORD: password
restart: always

pulp_content:
Expand Down
4 changes: 4 additions & 0 deletions images/pulp-minimal/stable/Containerfile.core
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ RUN pip3 install --upgrade \
pulp-ostree${PULP_OSTREE_VERSION} && \
rm -rf /root/.cache/pip

# Prevent pip-installed /usr/local/bin/pulp-content from getting run instead of
# our /usr/bin/pulp-content script.
RUN rm -r /usr/local/bin/pulp-content

USER pulp:pulp
RUN PULP_STATIC_ROOT=/var/lib/operator/static/ PULP_CONTENT_ORIGIN=localhost \
/usr/local/bin/pulpcore-manager collectstatic --clear --noinput --link
Expand Down
Loading