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
35 changes: 27 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
FROM node:22.15-slim
MAINTAINER "Mahesh" "mahesh@ilimi.in"
RUN useradd -rm -d /home/sunbird -s /bin/bash -g root -G sudo -u 1001 sunbird
FROM public.ecr.aws/docker/library/node:24.13.1-slim AS build
RUN apt-get update \
&& apt-get install -y unzip curl ca-certificates openssl libsnappy-dev \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /home/sunbird/telemetry
COPY ./telemetry-service.zip /home/sunbird/telemetry/
RUN unzip /home/sunbird/telemetry/telemetry-service.zip -d /home/sunbird/telemetry/
WORKDIR /home/sunbird/telemetry/telemetry
RUN npm prune --omit=dev

FROM public.ecr.aws/docker/library/node:24.13.1-slim
RUN npm install -g npm@11.10.0 \
&& npm pack tar@7.5.11 \
&& npm pack minimatch@10.2.1 \
&& npm pack picomatch@4.0.4 \
&& npm cache clean --force \
&& tar -xzf tar-7.5.11.tgz -C /usr/local/lib/node_modules/npm/node_modules/tar --strip-components=1 \
&& rm tar-7.5.11.tgz \
&& tar -xzf minimatch-10.2.1.tgz -C /usr/local/lib/node_modules/npm/node_modules/minimatch --strip-components=1 \
&& rm minimatch-10.2.1.tgz \
&& tar -xzf picomatch-4.0.4.tgz -C /usr/local/lib/node_modules/npm/node_modules/tinyglobby/node_modules/picomatch --strip-components=1 \
&& rm picomatch-4.0.4.tgz
RUN useradd -rm -d /home/sunbird -s /bin/bash -g root -G sudo -u 1001 sunbird
RUN apt-get update \
&& apt-get install -y curl ca-certificates openssl libsnappy-dev \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
USER sunbird
RUN mkdir -p /home/sunbird/telemetry
WORKDIR /home/sunbird/telemetry
COPY ./telemetry-service.zip /home/sunbird/telemetry/
RUN unzip /home/sunbird/telemetry/telemetry-service.zip
RUN ls -all /home/sunbird/telemetry
WORKDIR /home/sunbird/telemetry/telemetry/
CMD ["node", "app.js", "&"]
COPY --from=build /home/sunbird/telemetry/telemetry/ /home/sunbird/telemetry/
CMD ["node", "app.js"]
7 changes: 4 additions & 3 deletions Dockerfile.Build
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM node:22.15-slim
MAINTAINER "Mahesh" "mahesh@ilimi.in"
FROM public.ecr.aws/docker/library/node:24.13.1-slim
LABEL maintainer="Mahesh <mahesh@ilimi.in>"
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
libsnappy-dev \
libsnappy1v5 \
zip \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/telemetry
ADD src /opt/telemetry/
WORKDIR /opt/telemetry/
RUN npm install --production
RUN npm ci --omit=dev
WORKDIR /opt
CMD ["zip", "-r", "telemetry-service.zip", "telemetry"]
4 changes: 2 additions & 2 deletions build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name=telemetry-service
node=$2
org=$3

docker build -f ./Dockerfile.Build -t ${org}/${name}:${build_tag}-build .
docker build --no-cache -f ./Dockerfile.Build -t ${org}/${name}:${build_tag}-build .
docker run --name=${name}-${build_tag}-build ${org}/${name}:${build_tag}-build
containerid=$(docker ps -aqf "name=${name}-${build_tag}-build")
docker cp $containerid:/opt/telemetry-service.zip telemetry-service.zip
docker rm $containerid
docker build -f ./Dockerfile -t ${org}/${name}:${build_tag} .
docker build --no-cache -f ./Dockerfile -t ${org}/${name}:${build_tag} .
echo {\"image_name\" : \"${name}\", \"image_tag\" : \"${build_tag}\", \"node_name\" : \"$node\"} > metadata.json
28 changes: 28 additions & 0 deletions envVariables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const os = require('os');

const envVariables = {
level: process.env.telemetry_log_level || 'info',
localStorageEnabled: process.env.telemetry_local_storage_enabled || 'true',
telemetryProxyEnabled: process.env.telemetry_proxy_enabled,
dispatcher: process.env.telemetry_local_storage_type,
proxyURL: process.env.telemetry_proxy_url,
proxyAuthKey: process.env.telemetry_proxy_auth_key,
encodingType: process.env.telemetry_encoding_type,
kafkaHost: process.env.telemetry_kafka_broker_list,
topic: process.env.telemetry_kafka_topic,
compression_type: process.env.telemetry_kafka_compression || 'none',
filename: process.env.telemetry_file_filename || 'telemetry-%DATE%.log',
maxSize: process.env.telemetry_file_maxsize || '100m',
maxFiles: process.env.telemetry_file_maxfiles || '100',
partitionBy: process.env.telemetry_cassandra_partition_by || 'hour',
keyspace: process.env.telemetry_cassandra_keyspace,
contactPoints: (process.env.telemetry_cassandra_contactpoints || 'localhost').split(','),
cassandraTtl: process.env.telemetry_cassandra_ttl,
port: process.env.telemetry_service_port || 9001,
threads: process.env.telemetry_service_threads || os.cpus().length,
// dataset to be injected into outgoing telemetry events
dataset: process.env.telemetry_dataset || 'sb-telemetry',
// CORS configuration
allowedOrigins: process.env.telemetry_allowed_origins || '*'
};
module.exports = envVariables;
Empty file modified src/metadata.sh
100755 → 100644
Empty file.
Loading
Loading