-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding tests with a Docker container; updating documentation
- Loading branch information
Yannik Behr
committed
Apr 20, 2017
1 parent
65c831e
commit 1c5c8fb
Showing
8 changed files
with
268 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
playback.cfg | ||
*~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
FROM debian:jessie | ||
|
||
MAINTAINER Yannik Behr <y.behr@gns.cri.nz> | ||
|
||
ENV WORK_DIR /usr/local/src/ | ||
ENV INSTALL_DIR /opt/seiscomp3 | ||
|
||
|
||
# Fix Debian env | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV INITRD No | ||
ENV FAKE_CHROOT 1 | ||
|
||
# Setup sysop's user and group id | ||
ENV USER_ID 1000 | ||
ENV GROUP_ID 1000 | ||
|
||
WORKDIR $WORK_DIR | ||
|
||
RUN echo 'force-unsafe-io' | tee /etc/dpkg/dpkg.cfg.d/02apt-speedup \ | ||
&& echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | tee /etc/apt/apt.conf.d/no-cache \ | ||
&& apt-get update \ | ||
&& apt-get dist-upgrade -y --no-install-recommends \ | ||
&& apt-get install -y \ | ||
build-essential \ | ||
festival \ | ||
cmake \ | ||
cmake-curses-gui \ | ||
flex \ | ||
g++ \ | ||
libgfortran3 \ | ||
libncurses5-dev \ | ||
gfortran \ | ||
git \ | ||
libboost-dev \ | ||
libboost-filesystem-dev \ | ||
libboost-iostreams-dev \ | ||
libboost-program-options-dev \ | ||
libboost-regex-dev \ | ||
libboost-thread-dev \ | ||
libboost-system-dev \ | ||
libboost-signals-dev \ | ||
python \ | ||
python2.7 \ | ||
libpython2.7 \ | ||
libpython2.7-dev \ | ||
libqt4-dev \ | ||
libsqlite3-dev \ | ||
sqlite3 \ | ||
python-twisted \ | ||
libxml2 \ | ||
libxml2-dev \ | ||
openssh-server \ | ||
openssl \ | ||
libssl-dev \ | ||
net-tools \ | ||
vim \ | ||
libfaketime \ | ||
&& git clone --depth=1 https://github.com/yannikbehr/seiscomp3.git \ | ||
&& mkdir -p $WORK_DIR/seiscomp3/build \ | ||
&& cd $WORK_DIR/seiscomp3/build \ | ||
&& cmake .. -DSC_GLOBAL_GUI=OFF -DSC_TRUNK_DB_MYSQL=OFF \ | ||
-DSC_TRUNK_DB_POSTGRESQL=OFF -DSC_TRUNK_DB_SQLITE3=ON \ | ||
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ | ||
&& make -j $(grep -c processor /proc/cpuinfo) \ | ||
&& make install | ||
|
||
WORKDIR /tmp | ||
ADD sc3-files.tar.bz . | ||
|
||
# Now install evscore plugin | ||
RUN cp -r evscore $WORK_DIR/seiscomp3/src/sed/plugins/ \ | ||
&& cp CMakeLists.evscore $WORK_DIR/seiscomp3/src/sed/plugins/CMakeLists.txt \ | ||
&& cd $WORK_DIR/seiscomp3/build \ | ||
&& make -j $(grep -c processor /proc/cpuinfo) \ | ||
&& make install \ | ||
&& apt-get autoremove -y --purge \ | ||
&& apt-get clean | ||
# && rm -rf /var/lib/apt/lists/* /var/tmp/* | ||
|
||
# Setup ssh access | ||
RUN mkdir /var/run/sshd | ||
RUN echo 'root:password' | chpasswd | ||
RUN sed -i 's/PermitRootLogin without-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 | ||
|
||
RUN groupadd --gid $GROUP_ID -r sysop && useradd -m -s /bin/bash --uid $USER_ID -r -g sysop sysop \ | ||
&& echo 'sysop:sysop' | chpasswd \ | ||
&& chown -R sysop:sysop $INSTALL_DIR | ||
|
||
RUN cp -r seiscomp3 /home/sysop/.seiscomp3 \ | ||
&& chown -R sysop:sysop /home/sysop/.seiscomp3 | ||
|
||
USER sysop | ||
|
||
### SeisComp3 settings ### | ||
ENV SEISCOMP_ROOT=/opt/seiscomp3 PATH=/opt/seiscomp3/bin:$PATH \ | ||
LD_LIBRARY_PATH=/opt/seiscomp3/lib:$LD_LIBRARY_PATH \ | ||
PYTHONPATH=/opt/seiscomp3/lib/python:$PYTHONPATH \ | ||
MANPATH=/opt/seiscomp3/share/man:$MANPATH \ | ||
LC_ALL=C | ||
|
||
# Setup SeisComP3 + seedlink | ||
RUN seiscomp --stdin setup <sc3_config.cfg \ | ||
&& mkdir -p /opt/seiscomp3/var/lib/seedlink \ | ||
&& cp seedlink.ini /opt/seiscomp3/var/lib/seedlink/ \ | ||
&& mkdir -p /opt/seiscomp3/var/run/seedlink \ | ||
&& mkfifo -m=666 /opt/seiscomp3/var/run/seedlink/mseedfifo | ||
|
||
# Setup pipelines | ||
RUN seiscomp alias create NLoB_amp scamp \ | ||
&& seiscomp alias create NLoB_apick scautopick \ | ||
&& seiscomp alias create NLoB_auloc scautoloc \ | ||
&& seiscomp alias create NLoB_mag scmag \ | ||
&& seiscomp alias create NTeT_amp scamp \ | ||
&& seiscomp alias create NTeT_apick scautopick \ | ||
&& seiscomp alias create NTeT_auloc scautoloc \ | ||
&& seiscomp alias create NTeT_mag scmag \ | ||
&& seiscomp enable scevent scautopick scautoloc scmag scamp seedlink NLoB_amp \ | ||
NLoB_apick NLoB_auloc NLoB_mag NTeT_amp NTeT_apick NTeT_auloc NTeT_mag | ||
|
||
WORKDIR /home/sysop | ||
|
||
VOLUME ["/home/sysop/data"] | ||
VOLUME ["/home/sysop/sc3-playback"] | ||
|
||
USER root | ||
|
||
EXPOSE 22 | ||
|
||
# Start sshd | ||
CMD ["/usr/sbin/sshd", "-D"] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Testing | ||
## Setting up the docker container | ||
|
||
This directory contains a Dockerfile to generate a fully configured SeisComP3 | ||
installation using a setup similar to the real-time system operated by the | ||
Swiss Seismological Service. To generate the docker image using the Dockerfile | ||
run: | ||
|
||
``` | ||
docker build -t seiscomp3-ch . | ||
``` | ||
|
||
The resulting image has two mount points, one for the directory containing the | ||
playback scripts and one for the waveform data and the database for the | ||
playback. The directory [data](data/) contains a test database file with a | ||
SeisComP3 configuration, inventory, and a multiplexed MiniSEED file for one | ||
event. | ||
|
||
Assuming that the playback script is in the directory | ||
`${HOME}/sc3-playback` and the playback data is under `${PWD}/data` you can | ||
start the container as follows: | ||
|
||
``` | ||
docker run -d --name sc3-ch -p 9999:22 -v ${PWD}/data:/home/sysop/data -v ${HOME}/sc3-playback/:/home/sysop/sc3-playback seiscomp3-ch | ||
``` | ||
|
||
This will also start an ssh server that you can connect to with (password the | ||
same as the user name): | ||
|
||
``` | ||
ssh -p 9999 sysop@localhost | ||
``` | ||
|
||
## Running the playback | ||
First get a shell in your container by running: | ||
``` | ||
docker exec -it --user sysop seiscomp3-ch /bin/bash | ||
``` | ||
|
||
Once you have a shell in your container and assuming your waveform file is | ||
called `test-event.sorted-mseed` and your sqlite3 database `test.db` you can | ||
start a playback as follows: | ||
``` | ||
cd sc3-playback | ||
./playback.py ../data/test.db ../data/test-event.sorted-mseed | ||
``` | ||
You can then use `scolv` to analyse the results from the playback. Note that you | ||
have to start `scolv` on your host machine as no guis are installed in the | ||
container. | ||
|
||
``` | ||
scolv --offline --plugins dbsqlite3 -d sqlite3://${PWD}/data/test.db | ||
``` | ||
By default the user `sysop` inside the container has `USER_ID=1000` and | ||
`GROUP_ID=1000`. If this doesn't match with the permissions of the playback | ||
files on your host machine add the following options to your `docker run` | ||
command: | ||
``` | ||
-e USER_ID=`id -u` -e GROUP_ID=`id -g` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test.db filter=lfs diff=lfs merge=lfs -text | ||
test-event.sorted-mseed filter=lfs diff=lfs merge=lfs -text |
Git LFS file not shown
Git LFS file not shown
Binary file not shown.