Skip to content

Commit

Permalink
added files for merge with alpha oslabs
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelAngelo13 committed Mar 30, 2023
1 parent 61bbb3c commit f3b014f
Show file tree
Hide file tree
Showing 56 changed files with 1,439 additions and 1,068 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ src/database/docketeerdb
server/database/docketeerdb
dist/
.env
/imageConfigs/grafana/data
/imageConfigs/prometheus/promData
/imageConfigs/postgres/docketeerdb

coverage/

Expand Down
95 changes: 95 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
version: '3.8'
services:
db:
container_name: docketeerdb
image: docketeerxi/postgres
restart: always
ports:
- '${POSTGRES_PORT}:5432'
volumes:
- ./imageConfigs/postgres/docketeerdb:/var/lib/postgresql/data/

environment:
POSTGRES_DB: ${POSTGRES_NAME}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASS}

cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.1
container_name: cadvisor
ports:
- '8080:8080'

volumes:
- /:/rootfs:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /etc/machine-id:/etc/machine-id:ro

labels:
org_prometheus_starter: 'true'
org_prometheus_starter_path: '/metrics'

node-exporter:
image: docketeerxi/nodeex
container_name: node-exporter
ports:
- '9100:9100'
volumes:
#system info for linux machines
- /proc:/host/proc:ro
# also for linux
- /sys:/host/sys:ro
#root
- /:/rootfs:ro
depends_on:
- db

prometheus:
image: docketeerxi/prometheus
container_name: prometheus
ports:
- '9090:9090'

#can add volume here to persist the prometheus data.
depends_on:
- node-exporter
labels:
org_prometheus_starter: 'true'
org_prometheus_starter_port: '9090'
org_prometheus_starter_path: '/metrics'

grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- 2999:3000
environment:
GF_PATHS_CONFIG: /etc/grafana/grafana.ini
GF_AUTH_ANONYMOUS_ENABLED: 'true'

volumes:
- ./imageConfigs/grafana/data:/var/lib/grafana
- ./imageConfigs/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ./imageConfigs/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- ./imageConfigs/grafana/grafana.ini:/etc/grafana/grafana.ini
- ./imageConfigs/grafana/plugins:/var/lib/grafana/plugins

depends_on:
- prometheus
dev:
image: docketeerxi/docketeer-dev
container_name: docketeer-dev
build:
dockerfile: dockerfile-dev
ports:
- 4000:4000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./:/app
- node_modules:/app/node_modules
command: npm run dev

volumes:
node_modules:
30 changes: 21 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ services:
image: docketeerxi/postgres
restart: always
ports:
- 5432:5432
- '${POSTGRES_PORT}:5432'
volumes:
- ./imageConfigs/postgres/docketeerdb:/var/lib/postgresql/data/

environment:
POSTGRES_DB: 'docketeer-db'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'postgres'
POSTGRES_DB: ${POSTGRES_NAME}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASS}

# networks:
# - my-network

cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.1
Expand All @@ -35,7 +38,7 @@ services:
# - my-network

node-exporter:
image: docketeerx/nodeex
image: docketeerxi/nodeex
container_name: node-exporter
ports:
- '9100:9100'
Expand All @@ -52,12 +55,12 @@ services:
# - my-network

prometheus:
image: docketeerx/prometheus
image: docketeerxi/prometheus
container_name: prometheus
ports:
- '9090:9090'
volumes:
- ./imageConfigs/prometheus/promData:/prometheus

#can add volume here to persist the prometheus data.
depends_on:
- node-exporter
labels:
Expand Down Expand Up @@ -90,7 +93,7 @@ services:
- prometheus

docketeer:
image: docketeerx/docketeer
image: docketeerxi/docketeer
container_name: docketeer
ports:
- 4000:4000
Expand All @@ -102,3 +105,12 @@ services:
# - my-network
# depends_on:
# - grafana

# networks:
# my-network:
# driver: bridge
# driver_opts:
# com.docker.network.bridge.name: my-bridge
# com.docker.network.bridge.enable_icc: "true"
# subnet: "172.16.238.0/24"
# gateway: "172.16.238.1"
17 changes: 10 additions & 7 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@ FROM node
# Set the working directory to /app
WORKDIR /app

ENV DOCKERVERSION=19.03.12

RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 -C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz


COPY package*.json ./

# Run npm install to install app dependencies
RUN npm install

