Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cloud_Computing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Automate
Agent sessions
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Tim Hobelsberger
Cloud_Computing
Commits
cdcb177f
Commit
cdcb177f
authored
Dec 20, 2022
by
Markus Klose
Browse files
Options
Downloads
Patches
Plain Diff
MongoDB Zero Trust User
parent
f906c123
Branches
Branches containing commit
No related tags found
1 merge request
!10
Skalierbarkeit
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
docker-compose.yaml
+8
-2
8 additions, 2 deletions
docker-compose.yaml
index.js
+6
-2
6 additions, 2 deletions
index.js
with
14 additions
and
4 deletions
docker-compose.yaml
+
8
−
2
View file @
cdcb177f
...
@@ -150,8 +150,14 @@ services:
...
@@ -150,8 +150,14 @@ services:
-
27017:27017
-
27017:27017
volumes
:
volumes
:
-
mongodb:/data/db
-
mongodb:/data/db
logging
:
environment
:
driver
:
none
#MONGO_INITDB_ROOT_USERNAME: admin
#MONGO_INITDB_ROOT_PASSWORD: adminpassword
-
ADMINUSER=ccadmin
-
ADMINPASSWORD=abc123
command
:
-
"
--auth"
# node:
# node:
# restart: always
# restart: always
...
...
This diff is collapsed.
Click to expand it.
index.js
+
6
−
2
View file @
cdcb177f
...
@@ -4,7 +4,7 @@ const app = express();
...
@@ -4,7 +4,7 @@ const app = express();
const
http
=
require
(
'
http
'
);
const
http
=
require
(
'
http
'
);
const
https
=
require
(
'
https
'
);
const
https
=
require
(
'
https
'
);
const
fs
=
require
(
'
fs
'
);
const
fs
=
require
(
'
fs
'
);
const
{
mongo
,
default
:
mongoose
}
=
require
(
'
mongoose
'
);
const
{
mongo
,
default
:
mongoose
,
MongooseError
}
=
require
(
'
mongoose
'
);
//http Server
//http Server
const
server
=
http
.
createServer
(
app
);
const
server
=
http
.
createServer
(
app
);
...
@@ -55,8 +55,10 @@ app.use(cors());
...
@@ -55,8 +55,10 @@ app.use(cors());
//mongoose.connect("mongodb://mongodb:27017/cloudComputing");
//mongoose.connect("mongodb://mongodb:27017/cloudComputing");
const
connectWithRetry
=
()
=>
{
const
connectWithRetry
=
()
=>
{
let
username
=
process
.
env
.
ADMINUSER
;
let
password
=
process
.
env
.
ADMINPASSWORD
;
mongoose
mongoose
.
connect
(
'
mongodb://mongodb:27017/cloudComputing
'
,
{
useNewUrlParser
:
true
})
.
connect
(
'
mongodb://
ccadmin:abc123@
mongodb:27017/cloudComputing
'
,
{
useNewUrlParser
:
true
})
.
then
(()
=>
console
.
log
(
"
successfully connected to DB
"
))
.
then
(()
=>
console
.
log
(
"
successfully connected to DB
"
))
.
then
(
serverListen
())
.
then
(
serverListen
())
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
...
@@ -65,6 +67,8 @@ const connectWithRetry = () => {
...
@@ -65,6 +67,8 @@ const connectWithRetry = () => {
});
});
};
};
connectWithRetry
();
connectWithRetry
();
//Prometheus
//Prometheus
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment