Skip to content

Commit

Permalink
moved downloading nssm zip to kraken server
Browse files Browse the repository at this point in the history
  • Loading branch information
godfryd committed Dec 4, 2023
1 parent 355be05 commit 504e67e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,12 @@ task :publish_client => './venv/bin/python3' do
end
end

file 'server/nssm-2.24.zip' do
sh 'wget -nv http://nssm.cc/release/nssm-2.24.zip -O server/nssm-2.24.zip'
end

task :build_server => KK_SERVER_TGZ_PATH
file KK_SERVER_TGZ_PATH => ['./venv/bin/python3', 'server/kraken/version.py'] do
file KK_SERVER_TGZ_PATH => ['./venv/bin/python3', 'server/kraken/version.py', 'server/nssm-2.24.zip'] do
Dir.chdir('server') do
sh 'rm -rf dist'
sh 'cp ../README.md .'
Expand Down
2 changes: 1 addition & 1 deletion agent/kraken/agent/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def install_linux():
if (Test-Path -Path $NSSMPath -PathType Leaf) {{
Write-Host "Path to existing NSSM: $NSSMPath"
}} else {{
Invoke-WebRequest 'http://nssm.cc/release/nssm-2.24.zip' -OutFile 'nssm-2.24.zip'
Invoke-WebRequest '{server_addr}/bk/install/nssm-2.24.zip' -OutFile 'nssm-2.24.zip'
Expand-Archive 'nssm-2.24.zip' -DestinationPath $DestDir
Remove-Item 'nssm-2.24.zip'
Write-Host "Downloaded NSSM: $NSSMPath"
Expand Down
1 change: 1 addition & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ WORKDIR /server
COPY --from=builder /venv /venv
COPY kkagent /server
COPY kktool /server
COPY nssm-2.24.zip /server
# tips for running gunicorn in container: https://pythonspeed.com/articles/gunicorn-in-docker/
CMD /venv/bin/gunicorn -b 0.0.0.0:${KRAKEN_SERVER_PORT} --timeout 600 -w 2 --worker-tmp-dir /dev/shm --log-file=- "kraken.server.server:create_app()"
ARG kkver=0.0
Expand Down
7 changes: 5 additions & 2 deletions server/kraken/server/agentblob.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@


def serve_agent_blob(blob):
if blob not in ['agent', 'tool', 'kraken-agent-install.sh', 'kraken-agent-install.bat']:
if blob not in ['agent', 'tool', 'kraken-agent-install.sh', 'kraken-agent-install.bat', 'nssm-2.24.zip']:
abort(404)

if blob.startswith('kraken-agent-install.'):
Expand Down Expand Up @@ -161,5 +161,8 @@ def serve_agent_blob(blob):
resp.headers.set("Content-Disposition", "attachment", filename=blob)
return resp

p = os.path.join(KKAGENT_DIR, 'kk' + blob)
if blob in ['agent', 'tool']:
blob = 'kk' + blob

p = os.path.join(KKAGENT_DIR, blob)
return send_file(p)

0 comments on commit 504e67e

Please sign in to comment.