Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Hexang 息壤平台
persona
Commits
4af37415
Commit
4af37415
authored
13 years ago
by
Lloyd Hilaiel
Browse files
Options
Downloads
Patches
Plain Diff
(aws deploy) remove trailing whitespace and output to console when bound
parent
ee51eea6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/deploy_server.js
+16
-12
16 additions, 12 deletions
scripts/deploy_server.js
with
16 additions
and
12 deletions
scripts/deploy_server.js
+
16
−
12
View file @
4af37415
...
...
@@ -12,6 +12,8 @@ jsel = require('JSONSelect'),
fs
=
require
(
'
fs
'
),
express
=
require
(
'
express
'
);
console
.
log
(
"
deploy server starting up
"
);
// a class capable of deploying and emmitting events along the way
function
Deployer
()
{
events
.
EventEmitter
.
call
(
this
);
...
...
@@ -42,7 +44,7 @@ Deployer.prototype._getLatestRunningSHA = function(cb) {
}
https
.
get
({
host
:
'
dev.diresworb.org
'
,
path
:
'
/ver.txt
'
},
function
(
res
)
{
var
buf
=
""
;
var
buf
=
""
;
res
.
on
(
'
data
'
,
function
(
c
)
{
buf
+=
c
});
res
.
on
(
'
end
'
,
function
()
{
try
{
...
...
@@ -73,7 +75,7 @@ Deployer.prototype._cleanUpOldVMs = function() {
jsel
.
forEach
(
"
object:has(:root > .name:contains(?))
"
,
[
"
dev.diresworb.org
"
],
r
,
function
(
o
)
{
// don't delete the current one
if
(
o
.
name
.
indexOf
(
latest
)
==
-
1
)
{
self
.
emit
(
'
info
'
,
'
decommissioning VM:
'
+
o
.
name
+
'
-
'
+
o
.
instanceId
);
self
.
emit
(
'
info
'
,
'
decommissioning VM:
'
+
o
.
name
+
'
-
'
+
o
.
instanceId
);
vm
.
destroy
(
o
.
name
,
function
(
err
,
r
)
{
if
(
err
)
self
.
emit
(
'
info
'
,
'
decomissioning failed:
'
+
err
);
else
self
.
emit
(
'
info
'
,
'
decomissioning succeeded of
'
+
r
);
...
...
@@ -98,7 +100,7 @@ Deployer.prototype._deployNewCode = function(cb) {
}
var
npmInstall
=
spawn
(
'
npm
'
,
[
'
install
'
],
{
cwd
:
self
.
_codeDir
});
npmInstall
.
stdout
.
on
(
'
data
'
,
splitAndEmit
);
npmInstall
.
stderr
.
on
(
'
data
'
,
splitAndEmit
);
...
...
@@ -108,7 +110,7 @@ Deployer.prototype._deployNewCode = function(cb) {
return
;
}
var
p
=
spawn
(
'
scripts/deploy_dev.js
'
,
[],
{
cwd
:
self
.
_codeDir
});
p
.
stdout
.
on
(
'
data
'
,
splitAndEmit
);
p
.
stderr
.
on
(
'
data
'
,
splitAndEmit
);
...
...
@@ -210,15 +212,15 @@ deployer.on('deployment_complete', function(r) {
deployer
.
on
(
'
error
'
,
function
(
r
)
{
closeLogFile
();
// on error, try again in 2 minutes
setTimeout
(
function
()
{
deployer
.
checkForUpdates
();
setTimeout
(
function
()
{
deployer
.
checkForUpdates
();
},
2
*
60
*
1000
);
});
// we check every 30 minutes no mattah what. (checks are cheap)
setInterval
(
function
()
{
deployer
.
checkForUpdates
();
setInterval
(
function
()
{
deployer
.
checkForUpdates
();
},
(
1000
*
60
*
30
));
// check for updates at startup
...
...
@@ -226,13 +228,15 @@ deployer.on('ready', function() {
deployer
.
checkForUpdates
();
var
app
=
express
.
createServer
();
app
.
get
(
'
/check
'
,
function
(
req
,
res
)
{
deployer
.
checkForUpdates
();
deployer
.
checkForUpdates
();
res
.
send
(
'
ok
'
);
});
app
.
use
(
express
.
static
(
deployLogDir
));
app
.
listen
(
process
.
env
[
'
PORT
'
]
||
8080
);
app
.
listen
(
process
.
env
[
'
PORT
'
]
||
8080
,
function
()
{
console
.
log
(
"
deploy server bound
"
);
});
});
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