Skip to content

Commit a05b5a2

Browse files
committed
devDocker v2 updated with chronos npm working for docker now
1 parent cf14247 commit a05b5a2

File tree

107 files changed

+22095
-3623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+22095
-3623
lines changed

app/context/HealthContext.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,23 @@ const HealthContextProvider: React.FC<Props> = React.memo(({ children }) => {
6262

6363
try {
6464
const newPromise: any = await new Promise((resolve, reject) => {
65-
ipcRenderer.send('healthRequest', `${service}-containerinfos`);
65+
ipcRenderer.send('healthRequest', `${service}`);
6666
ipcRenderer.on('healthResponse', (event: Electron.Event, data: string) => {
6767
let result: object[];
6868
if (JSON.stringify(data) !== '{}' && tryParseJSON(data)) {
6969
result = JSON.parse(data);
7070
console.log('HealthContext.tsx line 68 result: ', result, 'service', service, 'Obj key', Object.keys(result[0])[0]);
7171
//result exists, has a length prop, and the service name and database name are same
72-
if (result && result.length && `${service}-containerinfos` === Object.keys(result[0])[0]) {
72+
if (result && result.length && `${service}` === Object.keys(result[0])[0]) {
7373
resolve(result[0]);
7474
}
7575
}
7676
});
7777
})
7878
temp.push(newPromise);
7979
console.log('HealthContext.tsx line 80 temp populates?: ', temp, serv)
80-
if (checkServicesComplete(temp, [`${service}-containerinfos`])) {
81-
setServices([`${service}-containerinfos`]);
80+
if (checkServicesComplete(temp, [`${service}`])) {
81+
setServices([`${service}`]);
8282
let transformedData: any = {};
8383
console.log('original healthData before transformation: ', temp);
8484
// transformedData = {
@@ -93,9 +93,8 @@ const HealthContextProvider: React.FC<Props> = React.memo(({ children }) => {
9393
console.log("healthcontext.tsx ERROR: ", err);
9494
};
9595
}
96-
})
97-
);
98-
}, []);
96+
))
97+
} , []);
9998
// const fetchHealthData = useCallback(serv => {
10099
// ipcRenderer.removeAllListeners('healthResponse');
101100

chronos_npm_package/chronos.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Chronos {
7272
if (database.type === 'MongoDB') {
7373
mongo.connect(this.config);
7474
mongo.services(this.config);
75+
console.log('dockerized really? chronos.js LN 75', dockerized, this.config)
7576
dockerized ? mongo.docker(this.config) : mongo.health(this.config);
7677
if (database.connection === 'REST') {
7778
return mongo.communications(this.config);

chronos_npm_package/controllers/dockerHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function getDockerContainer(microservice) {
2525
if (found) {
2626
return out
2727
} else {
28-
throw new Error(`Unable to find Docker container with name ${microservice}`)
28+
throw new Error(`Unable to find Docker container with name dockerHelper.js LN 28${microservice}`)
2929
}
3030

3131
} catch (e) {

chronos_npm_package/controllers/mongo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ mongo.health = async ({ microservice, interval, mode }) => {
131131
* !Runs instead of health if dockerized is true
132132
* Collects information on the docker container
133133
*/
134-
mongo.docker = ({ microservice, interval, mode }) => {
134+
mongo.docker = ({ microservice, interval, mode }) => { //:config file, interval of calls, nada
135135
// Create collection using name of microservice
136136
const containerInfo = ContainerInfoFunc(`${microservice}`);
137137
dockerHelper
@@ -143,9 +143,9 @@ mongo.docker = ({ microservice, interval, mode }) => {
143143
.then(data => {
144144
return containerInfo.create(data);
145145
})
146-
.then(_ =>
147-
console.log(`Docker data recorded in MongoDB collection ${microservice}`)
148-
)
146+
// .then(_ => {
147+
// console.log(`TESTING TESTING Docker data recorded in MongoDB collection ${microservice}`)
148+
// })
149149
.catch(err => {
150150
throw new Error(err);
151151
});

chronos_npm_package/models/ContainerInfo.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ const ContainerSchema = new Schema({
4848
},
4949
});
5050

51-
module.exports = ContainerName => mongoose.model(ContainerName, ContainerSchema);
51+
module.exports = ContainerName => {
52+
console.log('Inside Docker Schema ContainerInfo.js LN52', ContainerName)
53+
return mongoose.model(ContainerName, ContainerSchema);
54+
};

examples/docker/books/BookServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ app.use((error, req, res, next) => {
5353
});
5454

5555
app.listen(8888, () => {
56-
console.log(`Book server running on port 8888...`);
56+
console.log(`Book server running on port 8888...BookServer.js Line 56`);
5757
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

0 commit comments

Comments
 (0)