X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fremote-installer.git;a=blobdiff_plain;f=docker-build%2Fremote-installer%2FDockerfile;h=3c540561c71d72e609d5a8755383569bdfff5366;hp=0c06de4e382816179787218d30a6f44ca6893209;hb=5529dff990973f223eeff6601da4f466fead6a32;hpb=f9adb9143ef94b16ae16941652e75deccad506ef diff --git a/docker-build/remote-installer/Dockerfile b/docker-build/remote-installer/Dockerfile index 0c06de4..3c54056 100644 --- a/docker-build/remote-installer/Dockerfile +++ b/docker-build/remote-installer/Dockerfile @@ -17,6 +17,7 @@ MAINTAINER Ralf Mueller ENV \ ETC_REMOTE_INST="/etc/remoteinstaller" \ +SCRIPTS_DIR="/opt/scripts" \ PW="root" \ API_PORT="15101" \ API_LISTEN_ADDR="0.0.0.0" \ @@ -28,7 +29,8 @@ CLIENT_CERT="clientcert.pem" \ CLIENT_KEY="clientkey.pem" \ SERVER_CERT="servercert.pem" \ SERVER_KEY="serverkey.pem" \ -INSTALLER_MOUNT="/opt/remoteinstaller" +INSTALLER_MOUNT="/opt/remoteinstaller" \ +SSH_PORT="22" ENV IMAGES_STORE="$INSTALLER_MOUNT/images" ENV IMAGES_HTML="/var/www/lighttpd/images" @@ -50,7 +52,7 @@ RUN yum -y install systemd epel-release; yum clean all \ && yum install -y iproute wget openssh-server lighttpd nfs-utils \ python-setuptools python2-eventlet python-routes PyYAML \ python-netaddr pexpect net-tools tcpdump \ -ipmitool \ +ipmitool openssh-clients sshpass nmap-ncat python-configparser\ # mod_ssl \ && systemctl enable sshd \ && systemctl enable lighttpd \ @@ -90,19 +92,29 @@ RUN pushd "$INSTALLER_MOUNT" \ && rm -rf * \ && popd -RUN mkdir -p "$ETC_REMOTE_INST" +RUN mkdir -p "$SCRIPTS_DIR" \ +&& mkdir -p "$ETC_REMOTE_INST" -RUN echo '#!/bin/bash' >>$STARTUP \ +COPY src/scripts/get_journals.sh "$SCRIPTS_DIR"/ + +RUN echo '#!/bin/bash -x' >>$STARTUP \ +&& echo "function handle_sigterm() {" >>$STARTUP \ +&& echo -e " echo Stopping nfs-server" >>$STARTUP \ +&& echo -e " systemctl stop nfs-server" >>$STARTUP \ +&& echo -e " exit 0" >>$STARTUP \ +&& echo "}" >>$STARTUP \ +&& echo "trap 'handle_sigterm' 15" >>$STARTUP \ && echo 'printenv >/etc/remoteinstaller/environment' >>$STARTUP \ -&& echo mkdir /run/systemd/system >>$STARTUP \ -&& echo nohup /usr/lib/systemd/systemd --system '&>/dev/null &' >>$STARTUP \ +&& echo 'mkdir /run/systemd/system' >>$STARTUP \ +&& echo 'nohup /usr/lib/systemd/systemd --system' '&>/dev/null &' >>$STARTUP \ && echo "echo -e \"\$PW\n\$PW\n\n\" |passwd" >>$STARTUP \ && echo mount -o bind "$IMAGES_STORE" "$IMAGES_HTML" >>$STARTUP \ && echo 'sed -i "s/server.port = 80/server.port = $HTTPS_PORT/" /etc/lighttpd/lighttpd.conf' >>$STARTUP \ +&& echo 'sed -i "s/.*Port 22/Port $SSH_PORT/" /etc/ssh/sshd_config' >>$STARTUP \ # && echo "echo \\\$SERVER[\\\"sockets\\\"] == \\\"0.0.0.0:\$HTTPS_PORT {}\\\" >> /etc/lighttpd/lighttpd.conf" >>$STARTUP \ && echo python /lib/python2.7/site-packages/remoteinstaller-1.0-py2.7.egg/remoteinstaller/server/server.py \ - -H \$API_LISTEN_ADDR -P \$API_PORT -S \$HOST_ADDR \ - -C \$SERVER_CERT -K \$SERVER_KEY -c \$CLIENT_CERT -k \$CLIENT_KEY -A \$CA_CERT -d \ + -H \$API_LISTEN_ADDR -P \$API_PORT -S \$HOST_ADDR -T \$HTTPS_PORT \ + -C \$SERVER_CERT -K \$SERVER_KEY -c \$CLIENT_CERT -k \$CLIENT_KEY -A \$CA_CERT -d \& \ >>$STARTUP \ && echo 'while [ false ]; do sleep 5 ;done' >>$STARTUP \ && chmod +x $STARTUP