Skip to content

Commit

Permalink
WIP auto provisioning TAP grafana dashboard, prometheus trac core dat…
Browse files Browse the repository at this point in the history
…a exporter, added dockerized version, added more tests
  • Loading branch information
eL1x00r committed Feb 5, 2024
1 parent b559863 commit 6bb99fb
Show file tree
Hide file tree
Showing 21 changed files with 24,728 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
tapstore
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"discord.enabled": true
}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:latest
# Set the working directory
RUN apt-get update && apt-get install -y --no-install-recommends dumb-init
WORKDIR /home/node/app
# Before switching to user 'node', ensure the directory exists and has the correct permissions
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
# Copying with chown in a single line before npm install to avoid permission issues.
COPY --chown=node:node . .
# Install dependencies
RUN npm install
# Expose ports
EXPOSE 5099
EXPOSE 13337
RUN chmod -R 777 /home/node/
USER node
ENV NODE_ENV production

CMD [ "npm", "start" ]
2 changes: 1 addition & 1 deletion bin/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { apiClient } from '@japa/api-client'
processCLIArgs(process.argv.splice(2))
configure({
files: ['tests/**/*.spec.js'],
plugins: [expect(), apiClient('http://localhost:3333')],
plugins: [expect(), apiClient('http://localhost:5099')],
})

run()
82 changes: 82 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: '3.8'
networks:
monitoring:
driver: bridge

volumes:
prometheus_data: {}
grafana_storage: {}
tapstore: {}

services:
trac-core:
# image: tap-reader
build:
context: ./
dockerfile: Dockerfile
# expose:
# - 13337
# - 5099
ports:
- '13337:13337'
- '5099:5099'
networks:
- monitoring
# volumes:
# - 'tapstore:/home/node/app/tapstore'

grafana:
build:
context: ./grafana
dockerfile: Dockerfile
container_name: grafana
restart: unless-stopped
environment:
# - GF_SERVER_ROOT_URL=http://my.grafana.server/
- GF_INSTALL_PLUGINS=grafana-clock-panel
ports:
- '3000:3000'
volumes:
- 'grafana_storage:/var/lib/grafana'
networks:
- monitoring

node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
expose:
- 9100
ports:
- '9100:9100'
networks:
- monitoring

prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
ports:
- '9090:9090'
expose:
- 9090
networks:
- monitoring
12 changes: 12 additions & 0 deletions grafana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM grafana/grafana

# ENV GF_AUTH_DISABLE_LOGIN_FORM "true"
# ENV GF_AUTH_ANONYMOUS_ENABLED "true"
# ENV GF_AUTH_ANONYMOUS_ORG ROLE "Admin"

#Adding all the files to docker container.
ADD provisioning /etc/grafana/provisioning
ADD config.ini /etc/grafana/config.ini

# Adding all the dashboard files (JSON) to docker container
ADD dashboards /var/lib/grafana/dashboards
6 changes: 6 additions & 0 deletions grafana/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[paths]
provisioning = /etc/grafana/provisioning
[server]
enable_gzip = true
[users]
default_theme = dark
Loading

0 comments on commit 6bb99fb

Please sign in to comment.