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

[IVANCHUK] Fix ivanchuk container image #19919

Merged
merged 6 commits into from
Mar 4, 2020
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
19 changes: 4 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,9 @@ RUN yum -y install --setopt=tsflags=nodocs \
postgresql-server \
repmgr10 \
mod_ssl \
openssh-clients \
openssh-server \
&& \
yum clean all

VOLUME [ "/var/lib/pgsql/data" ]

# Initialize SSH
RUN ssh-keygen -q -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key && \
ssh-keygen -q -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key && \
ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
for key in /etc/ssh/ssh_host_*_key.pub; do echo "localhost $(cat ${key})" >> /root/.ssh/known_hosts; done && \
echo "root:smartvm" | chpasswd && \
chmod 700 /root/.ssh && \
chmod 600 /root/.ssh/*

## Copy/link the appliance files again so that we get ssl
RUN ${APPLIANCE_ROOT}/setup && \
mv /etc/httpd/conf.d/ssl.conf{,.orig} && \
Expand All @@ -37,7 +23,7 @@ RUN ${APPLIANCE_ROOT}/setup && \
## Copy appliance-initialize script and service unit file
COPY docker-assets/appliance-initialize.sh /usr/bin

EXPOSE 443 22
EXPOSE 443

## Atomic Labels
# The UNINSTALL label by DEFAULT will attempt to delete a container (rm) and image (rmi) if the container NAME is the same as the actual IMAGE
Expand Down Expand Up @@ -67,3 +53,6 @@ LABEL io.k8s.description="ManageIQ is a management and automation platform for v
io.k8s.display-name="ManageIQ" \
io.openshift.expose-services="443:https" \
io.openshift.tags="ManageIQ,miq,manageiq"

VOLUME [ "/var/lib/pgsql/data" ]
VOLUME [ ${APP_ROOT} ]
18 changes: 12 additions & 6 deletions docker-assets/appliance-initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
[ -f /etc/default/evm ] && . /etc/default/evm
[[ -s ${CONTAINER_SCRIPTS_ROOT}/container-deploy-common.sh ]] && source "${CONTAINER_SCRIPTS_ROOT}/container-deploy-common.sh"

# Check if memcached is running, if not start it
pidof memcached
test $? -ne 0 && /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024 -l 127.0.0.1 -d

function create_v2_key() {
V2_KEY=$(ruby -ropenssl -rbase64 -e 'puts Base64.strict_encode64(Digest::SHA256.digest(OpenSSL::Random.random_bytes(32))[0, 32])')
write_v2_key
Expand All @@ -17,7 +21,12 @@ echo "== Checking MIQ database status =="
[[ -d /var/lib/pgsql/data/base ]]
if [ $? -eq 0 ]; then
echo "** DB already initialized"
exit 0
echo "** Starting postgresql"

su postgres -c "pg_ctl -D ${APPLIANCE_PG_DATA} start"
test $? -ne 0 && echo "!! Failed to start postgresql service" && exit 1

bundle exec rake db:migrate
else
echo "** DB has not been initialized"

Expand All @@ -35,10 +44,6 @@ else
su postgres -c "psql -c \"CREATE ROLE root SUPERUSER LOGIN PASSWORD 'smartvm'\""
test $? -ne 0 && echo "!! Failed to inject MIQ root Role" && exit 1

# Check if memcached is running, if not start it
pidof memcached
test $? -ne 0 && /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024 -l 127.0.0.1 -d

echo "** Starting DB setup"
pushd ${APP_ROOT}
create_v2_key
Expand All @@ -48,5 +53,6 @@ else
echo "** MIQ database has been initialized"

generate_miq_server_cert.sh
exit 0
fi

rm -f /var/www/miq/vmdb/tmp/pids/evm.pid