Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
strudel2_backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hpc-team
strudel2_backend
Commits
f4b12013
Commit
f4b12013
authored
2 years ago
by
Chris Hines
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into 'test'
Dev See merge request
!96
parents
8144c7a5
8086c2b6
No related branches found
Branches containing commit
No related tags found
2 merge requests
!97
Test
,
!96
Dev
Pipeline
#70139
passed
2 years ago
Stage: build
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
runscript
+1
-0
1 addition, 0 deletions
runscript
tes/sshwrapper/__init__.py
+35
-23
35 additions, 23 deletions
tes/sshwrapper/__init__.py
tes/tunnelstat/__init__.py
+12
-4
12 additions, 4 deletions
tes/tunnelstat/__init__.py
with
49 additions
and
28 deletions
.gitlab-ci.yml
+
1
−
1
View file @
f4b12013
...
...
@@ -84,7 +84,7 @@ deploy_prod:
-
docker ps -a -q | xargs -I{} docker rm {} || echo "No containers to remove"
-
docker images -q | xargs -I{} docker rmi {} || echo "No images to remove"
-
docker pull l1ll1/strudel2_backend:$CI_COMMIT_BRANCH
-
docker run --mount type=bind,source=/messages,target=/messages --mount type=bind,source=/var/log/strudel2,target=/var/log/strudel2 --restart=always -d -p 8080:8080 -p 8090:8090 --log-driver json-file --log-opt max-size=10m --log-opt max-file=3 --name strudel2_backend l1ll1/strudel2_backend:$CI_COMMIT_BRANCH || echo "Unable to start image ... possibly the old wsgi process is still running?"
-
docker run --mount type=bind,source=/messages,target=/messages --mount type=bind,source=/var/log/strudel2,target=/var/log/strudel2
-v /home/ubuntu/telegraf.conf:/etc/telegraf/telegraf.conf:ro
--restart=always -d -p 8080:8080 -p 8090:8090 --log-driver json-file --log-opt max-size=10m --log-opt max-file=3 --name strudel2_backend l1ll1/strudel2_backend:$CI_COMMIT_BRANCH || echo "Unable to start image ... possibly the old wsgi process is still running?"
dependencies
:
-
build
This diff is collapsed.
Click to expand it.
runscript
+
1
−
0
View file @
f4b12013
...
...
@@ -9,6 +9,7 @@ uwsgi \
--gid
=
www-data
\
--stats
/tmp/statsock
\
--memory-report
\
--listen
=
512
\
-w
tes.tes_wsgi &
telegraf &
twsproxy 8090
...
...
This diff is collapsed.
Click to expand it.
tes/sshwrapper/__init__.py
+
35
−
23
View file @
f4b12013
...
...
@@ -98,8 +98,11 @@ class Ssh:
@staticmethod
def
check_ctrlsocket
(
sess
,
ctrlsocket
):
cmd
=
[
'
ssh
'
,
'
-S
'
,
ctrlsocket
,
'
-O
'
,
'
check
'
,
'
-l
'
,
'
noone
'
,
'
nohost
'
]
check_p
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
None
)
(
stderr
,
stdout
)
=
check_p
.
communicate
(
timeout
=
Ssh
.
TIMEOUT
)
try
:
check_p
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
None
)
(
stderr
,
stdout
)
=
check_p
.
communicate
(
timeout
=
Ssh
.
TIMEOUT
)
except
subprocess
.
TimeoutExpired
as
e
:
raise
e
return
check_p
.
returncode
==
0
@staticmethod
...
...
@@ -113,11 +116,16 @@ class Ssh:
import
logging
logger
=
logging
.
getLogger
()
logger
.
debug
(
"
enter get_ctrl_master_socket
"
)
sess
.
lock
.
acquire
()
ctrlsocket
=
"
/tmp/cm-{}-{}-{}
"
.
format
(
user
,
host
,
sess
.
sshsessid
)
if
Ssh
.
check_ctrlsocket
(
sess
,
ctrlsocket
):
sess
.
lock
.
acquire
()
try
:
if
Ssh
.
check_ctrlsocket
(
sess
,
ctrlsocket
):
sess
.
lock
.
release
()
return
ctrlsocket
except
subprocess
.
TimeoutExpired
as
e
:
sess
.
lock
.
release
()
return
ctrlsocket
raise
e
try
:
mode
=
os
.
stat
(
ctrlsocket
).
st_mode
logger
.
debug
(
'
removing stale control socket
'
)
...
...
@@ -126,25 +134,29 @@ class Ssh:
except
FileNotFoundError
as
e
:
pass
sshcmd
=
Ssh
.
SSHCMDWITHOPTS
.
copy
()
sshcmd
.
extend
([
"
-S
"
,
ctrlsocket
,
"
-M
"
,
'
-o
'
,
'
ControlPersist=60s
'
,
'
-p
'
,
sshport
,
'
-N
'
,
'
-l
'
,
user
,
host
])
env
=
os
.
environ
.
copy
()
if
sess
.
socket
is
None
:
try
:
sshcmd
=
Ssh
.
SSHCMDWITHOPTS
.
copy
()
sshcmd
.
extend
([
"
-S
"
,
ctrlsocket
,
"
-M
"
,
'
-o
'
,
'
ControlPersist=60s
'
,
'
-p
'
,
sshport
,
'
-N
'
,
'
-l
'
,
user
,
host
])
env
=
os
.
environ
.
copy
()
if
sess
.
socket
is
None
:
sess
.
lock
.
release
()
logger
.
debug
(
"
Exception get_ctrl_master_socket
"
)
raise
SshAgentException
(
"
No ssh-agent yet
"
)
env
[
'
SSH_AUTH_SOCK
'
]
=
sess
.
socket
logger
.
debug
(
"
creating master socket
"
)
logger
.
debug
(
"
ssh_auth_sock {}
"
.
format
(
sess
.
socket
))
logger
.
debug
(
"
"
.
join
(
sshcmd
))
ctrl_p
=
subprocess
.
Popen
(
sshcmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
None
,
env
=
env
)
(
stderr
,
stdout
)
=
ctrl_p
.
communicate
()
# The process should exit, while the mux persists
except
Exception
as
e
:
sess
.
lock
.
release
()
logger
.
debug
(
"
Exception get_ctrl_master_socket
"
)
raise
SshAgentException
(
"
No ssh-agent yet
"
)
env
[
'
SSH_AUTH_SOCK
'
]
=
sess
.
socket
logger
.
debug
(
"
creating master socket
"
)
logger
.
debug
(
"
ssh_auth_sock {}
"
.
format
(
sess
.
socket
))
logger
.
debug
(
"
"
.
join
(
sshcmd
))
ctrl_p
=
subprocess
.
Popen
(
sshcmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stdin
=
None
,
env
=
env
)
(
stderr
,
stdout
)
=
ctrl_p
.
communicate
()
# The process should exit, while the mux persists
raise
e
if
ctrl_p
.
returncode
==
0
:
sess
.
lock
.
release
()
return
ctrlsocket
...
...
This diff is collapsed.
Click to expand it.
tes/tunnelstat/__init__.py
+
12
−
4
View file @
f4b12013
...
...
@@ -64,8 +64,12 @@ class SSHSession:
import
logging
logger
=
logging
.
getLogger
()
self
.
lock
.
acquire
()
if
self
.
socket
is
None
:
self
.
start_agent
()
try
:
if
self
.
socket
is
None
:
self
.
start_agent
()
except
Exception
as
e
:
self
.
lock
.
release
()
raise
e
self
.
lock
.
release
()
keyf
=
tempfile
.
NamedTemporaryFile
(
mode
=
'
w
'
,
delete
=
False
)
keyname
=
keyf
.
name
...
...
@@ -206,8 +210,12 @@ class SSHSession:
logger
=
logging
.
getLogger
()
env
=
os
.
environ
.
copy
()
sess
.
lock
.
acquire
()
if
sess
.
socket
is
None
:
sess
.
start_agent
()
try
:
if
sess
.
socket
is
None
:
sess
.
start_agent
()
except
Exception
as
e
:
sess
.
lock
.
release
()
raise
e
sess
.
lock
.
release
()
env
[
'
SSH_AUTH_SOCK
'
]
=
sess
.
socket
cmd
=
[
sess
.
sshadd
,
'
-l
'
]
...
...
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