Skip to content

Commit e7d5e40

Browse files
committed
Install pynuoadmin
1 parent 073b355 commit e7d5e40

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

docker/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM library/python:3.12-slim
22

3+
ARG PYNUOADMIN_VERSION=2.4.0
4+
35
# Install runtime dependencies
46
RUN set -ex; \
57
apt-get update; \
@@ -20,7 +22,7 @@ RUN mkdir /opt/nuodb-operations \
2022
&& chown 1000:0 /opt/nuodb-operations
2123

2224
# Copy tools code as nuodb user
23-
USER 1000:1000
25+
USER 1000:0
2426

2527
# Copy sidecar scripts
2628
COPY --chown=1000:0 config_watcher/requirements.txt /opt/config_watcher/requirements.txt
@@ -31,6 +33,16 @@ COPY --chown=1000:0 docker/entrypoint.sh /usr/local/bin/
3133
# Install tools requirements
3234
RUN pip3 install -r /opt/config_watcher/requirements.txt
3335

36+
# Install pynuoadmin
37+
RUN pip3 install pynuoadmin==${PYNUOADMIN_VERSION}
38+
RUN echo "export NUOCMD_PYTHONPATH=$(pip show pynuoadmin | sed -ne 's|Location: \(.*\)|\1|p')" >> /home/nuodb/.profile
39+
40+
ENV NUOCMD_CLIENT_KEY /etc/nuodb/keys/nuocmd.pem
41+
ENV NUOCMD_VERIFY_SERVER /etc/nuodb/keys/ca.cert
42+
43+
ENV LANG en_US.UTF-8
44+
ENV HOME /home/nuodb
45+
3446
ENTRYPOINT ["entrypoint.sh"]
3547

3648
CMD [ "config_watcher" ]

docker/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ case "${uid}:${gid}" in
3838
;;
3939
esac
4040

41+
# Configure shell
42+
. /home/nuodb/.profile
43+
4144
# Support well-known commands
4245
case "$1" in
4346
(config_watcher)

docker/user_setup

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,21 @@ cp /etc/passwd /etc/passwd.nuodb
3232
setup_dir /usr/local/bin 0775
3333
) >/dev/null
3434

35-
setup_file /home/nuodb/.bashrc <<"EOF"
35+
setup_file /home/nuodb/.profile <<"EOF"
3636
# Enable nss_wrapper if /tmp/passwd and /tmp/group exist
3737
if [ -f /tmp/passwd -a -f /tmp/group ]; then
3838
export LD_PRELOAD=libnss_wrapper.so
3939
export NSS_WRAPPER_PASSWD=/tmp/passwd
4040
export NSS_WRAPPER_GROUP=/tmp/group
4141
fi
42+
43+
# Add nuocmd to the PATH
44+
export PATH=/home/nuodb/.local/bin:$PATH
45+
EOF
46+
47+
setup_file /home/nuodb/.bashrc <<"EOF"
48+
[ -f /home/nuodb/.profile ] && . /home/nuodb/.profile
49+
50+
# Enable tab completion for nuocmd
51+
. "/home/nuodb/.local/etc/nuocmd-complete"
4252
EOF

0 commit comments

Comments
 (0)