Running AI6VN's kiwiwspr.sh in a Docker container
Hello,
I have just begun running AI6VN's `kiwiwspr.sh` in a Docker container. (Thank you, Robert, for the script. Fantastic work!).
The solution is particularly useful if you intend to run the monitor in the cloud and/or if you want to do it without installing anything on your machine (except for the Docker engine, of course!).
Here is my Dockefile:
- no need to install anything (except for Docker, if you don't have it already)
- integrate WSPR monitoring on your kiwi by running a single command
- runs on on Linux, macOS or Windows - unmodified
- easily runs in the cloud
Cons:
- Needs the Docker engine
- Will run under UTC time
- more disk space is needed
To-do:
- Make wsprd run on Alpine instead of Debian
- Remove x11 and all of its dependencies
- Test if the image can run on a Raspberry PI
I hope this can be of some interest to someone.
Alain
I have just begun running AI6VN's `kiwiwspr.sh` in a Docker container. (Thank you, Robert, for the script. Fantastic work!).
The solution is particularly useful if you intend to run the monitor in the cloud and/or if you want to do it without installing anything on your machine (except for the Docker engine, of course!).
Here is my Dockefile:
FROM debian:9
RUN deps='gpg curl git' && \
apt-get update && apt-get install -y $deps bc ntp python-numpy procps && \
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 862549F9 && \
echo "deb http://ppa.launchpad.net/ki7mt/wsjtx/ubuntu xenial main" >> /etc/apt/sources.list && \
apt-get update && apt-get install -y wsjtx && \
cd /root && git clone https://github.com/jks-prv/kiwiclient.git && chmod +x /root/kiwiclient/kiwirecorder.py && \
mkdir /root/kiwiclient/kiwiwspr && \
curl -L http://forum.kiwisdr.com/uploads/Uploader/24/69e0f37e0a99a477ac3861ea99f04b.sh > /root/kiwiclient/kiwiwspr/kiwiwspr.sh && \
chmod +x /root/kiwiclient/kiwiwspr/kiwiwspr.sh && \
apt-get purge -y --auto-remove $deps
COPY entrypoint.sh /root/kiwiclient/kiwiwspr/entrypoint.sh
WORKDIR /root/kiwiclient/kiwiwspr
ENTRYPOINT ["/root/kiwiclient/kiwiwspr/entrypoint.sh"]
Since Rob's script always and only run daemonized, I added a little check in the Entrypoint:
#!/bin/bash
./kiwiwspr.sh -w a
while ps cax | grep -q kiwiwspr.sh
do
sleep 3
done
Once the image is built (and perhaps uploaded to Dockerhub) you can run everything with a single command:
docker run -d --rm --name kiwiwspr -v [full path to your .conf file]:/root/kiwiclient/kiwiwspr/kiwiwspr.conf [docker image]
Here is an example configuration file:
declare KIWI_LIST=(
### OurID(no spaces) IP:PORT MyCall MyGrid KiwPassword (NULL => none required)
"SDR_0 MY_HOST:8073 MYCALL MYGRID NULL"
)
declare WSPR_SCHEDULE=(
"07:00 SDR_0,40 SDR_0,30 SDR_0,20 SDR_0,17 SDR_0,15 SDR_0,10"
"16:00 SDR_0,2200 SDR_0,630 SDR_0,160 SDR_0,80 SDR_0,60 SDR_0,40"
)
Pros:- no need to install anything (except for Docker, if you don't have it already)
- integrate WSPR monitoring on your kiwi by running a single command
- runs on on Linux, macOS or Windows - unmodified
- easily runs in the cloud
Cons:
- Needs the Docker engine
- Will run under UTC time
- more disk space is needed
To-do:
- Make wsprd run on Alpine instead of Debian
- Remove x11 and all of its dependencies
- Test if the image can run on a Raspberry PI
I hope this can be of some interest to someone.
Alain
Comments
I wrote my script in bash and have it running natively on a Pi, i86 Debian and Max OSX. My primary goal for further development work is additional functionality, but let me know if I can make changes to make it more portable as well.
Rob
Yes I noticed the effort to have the daemon run on Macs. Yet, I thought that running it with a single command and without installing anything was a nice thing to have.
I didn't want to publish my own image but if I had anyone could have run your script by running a single command, literally in one second.
A change that would be definitely appropriate for running this in a container would be the possibility of starting the service without daemonizing it and (for extra points) having the output streamed to STDOUT and STDERR rather than written to logfiles.
Alain