├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── config_example.env ├── docker-compose.hybrid.yml ├── docker-compose.yml └── run.sh /.gitignore: -------------------------------------------------------------------------------- 1 | config.yaml 2 | config_options.txt 3 | config.env -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ## PLEASE DON'T CHANGE ANYTHING IN THIS FILE UNLESS YOU'RE developing. 2 | ## REFER TO THE DOCUMENTATION FOR CONFIGURATION OF YOUR HAMCLOCK! 3 | FROM alpine 4 | 5 | # Configuration. Will be overwritten using the config.yaml file or docker run configuration. 6 | ENV CALLSIGN="AB1CDE" 7 | ENV LOCATOR="JJ00aa" 8 | ENV LAT="00" 9 | ENV LONG="00" 10 | ENV UTC_OFFSET="2" 11 | ENV VOACAP_MODE="38" 12 | ENV VOACAP_POWER="100" 13 | ENV CALLSIGN_BACKGROUND_COLOR="100,100,100" 14 | ENV CALLSIGN_BACKGROUND_RAINBOW="0" 15 | ENV CALLSIGN_COLOR="0,0,0" 16 | ENV FLRIG_PORT="12345" 17 | ENV FLRIG_HOST="localhost" 18 | ENV USE_FLRIG="0" 19 | ENV USE_METRIC="1" 20 | 21 | USER root 22 | WORKDIR /root/hamclock 23 | # Install prerequisites 24 | RUN apk add curl make g++ libx11-dev openssl unzip perl 25 | 26 | # Install Hamclock 27 | RUN rm -fr ESPHamClock && \ 28 | curl -O https://www.clearskyinstitute.com/ham/HamClock/ESPHamClock.zip && \ 29 | unzip ESPHamClock.zip && \ 30 | cd ESPHamClock && \ 31 | make -j 4 hamclock-web-2400x1440 && \ 32 | make install 33 | 34 | # Install Hamclock Contrib and move hceeprom to hamclock directory 35 | RUN cd /root/hamclock && \ 36 | curl -O https://www.clearskyinstitute.com/ham/HamClock/hamclock-contrib.zip && \ 37 | unzip hamclock-contrib.zip 38 | RUN mv hamclock-contrib/hceeprom.pl /root/hamclock/ESPHamClock 39 | WORKDIR /root/hamclock/ESPHamClock 40 | RUN chmod +x hceeprom.pl 41 | 42 | # Run Hamclock for 15 seconds in order to create config file 43 | RUN /usr/local/bin/hamclock -t 20 & sleep 15; kill -INT %+ 44 | 45 | # Copy runfile 46 | WORKDIR /root/hamclock 47 | COPY run.sh . 48 | RUN chmod +x run.sh 49 | 50 | WORKDIR /root/hamclock/ESPHamClock 51 | CMD /root/hamclock/run.sh -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Julius Zeidler 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hamclock Docker 2 | 3 | "HamClock is a kiosk-style application that provides real time space weather, radio propagation models, operating events and other information particularly useful to the radio amateur." (Source: Hamclock Website) 4 | 5 | Goal of this repository is to build and run Hamclock inside Docker for ease of use. 6 | Hamclock will be exposed as a webservice on [http://localhost:8081/live.html](http://localhost:8081/live.html) 7 | 8 | This repository does NOT contain any Hamclock source files as it's neither neccessary nor is the licensing clear. The files will be downloaded and compiled during `docker build`. 9 | 10 | More information and documentation on the Hamclock Website: 11 | [https://www.clearskyinstitute.com/ham/HamClock/](https://www.clearskyinstitute.com/ham/HamClock/) 12 | 13 | ## How to use 14 | ### Prerequisites 15 | I assume that you're on some form of Linux/Unix system. 16 | Docker and (optionally) Docker Compose are installed. 17 | This may or may not work inside Windows WSL2 environment. I've not tested it and most likley will. Please give feedback if you tested this. :) 18 | 19 | As of now, i don't have a raspbery Pi. WB0OEW gave me the feedback, that the `docker-compose` variant doesn't work on his Pi4, we're going to work that out. 20 | 21 | ### Install/Usage 22 | #### Docker (Hard mode) 23 | 1. Check out this repository and change into it 24 | 2. Copy the `config_example.env` to `config.env` and edit to your liking 25 | 3. Inside the repository, run `docker build -t hamclock .` 26 | 4. Run Hamclock using `docker run --rm --name hamclock -d -it -p 8081:8081 -p 8080:8080 --env-file config.env hamclock` 27 | 5. Enjoy WB0OEW's hard work on [http://localhost:8081/live.html](http://localhost:8081/live.html) 28 | 6. To stop Hamclock, run `docker stop hamclock` 29 | 30 | #### Docker Compose (Easy mode) 31 | 1. Check out this repository and change into it 32 | 2. Copy the `config_example.env` to `config.env` and edit to your liking 33 | 3. Inside the repository, run `docker-compose up -d` 34 | 4. Enjoy WB0OEW's hard work on [http://localhost:8081/live.html](http://localhost:8081/live.html) 35 | 5. To stop Hamclock, simply run `docker-compose down` 36 | 37 | #### Docker Compose Hybrid (Build Docker image then use it in Docker Compose) 38 | 1. Clone this repo 39 | ``` cmd 40 | git clone https://github.com/zeidlos/hamclock-docker.git 41 | ``` 42 | 2. Change directory into the repo 43 | ``` cmd 44 | cd hamclock-docker 45 | ``` 46 | 3. Copy the `config_example.env` to `config.env` and edit to your liking 47 | 4. Build the Docker image for the Dockerfile with this commad 48 | ``` cmd 49 | docker build -t hamclock:latest . 50 | ``` 51 | 5. Run the container with this command 52 | ``` cmd 53 | docker-compose -f docker-compose.hybrid.yml up -d 54 | ``` 55 | ##### you can change the ports, docker network, and other things you may need by editing the docker-compose.hybrid.yml file ##### 56 | ##### Also note that if you change the port that the container is using you will need to change the address to access Hamclock 57 | ex: with the port changed to 9500 the address to access hamclock will be http://localhost:9500/live.html 58 | 59 | ### Advanced (Server/Cloud) usage 60 | At this point I assume you have deeper knowledge on how to use Docker and potentially Kubernetes as well as reverse proxies, so I won't bother to explain the myriad of options on how to get it to run on remote infrastructure. 61 | 62 | ## Compatibility 63 | (x) Intel based MacOS 64 | (x) Silicon based MacOS 65 | (x) Intel based Linux (Debian) 66 | (?) Rasbian 67 | (?) Windows WSL2 68 | 69 | ## Issues and problems 70 | Please let me know if you encounter any issues or problems. Ideally you include your operating system, architecture (Intel, AMD, Atom, Apple Silicon M1/2) as well as the software versions of docker and docker compose in your ticket. I'll gladly assist in any issues. You can also email me, using the email address on my QRZ-page (DO7JZ). 71 | 72 | ## Contributing 73 | If you're interested in advancing this, please use the usual workflow of forking and creating a pullrequest. 74 | 75 | ## Similar projects 76 | Chris thought this project is not maintained anymore and did want to try a different approach. If this doesn't work for you maybe give his project a try: 77 | https://github.com/ChrisRomp/hamclock-docker 78 | ## Changelog 79 | ### v0.01 80 | Customize Hamclock configuration via config file 81 | ### v0.00 82 | Initial release. 83 | 84 | ## Future Plans 85 | * Make it work on Raspbian as well. 86 | * Customize target resolution in build process. 87 | 88 | Thanks to WB0OEW for his great ham radio tool! 89 | 73 90 | 91 | -------------------------------------------------------------------------------- /config_example.env: -------------------------------------------------------------------------------- 1 | # PLEASE COPY THIS FILE TO config.env 2 | CALLSIGN=DO7JZ 3 | # Use 6-digit locator 4 | LOCATOR=JO53an 5 | # Positive numbers are north, negative south 6 | LAT=54 7 | # Positive numbers are east, negative west 8 | LONG=10 9 | # UTC offset in hours. Negative number for negative offset 10 | UTC_OFFSET=+2 11 | # CW=19 SSB=38 AM=49 WSPR=3 FT8=13 FT4=17 12 | VOACAP_MODE=38 13 | # Power in Watts 14 | VOACAP_POWER=10 15 | # RGB Values 16 | CALLSIGN_BACKGROUND_COLOR=80,80,80 17 | # Set to 1 if you want to have the rainbow. Overwrites color setting from above 18 | CALLSIGN_BACKGROUND_RAINBOW=0 19 | # RGB Values 20 | CALLSIGN_COLOR=200,200,200 21 | # Portnumber of FLRIG 22 | FLRIG_PORT=12345 23 | # Hostname or IP of FLRIG 24 | FLRIG_HOST=localhost 25 | # 1=Use FLRIG, 0=Don't use FLRIG 26 | USE_FLRIG=0 27 | # 1=Use Metric System 0=Don't use it 28 | USE_METRIC=1 -------------------------------------------------------------------------------- /docker-compose.hybrid.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | # add this below if you want this container to attach to an already created docker network 4 | #networks: 5 | #yournetwork: 6 | #external: true 7 | 8 | services: 9 | hamclock: 10 | image: hamclock:latest 11 | container_name: Hamclock 12 | env_file: config.env 13 | # change port in front of ':' to an open port to use to view hamclock ex: "9500:8081" DO NOT CHANGE THE PORT AFTER ':' 14 | ports: 15 | - "8081:8081" 16 | - "8080:8080" 17 | # add this below if you want to attach this to a specific network 18 | #networks: 19 | #- yournetwork 20 | # this tells docker to restart the container unless you have specifically stopped it 21 | restart: unless-stopped -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | # add this below if you want to attach this container to an existing docker network 3 | #networks: 4 | #yournetwork: 5 | #external: true 6 | 7 | services: 8 | web: 9 | build: . 10 | # change port in front of ':' to an open port to use to view hamclock ex: "9500:8081" DO NOT CHANGE THE PORT AFTER ':' 11 | ports: 12 | - "8081:8081" 13 | - "8080:8080" 14 | env_file: config.env 15 | # add this below if you want to attach this to a specific network 16 | #networks: 17 | #- yournetwork 18 | # this tells docker to restart the container unless you have specifically stopped it 19 | restart: unless-stopped -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | let OFFSET=$UTC_OFFSET*3600 3 | perl hceeprom.pl NV_CALLSIGN $CALLSIGN && \ 4 | perl hceeprom.pl NV_DE_GRID $LOCATOR && \ 5 | perl hceeprom.pl NV_DE_LAT $LAT && \ 6 | perl hceeprom.pl NV_DE_LNG $LONG && \ 7 | perl hceeprom.pl NV_DE_TZ $OFFSET && \ 8 | perl hceeprom.pl NV_BCMODE $VOACAP_MODE && \ 9 | perl hceeprom.pl NV_BCPOWER $VOACAP_POWER && \ 10 | perl hceeprom.pl NV_CALL_BG_COLOR $CALLSIGN_BACKGROUND_COLOR && \ 11 | perl hceeprom.pl NV_CALL_BG_RAINBOW $CALLSIGN_BACKGROUND_RAINBOW && \ 12 | perl hceeprom.pl NV_CALL_FG_COLOR $CALLSIGN_COLOR && \ 13 | perl hceeprom.pl NV_FLRIGHOST $FLRIG_HOST && \ 14 | perl hceeprom.pl NV_FLRIGPORT $FLRIG_PORT && \ 15 | perl hceeprom.pl NV_FLRIGUSE $USE_FLRIG && \ 16 | perl hceeprom.pl NV_METRIC_ON $USE_METRIC && \ 17 | 18 | /usr/local/bin/hamclock -t 20 --------------------------------------------------------------------------------