Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PADME Station Software
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PADME-PHT Development
PADME Station Software
Commits
90f4b176
Commit
90f4b176
authored
3 years ago
by
Mehrsary
Browse files
Options
Downloads
Patches
Plain Diff
Check the health status of Vault
parent
2cec9eff
Branches
8-vault-health-status
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
StationSoftware/routes/docker/docker.js
+6
-0
6 additions, 0 deletions
StationSoftware/routes/docker/docker.js
StationSoftware/utils/vault.js
+35
-0
35 additions, 0 deletions
StationSoftware/utils/vault.js
with
41 additions
and
0 deletions
StationSoftware/routes/docker/docker.js
+
6
−
0
View file @
90f4b176
...
...
@@ -953,6 +953,9 @@ router.get('/container/commit', utility.asyncHandler(async (req, res, next) => {
try
{
// check vault health status
let
vaultHealthStatus
=
await
vault
.
healthStatus
();
// This includes a list of files that have been modified by previous stations - They are decrypted and must be encrypted again before the train leaves the station
let
prevChanges
=
[];
const
prevChangesFileName
=
getPrevChangesFileName
();
...
...
@@ -1216,6 +1219,9 @@ router.get('/image/decrypt', utility.asyncHandler(async (req, res, next) => {
try
{
console
.
log
(
"
try1
"
);
// check vault health status
let
vaultHealthStatus
=
await
vault
.
healthStatus
();
// create a temp container
let
createTempContainerOptions
=
{
uri
:
`https://
${
process
.
env
.
DOCKER_HOST
}
:
${
process
.
env
.
DOCKER_PORT
}
/containers/create`
,
...
...
This diff is collapsed.
Click to expand it.
StationSoftware/utils/vault.js
+
35
−
0
View file @
90f4b176
...
...
@@ -172,6 +172,41 @@ module.exports = {
console
.
log
(
error
);
return
Promise
.
reject
(
error
);
}
},
healthStatus
:
async
()
=>
{
try
{
let
vaultHealthStatus
=
await
vault
.
health
();
console
.
log
(
vaultHealthStatus
);
if
(
vaultHealthStatus
.
isError
)
{
return
Promise
.
reject
(
"
Error: Vault
"
);
}
if
(
!
vaultHealthStatus
.
initialized
)
{
return
Promise
.
reject
(
"
Error: Vault is not initialized
"
);
}
if
(
vaultHealthStatus
.
sealed
)
{
return
Promise
.
reject
(
"
Error: Vault is sealed
"
);
}
try
{
let
lookupResult
=
await
vault
.
tokenLookupSelf
();
console
.
log
(
lookupResult
);
if
(
lookupResult
.
data
)
{
return
Promise
.
resolve
();
}
}
catch
(
error
)
{
return
Promise
.
reject
(
"
Error: Vault authentication failed
"
);
}
}
catch
(
error
)
{
console
.
log
(
error
);
return
Promise
.
reject
(
"
Error: Vault connection refused
"
);
}
}
};
\ No newline at end of file
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
register
or
sign in
to comment