From fc9e921671a67a4a68ba70359ba10c6c2d5f01d7 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 29 Jan 2022 23:24:53 +0100 Subject: [PATCH] add docker and docker-compose files --- aprsc.dockerfile | 23 +++++++++++ db.dockerfile | 2 + docker-compose.yml | 75 ++++++++++++++++++++++++++++++++++ trackdirect-apache.dockerfile | 24 +++++++++++ trackdirect-python2.dockerfile | 21 ++++++++++ 5 files changed, 145 insertions(+) create mode 100644 aprsc.dockerfile create mode 100644 db.dockerfile create mode 100644 docker-compose.yml create mode 100644 trackdirect-apache.dockerfile create mode 100644 trackdirect-python2.dockerfile diff --git a/aprsc.dockerfile b/aprsc.dockerfile new file mode 100644 index 0000000..0dc0317 --- /dev/null +++ b/aprsc.dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install -y \ + gnupg \ + && rm -rf /var/lib/apt/lists/* + +RUN printf "deb http://aprsc-dist.he.fi/aprsc/apt focal main" >> /etc/apt/sources.list +RUN gpg --keyserver keyserver.ubuntu.com --recv C51AA22389B5B74C3896EF3CA72A581E657A2B8D +RUN gpg --export C51AA22389B5B74C3896EF3CA72A581E657A2B8D | apt-key add - + +RUN apt-get update && apt-get install -y \ + aprsc \ + && rm -rf /var/lib/apt/lists/* + +RUN rm /opt/aprsc/etc/aprsc.conf +VOLUME /opt/aprsc/etc/aprsc.conf + +EXPOSE 10152 +EXPOSE 14580 +EXPOSE 10155 +EXPOSE 14501 + +CMD /opt/aprsc/sbin/aprsc -u aprsc -t /opt/aprsc -c /etc/aprsc.conf diff --git a/db.dockerfile b/db.dockerfile new file mode 100644 index 0000000..332aefa --- /dev/null +++ b/db.dockerfile @@ -0,0 +1,2 @@ +FROM postgres +COPY misc/database/tables/* /docker-entrypoint-initdb.d/ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2935581 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,75 @@ +version: "3.9" +services: + aprsc: + build: + context: . + dockerfile: aprsc.dockerfile + restart: always + ports: + - "10152:10152" + - "14580:14580" + - "10155:10155" + - "14501:14501" + volumes: + - $PWD/config/aprsc.conf:/opt/aprsc/etc/aprsc.conf + + collector: + build: + context: . + dockerfile: trackdirect-python2.dockerfile + restart: always + volumes: + - $PWD/config/trackdirect.ini:/root/trackdirect/config/trackdirect.ini + command: /root/trackdirect/server/scripts/collector.sh trackdirect.ini 0 + depends_on: + - "db" + - "aprsc" + + websocket: + build: + context: . + dockerfile: trackdirect-python2.dockerfile + restart: always + volumes: + - $PWD/config/trackdirect.ini:/root/trackdirect/config/trackdirect.ini + command: /root/trackdirect/server/scripts/wsserver.sh trackdirect.ini + ports: + - "9000:9000" + depends_on: + - "db" + - "aprsc" + + heatmaps: + build: + context: . + dockerfile: trackdirect-python2.dockerfile + restart: always + volumes: + - $PWD/config/trackdirect.ini:/root/trackdirect/config/trackdirect.ini + - $PWD/heatmaps:/root/trackdirect/htdocs/public/heatmaps + command: /root/trackdirect/server/scripts/heatmapcreator.sh trackdirect.ini /root/trackdirect/htdocs/public/heatmaps + depends_on: + - "db" + + web: + build: + context: . + dockerfile: trackdirect-apache.dockerfile + restart: always + volumes: + - $PWD/config/trackdirect.ini:/root/trackdirect/config/trackdirect.ini + - $PWD/heatmaps:/root/trackdirect/htdocs/public/heatmaps + ports: + - "80:80" + depends_on: + - "db" + + db: + build: + context: . + dockerfile: db.dockerfile + restart: always + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: foobar + POSTGRES_DB: trackdirect diff --git a/trackdirect-apache.dockerfile b/trackdirect-apache.dockerfile new file mode 100644 index 0000000..c8309c8 --- /dev/null +++ b/trackdirect-apache.dockerfile @@ -0,0 +1,24 @@ +FROM php:7.2-apache + +RUN apt-get update && apt-get install -y \ + git \ + libpq-dev \ + postgresql-client-common \ + postgresql-client \ + libevent-dev \ + libmagickwand-dev \ + imagemagick \ + inkscape \ + && rm -rf /var/lib/apt/lists/* + +RUN pecl install imagick && docker-php-ext-enable imagick && docker-php-ext-install pdo pdo_pgsql + +COPY . /root/trackdirect +COPY config/000-default.conf /etc/apache2/sites-enabled/ + +RUN a2enmod rewrite +RUN chmod a+rx / && chmod a+rx -R /root +RUN chmod 777 /root/trackdirect/htdocs/public/symbols + +VOLUME /root/trackdirect/config/trackdirect.ini +VOLUME /root/trackdirect/htdocs/public/heatmaps diff --git a/trackdirect-python2.dockerfile b/trackdirect-python2.dockerfile new file mode 100644 index 0000000..b3acf7c --- /dev/null +++ b/trackdirect-python2.dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install -y \ + python2 \ + python2-dev \ + git \ + curl \ + wget \ + gcc \ + && rm -rf /var/lib/apt/lists/* + +RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py && python2 get-pip.py +RUN pip2 install psycopg2-binary autobahn[twisted] twisted pympler image_slicer jsmin psutil + +RUN git clone https://github.com/rossengeorgiev/aprs-python && cd aprs-python && pip2 install . +RUN wget http://jjguy.com/heatmap/heatmap-2.2.1.tar.gz && tar xzf heatmap-2.2.1.tar.gz && cd heatmap-2.2.1 && python2 setup.py install + +COPY . /root/trackdirect + +VOLUME /root/trackdirect/config/trackdirect.ini +VOLUME /root/trackdirect/htdocs/public/heatmaps