Skip to content

Commit

Permalink
Merge pull request open-source-labs#1 from mattljiang/explore
Browse files Browse the repository at this point in the history
set up dummy microservices, complete with sample .env files
  • Loading branch information
DerekQuoc authored Jan 11, 2021
2 parents 96847a6 + caa138a commit 0b32222
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist
build
coverage
__tests__/**/__snapshots__
release-builds
release-builds
!.env
5 changes: 5 additions & 0 deletions examples/microservices/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#replace these sample URIs with your own
BOOK_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/book?retryWrites=true&w=majority
CUSTOMER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/customer?retryWrites=true&w=majority
ORDER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/order?retryWrites=true&w=majority
CHRONOS_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/chronoslogs?retryWrites=true&w=majority
5 changes: 5 additions & 0 deletions examples/microservices/books/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#replace these sample URIs with your own
BOOK_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/book?retryWrites=true&w=majority
CUSTOMER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/customer?retryWrites=true&w=majority
ORDER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/order?retryWrites=true&w=majority
CHRONOS_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/chronoslogs?retryWrites=true&w=majority
2 changes: 1 addition & 1 deletion examples/microservices/books/BookModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Schema } = mongoose;

// UNCOMMENT THE LINE BELOW AND REPLACE WITH AN ACTUAL MONGODB URI FOR YOUR "CUSTOMERS" DATABASE
require('./chronos-config'); // Bring in config file
const myURI = process.env.MONGO_URI;
const myURI = process.env.BOOK_URI;

mongoose.connect(myURI, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => console.log('Connected!!!********* Books Database is live!!!'))
Expand Down
3 changes: 2 additions & 1 deletion examples/microservices/books/chronos-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const chronos = require('chronos-tracker');

chronos.use({
Expand All @@ -6,7 +7,7 @@ chronos.use({
// dockerized: true,
database: {
type: 'MongoDB',
URI: " < INSERT URI HERE > "
URI: process.env.CHRONOS_URI
},
notifications: [],
});
5 changes: 5 additions & 0 deletions examples/microservices/books/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions examples/microservices/books/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"chronos-tracker": "^4.0.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.8.1",
"node-fetch": "^2.6.0",
"nodemon": "^2.0.2",
"path": "^0.12.7",
"chronos-tracker": "^4.0.5"
"path": "^0.12.7"
}
}
5 changes: 5 additions & 0 deletions examples/microservices/customers/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#replace these sample URIs with your own
BOOK_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/book?retryWrites=true&w=majority
CUSTOMER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/customer?retryWrites=true&w=majority
ORDER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/order?retryWrites=true&w=majority
CHRONOS_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/chronoslogs?retryWrites=true&w=majority
2 changes: 1 addition & 1 deletion examples/microservices/customers/CustomerModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { Schema } = mongoose;
// UNCOMMENT THE LINE BELOW AND REPLACE WITH AN ACTUAL MONGODB URI FOR YOUR "CUSTOMERS" DATABASE
// const myURI = 'mongodb+srv://johndoe:[email protected]/';
require('./chronos-config'); // Bring in config file
const myURI = process.env.MONGO_URI;
const myURI = process.env.CUSTOMER_URI;

mongoose.connect(myURI, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => console.log('Connected!!!********* Customer Database is live!!!'))
Expand Down
3 changes: 2 additions & 1 deletion examples/microservices/customers/chronos-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const chronos = require('chronos-tracker');


Expand All @@ -7,7 +8,7 @@ chronos.use({
// dockerized: true,
database: {
type: 'MongoDB',
URI: " < INSERT URI HERE > "
URI: process.env.CHRONOS_URI
},
notifications: [],
});
5 changes: 5 additions & 0 deletions examples/microservices/customers/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions examples/microservices/customers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"chronos-tracker": "^4.0.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.7.0",
"node-fetch": "^2.6.0",
"nodemon": "^2.0.2",
"path": "^0.12.7",
"chronos-tracker": "^4.0.5"
"path": "^0.12.7"
}
}
5 changes: 5 additions & 0 deletions examples/microservices/orders/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#replace these sample URIs with your own
BOOK_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/book?retryWrites=true&w=majority
CUSTOMER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/customer?retryWrites=true&w=majority
ORDER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/order?retryWrites=true&w=majority
CHRONOS_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/chronoslogs?retryWrites=true&w=majority
2 changes: 1 addition & 1 deletion examples/microservices/orders/OrderModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Schema } = mongoose;

// UNCOMMENT THE LINE BELOW AND REPLACE WITH AN ACTUAL MONGODB URI FOR YOUR "ORDERS" DATABASE
require('./chronos-config'); // Bring in config file
const myURI = process.env.MONGO_URI;
const myURI = process.env.ORDER_URI;
// const myURI = 'mongodb+srv://johndoe:[email protected]/';

mongoose.connect(myURI, { useNewUrlParser: true, useUnifiedTopology: true })
Expand Down
3 changes: 2 additions & 1 deletion examples/microservices/orders/chronos-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const chronos = require('chronos-tracker');

chronos.use({
Expand All @@ -6,7 +7,7 @@ chronos.use({
// dockerized: true,
database: {
type: 'MongoDB',
URI: " < INSERT URI HERE > "
URI: process.env.CHRONOS_URI
},
notifications: [],
});
5 changes: 5 additions & 0 deletions examples/microservices/orders/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions examples/microservices/orders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
"dependencies": {
"axios": "^0.19.0",
"body-parser": "^1.19.0",
"chronos-tracker": "^4.0.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.7.0",
"node-fetch": "^2.6.0",
"nodemon": "^2.0.2",
"path": "^0.12.7",
"request": "^2.88.0",
"chronos-tracker": "^4.0.5"
"request": "^2.88.0"
}
}
5 changes: 5 additions & 0 deletions examples/microservices/reverse proxy/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#replace these sample URIs with your own
BOOK_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/book?retryWrites=true&w=majority
CUSTOMER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/customer?retryWrites=true&w=majority
ORDER_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/order?retryWrites=true&w=majority
CHRONOS_URI=mongodb+srv://user:<password>@cluster0.sample.mongodb.net/chronoslogs?retryWrites=true&w=majority
3 changes: 2 additions & 1 deletion examples/microservices/reverse proxy/chronos-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const chronos = require('chronos-tracker');

chronos.use({
Expand All @@ -6,7 +7,7 @@ chronos.use({
// dockerized: true,
database: {
type: 'MongoDB',
URI: " < INSERT URI HERE > "
URI: process.env.CHRONOS_URI
},
notifications: [],
});
5 changes: 5 additions & 0 deletions examples/microservices/reverse proxy/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions examples/microservices/reverse proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
"author": "",
"license": "ISC",
"dependencies": {
"chronos-tracker": "^4.0.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"http-proxy": "^1.18.0",
"nodemon": "^2.0.2",
"chronos-tracker": "^4.0.5"
"nodemon": "^2.0.2"
}
}

0 comments on commit 0b32222

Please sign in to comment.