Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
FROM eclipse-temurin:24

ARG HOST_DB_INFO
ARG CONTAINER_DB_INFO
ARG HOST_KAFKA_CONFIG
ARG CONTAINER_KAFKA_CONFIG
ARG HOST_EMAIL_INFO
ARG CONTAINER_EMAIL_INFO
ARG HOST_AIRPORTS
ARG CONTAINER_AIRPORTS
ARG HOST_RUNWAYS
ARG CONTAINER_RUNWAYS

COPY $HOST_DB_INFO $CONTAINER_DB_INFO
COPY $HOST_KAFKA_CONFIG $CONTAINER_KAFKA_CONFIG
COPY $HOST_EMAIL_INFO $CONTAINER_EMAIL_INFO
# Copy configuration files
COPY ngafid-core/src/main/resources/ngafid.properties /app/ngafid.properties
COPY resources/log.properties /etc/log.properties
COPY $HOST_AIRPORTS $CONTAINER_AIRPORTS
COPY $HOST_RUNWAYS $CONTAINER_RUNWAYS

ENV LOG_CONFIG=/etc/log.properties
# Copy data files
COPY resources/airports.csv /etc/airports.csv
COPY resources/runways.csv /etc/runways.csv

# Copy JAR files
RUN mkdir -p /opt/ngafid-core
COPY ngafid-core/target/ngafid-core-1.0-SNAPSHOT-jar-with-dependencies.jar /opt/ngafid-core/ngafid-core.jar

# Set log configuration
ENV LOG_CONFIG=/etc/log.properties

# Default command (can be overridden in docker-compose.yml)
CMD ["java", "-cp", "/opt/ngafid-core/ngafid-core.jar", "org.ngafid.www.NgafidWebServer"]
70 changes: 29 additions & 41 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
version: "1.0"

# Split this up into two separate groups since ngafid-kafka-topics needs these variables, but should not depend on
# itself.
x-ngafid-service-common-base: &ngafid-service-common-base
extra_hosts:
- "host.docker.internal:host-gateway"
env_file:
- .env

x-ngafid-service-common: &ngafid-service-common
<<: *ngafid-service-common-base
depends_on:
mysql:
condition: service_started
ngafid-kafka-topics:
condition: service_completed_successfully
volumes:
- $HOST_UPLOAD_DIR:$CONTAINER_UPLOAD_DIR
- $HOST_ARCHIVE_DIR:$CONTAINER_ARCHIVE_DIR
- $HOST_STATIC_DIR:$CONTAINER_STATIC_DIR
- $HOST_TERRAIN_DIR:$CONTAINER_TERRAIN_DIR
# Mount the properties file and data directories
- ./ngafid-core/src/main/resources/ngafid.properties:/app/ngafid.properties:ro
- ./data/uploads:/mnt/uploads
- ./data/archive:/mnt/archive
- ./ngafid-static:/mnt/static
- ./data/terrain:/mnt/terrain

services:
base:
env_file:
- .env
build:
context: .
args:
HOST_DB_INFO: ${HOST_DB_INFO}
CONTAINER_DB_INFO: ${CONTAINER_DB_INFO}
HOST_KAFKA_CONFIG: ${HOST_KAFKA_CONFIG}
CONTAINER_KAFKA_CONFIG: ${CONTAINER_KAFKA_CONFIG}
HOST_EMAIL_INFO: ${HOST_EMAIL_INFO}
CONTAINER_EMAIL_INFO: ${CONTAINER_EMAIL_INFO}
HOST_RUNWAYS: ${HOST_RUNWAYS}
CONTAINER_RUNWAYS: ${CONTAINER_RUNWAYS}
HOST_AIRPORTS: ${HOST_AIRPORTS}
CONTAINER_AIRPORTS: ${CONTAINER_AIRPORTS}
HOST_UPLOAD_DIR: ${HOST_UPLOAD_DIR}
# No build args needed - everything configured via properties files
image: ngafid-base

# This must run and complete before everything else to create the Kafka topics
Expand All @@ -51,13 +36,10 @@ services:

# Reads emails from email kafka topic and sends them using the supplied credentials
ngafid-email-consumer:
environment:
- KAFKA_BOOTSTRAP=${KAFKA_BOOTSTRAP}
- SERVICE_NAME=ngafid-email-consumer
- HEARTBEAT_INTERVAL_MS=10000
build:
context: .
dockerfile: ngafid-core/Dockerfile.email
dockerfile: Dockerfile
command: ["java", "-cp", "/opt/ngafid-core/ngafid-core.jar", "org.ngafid.core.kafka.EmailConsumer"]
<<: *ngafid-service-common

# AirSync sync daemon
Expand All @@ -69,10 +51,6 @@ services:

# Upload processor. Upload topic is created with 6 partitions by default, so up to 6 replicas would work.
ngafid-upload-consumer:
environment:
- KAFKA_BOOTSTRAP=${KAFKA_BOOTSTRAP}
- SERVICE_NAME=ngafid-upload-consumer
- HEARTBEAT_INTERVAL_MS=10000
build:
context: .
dockerfile: ngafid-data-processor/Dockerfile
Expand All @@ -92,10 +70,6 @@ services:

# Event Consumer: reads from event topic and computes the events
ngafid-event-consumer:
environment:
- KAFKA_BOOTSTRAP=${KAFKA_BOOTSTRAP}
- SERVICE_NAME=ngafid-event-consumer
- HEARTBEAT_INTERVAL_MS=10000
build:
context: .
dockerfile: ngafid-data-processor/Dockerfile.event-consumer
Expand All @@ -104,16 +78,27 @@ services:
# Event Observer: scans database for events that have not been computed, and computes them.
# This can also be used to re-compute events as potential duplicates are deleted.
ngafid-event-observer:
environment:
- KAFKA_BOOTSTRAP=${KAFKA_BOOTSTRAP}
- SERVICE_NAME=ngafid-event-observer
- HEARTBEAT_INTERVAL_MS=10000
build:
context: .
dockerfile: ngafid-data-processor/Dockerfile.event-observer
<<: *ngafid-service-common


# MySQL Database
mysql:
image: mysql:8.0
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: ngafid
MYSQL_USER: ngafid
MYSQL_PASSWORD: ngafid
volumes:
- mysql_data:/var/lib/mysql
- ./ngafid-db/src:/docker-entrypoint-initdb.d
command: --default-authentication-plugin=mysql_native_password

kafka:
image: apache/kafka-native
ports:
Expand All @@ -135,3 +120,6 @@ services:

# Required for a single node cluster
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

volumes:
mysql_data:
5 changes: 0 additions & 5 deletions ngafid-core/Dockerfile.email

This file was deleted.

Loading