Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tv_panel
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
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
Hermod
tv_panel
Commits
1e57f377
Commit
1e57f377
authored
7 years ago
by
Ayc0
Browse files
Options
Downloads
Patches
Plain Diff
Only build in prod
parent
4092e8b0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
scripts/ecosystem.config.json
+5
-1
5 additions, 1 deletion
scripts/ecosystem.config.json
scripts/update_server.sh
+15
-12
15 additions, 12 deletions
scripts/update_server.sh
server/index.js
+0
-1
0 additions, 1 deletion
server/index.js
server/socket.js
+2
-2
2 additions, 2 deletions
server/socket.js
with
22 additions
and
16 deletions
scripts/ecosystem.config.json
+
5
−
1
View file @
1e57f377
...
@@ -4,7 +4,11 @@
...
@@ -4,7 +4,11 @@
"script"
:
"server/index.js"
,
"script"
:
"server/index.js"
,
"name"
:
"tv-panel"
,
"name"
:
"tv-panel"
,
"instances"
:
"1"
,
"instances"
:
"1"
,
"exec_mode"
:
"cluster"
"exec_mode"
:
"cluster"
,
"watch"
:
false
,
"env"
:
{
"NODE_ENV"
:
"production"
}
}
}
]
]
}
}
This diff is collapsed.
Click to expand it.
scripts/update_server.sh
+
15
−
12
View file @
1e57f377
#!/bin/bash
#!/bin/bash
if
[
$NODE_ENV
=
"production"
]
then
# Pull code
# Pull code
git fetch
git fetch
# git reset --hard origin/master
# git reset --hard origin/master
...
@@ -11,8 +13,9 @@ yarn install --pure-lockfile
...
@@ -11,8 +13,9 @@ yarn install --pure-lockfile
yarn build:front
yarn build:front
# Restart server
# Restart server
pm2 startOrRestart ./scripts/ecosystem.config.json
#
pm2 startOrRestart ./scripts/ecosystem.config.json
# Restart screen
# Restart screen
screen
-S
TVPanelScreen
-X
quit
# screen -S TVPanelScreen -X quit
./scripts/start_tv_panel.sh
# ./scripts/start_tv_panel.sh
fi
\ No newline at end of file
This diff is collapsed.
Click to expand it.
server/index.js
+
0
−
1
View file @
1e57f377
...
@@ -12,7 +12,6 @@ const server = (req, res) => {
...
@@ -12,7 +12,6 @@ const server = (req, res) => {
if
(
url
===
''
)
{
if
(
url
===
''
)
{
url
=
'
index.html
'
;
url
=
'
index.html
'
;
}
}
console
.
log
(
url
);
const
askedPath
=
path
.
resolve
(
__dirname
,
`../front/build/
${
url
}
`
);
const
askedPath
=
path
.
resolve
(
__dirname
,
`../front/build/
${
url
}
`
);
const
filePath
=
fs
.
existsSync
(
askedPath
)
?
askedPath
:
indexPath
;
const
filePath
=
fs
.
existsSync
(
askedPath
)
?
askedPath
:
indexPath
;
fs
.
readFile
(
filePath
,
(
err
,
data
)
=>
{
fs
.
readFile
(
filePath
,
(
err
,
data
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
server/socket.js
+
2
−
2
View file @
1e57f377
...
@@ -16,8 +16,8 @@ const useDummy = false;
...
@@ -16,8 +16,8 @@ const useDummy = false;
let
version
;
let
version
;
const
checkVersion
=
(
newVersion
)
=>
{
const
checkVersion
=
(
newVersion
)
=>
{
console
.
log
(
version
!==
newVersion
?
'
Update code
'
:
''
);
if
(
version
&&
version
!==
newVersion
)
{
if
(
version
&&
version
!==
newVersion
)
{
console
.
log
(
'
Update code
'
);
const
updateServer
=
spawn
(
path
.
resolve
(
__dirname
,
'
../scripts/update_server.sh
'
));
const
updateServer
=
spawn
(
path
.
resolve
(
__dirname
,
'
../scripts/update_server.sh
'
));
updateServer
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
updateServer
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
process
.
stdout
.
write
(
data
);
process
.
stdout
.
write
(
data
);
...
@@ -35,7 +35,7 @@ const doScreenApiRequest = (socket, userid = null) => {
...
@@ -35,7 +35,7 @@ const doScreenApiRequest = (socket, userid = null) => {
})
})
.
then
(
rawRes
=>
rawRes
.
json
())
.
then
(
rawRes
=>
rawRes
.
json
())
.
then
(
async
(
res
)
=>
{
.
then
(
async
(
res
)
=>
{
await
checkVersion
(
res
.
version
);
checkVersion
(
res
.
version
);
socket
.
emit
(
'
panel_data
'
,
res
);
socket
.
emit
(
'
panel_data
'
,
res
);
return
res
.
ttl
;
return
res
.
ttl
;
})
})
...
...
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