diff --git a/Dockerfile b/Dockerfile index 9afaad9..9041379 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,26 @@ # Dockerfile # HBServer -#WORKDIR FROM debian:jessy-slim -ADD ./provision-debian.sh /root/provision-debian.sh -RUN /root/provision-debian.sh + +MAINTAINER KI7SBI Dylan + +RUN apt-get update && apt-get install -y wget nano supervisor +RUN wget -O /root/ipscbuild http://ip1.dx40.com/dmrlink/ipscbuild +RUN chmod 755 /root/ipscbuild +RUN /root/ipscbuild +#RUN mkdir -p /var/log/supervisor +COPY hb-ipsc-supervise.conf /etc/supervisor/conf.d/hb-ipsc-supervise.conf +COPY hblink.cfg /opt/hblink/hblink.cfg +COPY HB_Bridge.cfg /opt/hblink/HB_Bridge.cfg +COPY dmrlink.cfg /top/dmrlink/bridge/dmrlink.cfg +COPY IPSC_Bridge.cfg /top/dmrlink/bridge/ISPC_Bridge.cfg + + + +EXPOSE 55555 + + +CMD ["/usr/bin/supervisord"] diff --git a/HB_Bridge.cfg b/HB_Bridge.cfg new file mode 100644 index 0000000..9d64ed4 --- /dev/null +++ b/HB_Bridge.cfg @@ -0,0 +1,12 @@ +[DEFAULTS] +gateway = 127.0.0.1 # IP address of Partner Application (IPSC_Bridge, Analog_Bridge) +fromGatewayPort = 31003 # Port HB_Bridge is listening on for data (HB_Bridge <--- Partner) +toGatewayPort = 31000 # Port Partner is listening on for data (HB_Bridge ---> Partner) + +[RULES] +# Name = Old TG, New TG, New Slot +TG_SE = 3174, 3174, 2 +TG_NA = 3,3,1 +TG_ATL = 8,8,1 +TG_WW = 1,1,1 + diff --git a/IPSC_Bridge.cfg b/IPSC_Bridge.cfg new file mode 100644 index 0000000..bc16faa --- /dev/null +++ b/IPSC_Bridge.cfg @@ -0,0 +1,11 @@ +################################## +# IPSC_Bridge configuration file # +################################## + +# DEFAULTS - General settings. These values are +# inherited in each subsequent section (defined by section value). + +[DEFAULTS] +gateway = 127.0.0.1 # IP address of Partner Application (HB_Bridge, Analog_Bridge) +fromGatewayPort = 31000 # Port IPSC_Bridge is listening on for data (IPSC_Bridge <--- Partner) +toGatewayPort = 31003 # Port Partner is listening on for data (IPSC_Bridge ---> Partner) diff --git a/README.md b/README.md index 316a4c1..b75279a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,77 @@ DMR Homebrew Server with IPSC Bridge #Dockerfile -This Dockerfile packages up everything you need. +This Dockerfile packages up these 2 applications: +- dmrlink by N0MJS, IPSC_Bridge branch, https://github.com/n0mjs710/DMRlink/tree/IPSC_Bridge +- hblink by N0MJS, HB_Brige branch, https://github.com/n0mjs710/HBlink/tree/HB_Bridge + + + +#Config +Before you begin, you must edit the configuration files. + +##hblink.cfg +Defines parameters for homebrew. +Master means: open a port and wait for HB clients to connect. Your hotspot +(Pi-Star or openSpot, etc) will connect here. The default port is 55555/udp. +Docker requires an additional layer of port mapping, so be sure to +connect to your exposed port. + +##HB_Bridge.cfg +Defines AMBE ports for talking to IPSC_Bridge. +Also, defines the talkgroup deck. + +##dmrlink.cfg +Defines parameters for IPSC master and peers. +If you have a cBridge, use it as an IPSC master. + +##IPSC_Bridge.cfg +Settings paired (inverted) from HB_Bridge.cfg. HB_Bridge and IPSC_Bridge will use these 2 ports to communicate. + + + +#Build + +##Clone a copy of the Dockerfile + git clone https://github.com/KI7SBI/HomebrewDocker.git + +##Edit your config files + cd HomebrewDocker + nano ... + +##Build the Dockerfile +When you run the following build command, config files are copied into the docker image. +Name:Tag can be set to any value you wish. + sudo docker build -t HBIPSCDocker:config1 + + +##Multiple copies or versions +Edit config files, and build again, using a different tag. For example, + sudo docker build -t HBIPSCDocker:pnwdigital + + + +#Run +Remember to map exposed ports. + sudo docker run -d -p 50001:55555 HBIPSCDocker:config1 + sudo docker run -d -p 50002:55555 HBIPSCDocker:pnwdigital + + +#Connect your hotspot +Hotspots in MMDVM Server mode may connect to your port 50001 to use config1 bridge settings. +Or, connect to 50002 to use pnwdigital bridge settings. + +#Manage Docker Instances + docker ps + docker images + docker kill + + + +#Why Docker? +Yes, docker has a learning curve. It may seem unnecessary for you, and perhaps it is in your case. +The goal in containerizing the HB+IPSC pair is primarily to simplify running multiple instances on a single server. +If you dont care to run multiple instances, then you may always just install these apps directly. + diff --git a/dmrlink.cfg b/dmrlink.cfg new file mode 100644 index 0000000..f1ff963 --- /dev/null +++ b/dmrlink.cfg @@ -0,0 +1,193 @@ +# DMRLink SAMPLE CONFIGURATION FILE +# +# Rename to dmrlink.cfg and add your information +# +# minor tweaks to match install for use by DMRGateway +# N4IRS +# +# + +# GLOBAL CONFIGURATION ITEMS +# +[GLOBAL] +PATH: /opt/dmrlink/ + + +# NETWORK REPORTING CONFIGURATION +# Enabling "REPORT_NETWORKS" will cause a reporting action for +# IPSC each time the periodic reporting loop runs, that period is +# specified by "REPORT_INTERVAL" in seconds. Possible values +# for "REPORT_NETWORKS" are: +# +# PRINT - a pretty print (STDOUT) of the data structure +# "PRINT_PEERS_INC_MODE" - Boolean to include mode bits +# "PRINT_PEERS_INC_FLAGS" - Boolean to include flag bits +# +# NETWORK - This is the right way to do it. Opens a TCP socket +# listener. The protocol is still in its infancy, but the +# idea is that dmrlink will talk to another application +# to send event and status updates. Of course, the big +# goal here is a web dashboard that doesn't live on the +# dmrlink machine itself. +# +# PRINT should only be used for debugging; it sends prettily formatted +# stuff to STDOUT. The others send the internal data structure of the +# IPSC instance and let some program on the other end sort it out. +# +# REPORT_RCM - If True, and REPORT_NETWORKS = 'NETWORK', will send RCM +# Packets to connected reporting clients. This also requires +# individual IPSC systems to have RCM and CON_APP both set 'True' +# +# REPORT_INTERVAL - Seconds between reports +# REPORT_PORT - TCP port to listen on if "REPORT_NETWORKS" = NETWORK +# REPORT_CLIENTS - comma separated list of IPs you will allow clients +# to connect on. +# +[REPORTS] +REPORT_NETWORKS: +REPORT_RCM: +REPORT_INTERVAL: 60 +REPORT_PORT: 4321 +REPORT_CLIENTS: 127.0.0.1, 192.168.1.1 +PRINT_PEERS_INC_MODE: 0 +PRINT_PEERS_INC_FLAGS: 0 + + +# SYSTEM LOGGER CONFIGURAITON +# This allows the logger to be configured without chaning the individual +# python logger stuff in dmrlink.py. LOG_FILE should be a complete +# path/filename for *your* system -- use /dev/null for non-file handlers. +# LOG_HANDERLS may be any of the following, please, no spaces in the +# list if you use several: +# null +# console +# console-timed +# file +# file-timed +# syslog +# LOG_LEVEL may be any of the standard syslog logging levels, though +# as of now, DEBUG, INFO, WARNING and CRITICAL are the only ones +# used. +# +[LOGGER] +LOG_FILE: /tmp/dmrlink.log +LOG_HANDLERS: console-timed,file-timed +LOG_LEVEL: INFO +LOG_NAME: DMRlink + + +# DOWNLOAD AND IMPORT SUBSCRIBER, PEER and TGID ALIASES +# Ok, not the TGID, there's no master list I know of to download +# This is intended as a facility for other applcations built on top of +# DMRlink to use, and will NOT be used in DMRlink directly. +# STALE_DAYS is the number of days since the last download before we +# download again. Don't be an ass and change this to less than a few days. +[ALIASES] +TRY_DOWNLOAD: True +LOCAL_FILE: False +PATH: ./ +PEER_FILE: peer_ids.csv +SUBSCRIBER_FILE: subscriber_ids.csv +TGID_FILE: talkgroup_ids.csv +PEER_URL: http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=repeaters&format=csv&header=0 +SUBSCRIBER_URL: http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=users&format=csv&header=0 +STALE_DAYS: 7 + + +# CONFIGURATION FOR IPSC NETWORKS +# Please read these closely - catastrophic results could result by setting +# certain flags for things DMRlink cannot do. +# +# [NAME] The name you want to use to identify the IPSC instance (use +# something better than "IPSC1"...) +# ENABLED: Should we communicate with this network? Handy if you need to +# shut one down but don't want to lose the config +# RADIO_ID: This is the radio ID that DMRLink should use to communicate +# IP: This is the local IPv4 address to listen on. It may be left +# blank if you do not need or wish to specify. It is mostly +# useful when DMRlink uses multiple interfaces to serve as an +# application gateway/proxy from private and/or VPN networks +# to the real world. +# PORT: This is the UDP source port for DMRLink to use for this +# PSC network, must be unique!!! +# ALIVE_TIMER: Seconds between keep-alive transmissions +# MAX_MISSED: How many missed keep-alives before we remove a peer +# PEER_OPER: This signals the master and peers whether or not we are +# operational. True is the only thing that makes sense. +# IPSC_MODE: May be 'DIGITAL', 'ANALOG', or 'NONE'. Digital is really the +# only thing that makes sense. +# TSx_LINK: Is this time slot linked? +# CSBK_CALL: Should be False, we cannot process these, but may be useful +# for debugging. +# RCM: Repeater Call Monitoring - don't unable unless you plan to +# actually use it, this creates extra network traffic. +# CON_APP: Third Party Console App - exactly what DMRlink is, should +# be set to True, and must be if you intend to process RCM +# packets (like with network-based reporting) +# XNL_CALL: Can cause problems if not set to False, DMRlink does not +# process XCMP/XNL calls. +# XNL_MASTER: Obviously, should also be False, see XNL_CALL. +# DATA_CALL: Process data calls. True if you want to process data calls +# VOICE_CALL: Process voice calls. True if you want to process voice calls +# MASTER_PEER: True if DMRlink will be the master, False if we're a peer +# AUTH_ENABLED: Do we use authenticated IPSC? +# AUTH_KEY: The Authentication key (up to 40 hex characters) +# MASTER_IP: IP address of the IPSC master (ignored if DMRlink is the master) +# MASTER_PORT: UDP port of the IPSC master (ignored if DMRlink is the master) +# GROUP_HANGTIME: Group hangtime, per DMR configuration +# +# ...Repeat the block for each IPSC network to join. +# + +[SAMPLE_PEER] +ENABLED: False +RADIO_ID: 12345 +IP: +PORT: 50000 +ALIVE_TIMER: 5 +MAX_MISSED: 20 +PEER_OPER: True +IPSC_MODE: DIGITAL +TS1_LINK: True +TS2_LINK: True +CSBK_CALL: False +RCM: False +CON_APP: False +XNL_CALL: False +XNL_MASTER: False +DATA_CALL: True +VOICE_CALL: True +MASTER_PEER: False +AUTH_ENABLED: True +AUTH_KEY: 1A2B3C +MASTER_IP: 1.2.3.4 +MASTER_PORT: 50000 +GROUP_HANGTIME: 5 + + +[SAMPLE_MASTER] +ENABLED: True +RADIO_ID: 54321 +IP: 192.168.1.1 +PORT: 50000 +ALIVE_TIMER: 5 +MAX_MISSED: 20 +PEER_OPER: True +IPSC_MODE: DIGITAL +TS1_LINK: True +TS2_LINK: True +CSBK_CALL: False +RCM: False +CON_APP: False +XNL_CALL: False +XNL_MASTER: False +DATA_CALL: True +VOICE_CALL: True +MASTER_PEER: True +AUTH_ENABLED: True +AUTH_KEY: 1A2B3C +# Below not used for a Master +# MASTER_IP: 1.2.3.4 +# MASTER_PORT: 50000 +GROUP_HANGTIME: 5 + diff --git a/hb-ipsc-supervise.conf b/hb-ipsc-supervise.conf new file mode 100644 index 0000000..415f9c7 --- /dev/null +++ b/hb-ipsc-supervise.conf @@ -0,0 +1,8 @@ +[program:HB] +command = /opt/hblink/HB_Bridge.py + + +[program:IPSC] +command = /opt/dmrlink/bridge/IPSC_Bridge.py + + diff --git a/hblink.cfg b/hblink.cfg new file mode 100644 index 0000000..220414f --- /dev/null +++ b/hblink.cfg @@ -0,0 +1,106 @@ +# PROGRAM-WIDE PARAMETERS GO HERE +# PATH - working path for files, leave it alone unless you NEED to change it +# PING_TIME - the interval that clients will ping the master, and re-try registraion +# - how often the Master maintenance loop runs +# MAX_MISSED - how many pings are missed before we give up and re-register +# - number of times the master maintenance loop runs before de-registering a client +[GLOBAL] +PATH: ./ +PING_TIME: 5 +MAX_MISSED: 3 + +# SYSTEM LOGGER CONFIGURAITON +# This allows the logger to be configured without chaning the individual +# python logger stuff. LOG_FILE should be a complete path/filename for *your* +# system -- use /dev/null for non-file handlers. +# LOG_HANDERLS may be any of the following, please, no spaces in the +# list if you use several: +# null +# console +# console-timed +# file +# file-timed +# syslog +# LOG_LEVEL may be any of the standard syslog logging levels, though +# as of now, DEBUG, INFO, WARNING and CRITICAL are the only ones +# used. +# +[LOGGER] +LOG_FILE: /tmp/hblink.log +LOG_HANDLERS: console-timed +LOG_LEVEL: INFO +LOG_NAME: HBlink + +# DOWNLOAD AND IMPORT SUBSCRIBER, PEER and TGID ALIASES +# Ok, not the TGID, there's no master list I know of to download +# This is intended as a facility for other applcations built on top of +# HBlink to use, and will NOT be used in HBlink directly. +# STALE_DAYS is the number of days since the last download before we +# download again. Don't be an ass and change this to less than a few days. +[ALIASES] +TRY_DOWNLOAD: True +PATH: ./ +PEER_FILE: peer_ids.csv +SUBSCRIBER_FILE: subscriber_ids.csv +TGID_FILE: talkgroup_ids.csv +PEER_URL: http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=repeaters&format=csv&header=0 +SUBSCRIBER_URL: http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=users&format=csv&header=0 +STALE_DAYS: 7 + +# EXPORT AMBE DATA +# This is for exporting AMBE audio frames to an an "external" process for +# decoding or other nefarious actions. +[AMBE] +EXPORT_IP: 127.0.0.1 +EXPORT_PORT: 1234 + +# MASTER INSTANCES - DUPLICATE SECTION FOR MULTIPLE MASTERS +# HomeBrew Protocol Master instances go here. +# IP may be left blank if there's one interface on your system. +# Port should be the port you want this master to listen on. It must be unique +# and unused by anything else. +# Repeat - if True, the master repeats traffic to clients, False, it does nothing. +[MASTER-1] +MODE: MASTER +ENABLED: True +REPEAT: True +EXPORT_AMBE: False +IP: +PORT: 54000 +PASSPHRASE: s3cr37w0rd +GROUP_HANGTIME: 5 + +# CLIENT INSTANCES - DUPLICATE SECTION FOR MULTIPLE CLIENTS +# There are a LOT of errors in the HB Protocol specifications on this one! +# MOST of these items are just strings and will be properly dealt with by the program +# The TX & RX Frequencies are 9-digit numbers, and are the frequency in Hz. +# Latitude is an 8-digit unsigned floating point number. +# Longitude is a 9-digit signed floating point number. +# Height is in meters +[REPEATER-1] +MODE: CLIENT +ENABLED: False +EXPORT_AMBE: False +IP: +PORT: 54001 +MASTER_IP: 172.16.1.1 +MASTER_PORT: 54000 +PASSPHRASE: homebrew +CALLSIGN: W1AW +RADIO_ID: 1234567 +RX_FREQ: 222340000 +TX_FREQ: 223940000 +TX_POWER: 25 +COLORCODE: 1 +SLOTS: 3 +LATITUDE: 41.7333 +LONGITUDE: -50.3999 +HEIGHT: 75 +LOCATION: Iceberg, USA +DESCRIPTION: HBlink repeater +URL: https://groups.io/g/DVSwitch +SOFTWARE_ID: 20170620 +PACKAGE_ID: MMDVM_HBlink +GROUP_HANGTIME: 5 +OPTIONS: + diff --git a/provision-debian.sh b/provision-debian.sh deleted file mode 100644 index b1aa154..0000000 --- a/provision-debian.sh +++ /dev/null @@ -1,8 +0,0 @@ - - -apt-get update -apt-get install wget nano -cd /root -wget http://ip1.dx40.com/dmrlink/ipscbuild -chmod 755 ipscbuild -./ipscbuild