Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create docker image

Currently this is a hack

The procedure: 

  • create ansible/docker-compose/templates/soaktest/Dockerfile and ansible/docker-compose/templates/soaktest/docker-compose.yml
  • deploy somewhere
  • create an image from the running instance, then push the iage to the docker registry

Dockerfile

Code Block
FROM ubuntu:18.04
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
RUN apt-get update && apt-get install -y gnupg wget
RUN apt-get install -y openssh-server
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

EXPOSE 22
RUN mkdir -p /run/sshd
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list && \
    echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \
    apt-get -y update && \
    echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
    apt-get install -y oracle-java8-installer && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/oracle-jdk8-installer
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN apt-get update && apt-get install -y google-chrome-stable && mkdir /Jmeter && chmod 755 -R /Jmeter
RUN useradd -ms /bin/bash soaktester
#RUN chmod +x /Jmeter/bin/jmeter
#USER soaktester
#COPY /tmp/Jmeter/* /Jmeter/
ENV JMETER_HOME=/Jmeter
ENV PATH $JMETER_HOME/bin:$PATH
#VOLUME /result
#VOLUME /Jmeter
ENV DISPLAY=:1
WORKDIR /Jmeter
CMD ["/usr/sbin/sshd", "-D"]
#ENTRYPOINT ["sh", "-c", "./bin/jmeter -n -t ./SoakTestPlan.jmx -l /result/TestResult.jtl"]


docker-compose.yml

Code Block
version: '2'

services:
  soaktest:
    restart: "on-failure:1"
    build: .
    logging:
      options:
        max-size: '500m'
        max-file: '3'
    cap_add:
    - SYS_ADMIN
    volumes:
      - /tmp/Jmeter:/Jmeter
      - /dev/shm:/dev/shm # Mitigates the Chromium issue described at https://code.google.com/p/chromium/issues/detail?id=519952

...

then enter the docker instance and do this hack

Code Block
# cp /opt/google/chrome/google-chrome /opt/google/chrome/google-chrome.real
# echo '/opt/google/chrome/google-chrome.real --headless --no-gui "$@"' > /opt/google/chrome/google-chrome

...