# Set the PATH env variable
# ENV PATH="/usr/local/bin:${PATH}"
# COPY /usr/local/bin/docker /usr/local/bin/docker
ENV DOCKERVERSION=19.03.12
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 -C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz

# Copy the current directory contents into the container at /app
COPY . .

# Make port 4000 available to the world outside this container
EXPOSE 4000
# EXPOSE 3000

# Start the app
CMD ["npm", "start"]



2 changes: 1 addition & 1 deletion global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ declare module '*.scss' {
const content: {[className: string]: string};
export = content;
}
declare module '*.png'
declare module '*.png'
Binary file modified imageConfigs/grafana/data/grafana.db
Binary file not shown.
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"docker-dev-down": "docker-compose -f docker-compose-dev.yml down",
"docker-dev-build": "docker build -t docketeerxi/docketeer-dev .",
"build": "vite build",
"buildWeb": "webpack --config=./webpack.react.config.js",
"test": "jest --verbose",
"lint": "eslint .",
"lint:fix": "eslint --fix --ext .js,.jsx,.ts,.tsx ."
Expand All @@ -30,7 +29,6 @@
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"electron-squirrel-startup": "^1.0.0",
"jsonwebtoken": "^9.0.0",
"os": "^0.1.2",
"os-utils": "^0.0.14",
"pg": "^8.8.0",
Expand Down Expand Up @@ -72,7 +70,6 @@
"@typescript-eslint/parser": "^5.50.0",
"@vitejs/plugin-react": "^3.1.0",
"autoprefixer": "^10.4.13",
"axios": "^1.0.0",
"babel-loader": "^8.2.5",
"bcryptjs": "^2.4.3",
"chart.js": "^3.9.1",
Expand Down Expand Up @@ -110,10 +107,7 @@
"ts-node": "^10.9.1",
"typescript": "^4.9.3",
"vite": "^4.2.1",
"vite-plugin-html": "^3.2.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"
"vite-plugin-html": "^3.2.0"
},
"repository": {
"type": "git",
Expand Down
Binary file modified server/.DS_Store
Binary file not shown.
15 changes: 11 additions & 4 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import express, { Request, Response } from 'express';
import { ServerError, GlobalErrorObject } from '../types';
import cors from 'cors';
import cookieParser from 'cookie-parser';
import { exec } from 'child_process';
// import cookieParser from 'cookie-parser'; // for when cookies get implemented

const app = express();

// allow requests from other domains
app.use(cors());
app.use(cookieParser());

// run commands in an exec (terminal instance); restarts containers running from the docketeerx/docketeer image using their ID
exec(
Expand All @@ -23,7 +23,7 @@ exec(
return;
}
console.log(`stdout: ${stdout}`);
},
}
);

// Importing routers...
Expand All @@ -36,12 +36,19 @@ import initRouter from './routes/initRouter';
import loginRouter from './routes/loginRouter';
import logoutRouter from './routes/logoutRouter';
import signupRouter from './routes/signupRouter';
// import userController from './controllers/userController';

// Enabling middleware...
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// app.use(cookieParser()); // for when cookies get implemented

// check for cookie
// app.use('/', userController.checkCookie, (req: Request, res: Response): void => {
// console.log('cookffffffs', req.headers.cookie, req.cookies);
// if (res.locals.notSignedIn) res.redirect('/login');
// });
// console.log('exited cookie check');
// Defining routers...
app.use('/account', accountRouter);
app.use('/admin', adminRouter);
Expand Down Expand Up @@ -72,7 +79,7 @@ app.get(
};
const errorObj: ServerError = Object.assign(defaultErr, err);
return res.status(errorObj.status).json(errorObj.message);
},
}
);

// Exporting app...
Expand Down
7 changes: 5 additions & 2 deletions server/controllers/apiController.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// !
// !
// ! Currently not used, is meant to send email alerts
// currently not used, is meant to send email alerts

import { Request, Response, NextFunction } from 'express';
import nodemailer from 'nodemailer';
import email from '../../security/email';
import { ApiController, ServerError } from '../../types';

// *** Signup email not currently being used. ***

// ==========================================================
// Function: transporter
// Purpose: create transporter object to make sure these values are filled out in email.js
// ==========================================================
const transporter = nodemailer.createTransport({
host: email.host,
port: email.port,
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/bcryptController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ const bcryptController: BcryptController = {
},
};

export default bcryptController;
export default bcryptController;
Loading

0 comments on commit f3b014f

Please sign in to comment.