Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
374c2124
Commit
374c2124
authored
9 years ago
by
Gabriel Engel
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into hotfix/query-improvements
parents
a171026c
a19d9312
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
packages/rocketchat-tutum/startup.coffee
+12
-12
12 additions, 12 deletions
packages/rocketchat-tutum/startup.coffee
with
12 additions
and
12 deletions
packages/rocketchat-tutum/startup.coffee
+
12
−
12
View file @
374c2124
### Examples
TUTUM
_REDIS_HOST=redis://:password@host:6379
TUTUM
_CLIENT_NAME=mywebsite
TUTUM
_CLIENT_HOST=mywebsite.dotcloud.com
DOCKERCLOUD
_REDIS_HOST=redis://:password@host:6379
DOCKERCLOUD
_CLIENT_NAME=mywebsite
DOCKERCLOUD
_CLIENT_HOST=mywebsite.dotcloud.com
###
if
process
.
env
.
TUTUM
_REDIS_HOST
?
if
process
.
env
.
DOCKERCLOUD
_REDIS_HOST
?
redis
=
Npm
.
require
'redis'
client
=
redis
.
createClient
(
process
.
env
.
TUTUM
_REDIS_HOST
)
client
=
redis
.
createClient
(
process
.
env
.
DOCKERCLOUD
_REDIS_HOST
)
client
.
del
(
"frontend:
#{
process
.
env
.
TUTUM
_CLIENT_HOST
}
"
)
client
.
rpush
(
"frontend:
#{
process
.
env
.
TUTUM
_CLIENT_HOST
}
"
,
process
.
env
.
TUTUM
_CLIENT_NAME
)
client
.
rpush
(
"frontend:
#{
process
.
env
.
TUTUM
_CLIENT_HOST
}
"
,
"http://
#{
process
.
env
.
TUTUM
_IP_ADDRESS
.
split
(
'/'
)[
0
]
}
:3000"
)
client
.
del
(
"frontend:
#{
process
.
env
.
DOCKERCLOUD
_CLIENT_HOST
}
"
)
client
.
rpush
(
"frontend:
#{
process
.
env
.
DOCKERCLOUD
_CLIENT_HOST
}
"
,
process
.
env
.
DOCKERCLOUD
_CLIENT_NAME
)
client
.
rpush
(
"frontend:
#{
process
.
env
.
DOCKERCLOUD
_CLIENT_HOST
}
"
,
"http://
#{
process
.
env
.
DOCKERCLOUD
_IP_ADDRESS
.
split
(
'/'
)[
0
]
}
:3000"
)
# removes the redis entry in 90 seconds on a SIGTERM
process
.
on
'SIGTERM'
,
->
client
.
expire
(
"frontend:
#{
process
.
env
.
TUTUM
_CLIENT_HOST
}
"
,
90
)
client
.
expire
(
"frontend:
#{
process
.
env
.
DOCKERCLOUD
_CLIENT_HOST
}
"
,
90
)
day
=
86400000
inactiveDays
=
30
if
not
isNaN
(
parseInt
(
process
.
env
.
TUTUM
_REDIS_INACTIVE_DAYS
))
inactiveDays
=
parseInt
(
process
.
env
.
TUTUM
_REDIS_INACTIVE_DAYS
)
if
not
isNaN
(
parseInt
(
process
.
env
.
DOCKERCLOUD
_REDIS_INACTIVE_DAYS
))
inactiveDays
=
parseInt
(
process
.
env
.
DOCKERCLOUD
_REDIS_INACTIVE_DAYS
)
terminateAppIfInactive
=
->
subscription
=
RocketChat
.
models
.
Subscriptions
.
findOne
({
ls
:
{
$exists
:
true
}},
{
sort
:
{
ls
:
-
1
},
fields
:
{
ls
:
1
}})
if
not
subscription
?
or
Date
.
now
()
-
subscription
.
ls
>
inactiveDays
*
day
client
.
del
(
"frontend:
#{
process
.
env
.
TUTUM
_CLIENT_HOST
}
"
)
client
.
del
(
"frontend:
#{
process
.
env
.
DOCKERCLOUD
_CLIENT_HOST
}
"
)
process
.
exit
0
Meteor
.
setInterval
->
...
...
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