hore
This commit is contained in:
parent
f5607d666d
commit
faaf317f14
35
build.ipynb
35
build.ipynb
@ -756,6 +756,35 @@
|
|||||||
"### fastapi prod service"
|
"### fastapi prod service"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "721bee4c",
|
||||||
|
"metadata": {
|
||||||
|
"vscode": {
|
||||||
|
"languageId": "shellscript"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"%%bash\n",
|
||||||
|
"ssh kultmost 'tee /app/production/start-uvicorn.sh >/dev/null' <<'EOF'\n",
|
||||||
|
"#!/usr/bin/bash\n",
|
||||||
|
"set -euo pipefail\n",
|
||||||
|
"\n",
|
||||||
|
"workers=\"$(nproc)\"\n",
|
||||||
|
"\n",
|
||||||
|
"exec /app/production/.venv/bin/uvicorn main:app \\\n",
|
||||||
|
" --host 127.0.0.1 \\\n",
|
||||||
|
" --port 30081 \\\n",
|
||||||
|
" --workers \"$workers\"\n",
|
||||||
|
"EOF\n",
|
||||||
|
"\n",
|
||||||
|
"ssh kultmost 'chmod +x /app/production/start-uvicorn.sh'\n",
|
||||||
|
"ssh kultmost 'ls -ln /app/production/start-uvicorn.sh'"
|
||||||
|
],
|
||||||
|
"display_name": ".venv"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@ -775,16 +804,16 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"[Service]\n",
|
"[Service]\n",
|
||||||
"WorkingDirectory=/app/production\n",
|
"WorkingDirectory=/app/production\n",
|
||||||
"ExecStart=/app/production/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 30081 --workers 3\n",
|
"ExecStart=/app/production/start-uvicorn.sh\n",
|
||||||
"Restart=always\n",
|
"Restart=always\n",
|
||||||
"EnvironmentFile=/app/production/env\n",
|
"EnvironmentFile=/app/production/env\n",
|
||||||
"CPUWeight=60\n",
|
"CPUWeight=60\n",
|
||||||
"\n",
|
"\n",
|
||||||
"[Install]\n",
|
"[Install]\n",
|
||||||
"WantedBy=default.target\n",
|
"WantedBy=multi-user.target\n",
|
||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now production.service && systemctl status --no-pager -l production.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now production.service && systemctl status --no-pager -l production.service'"
|
||||||
],
|
],
|
||||||
"display_name": ".venv"
|
"display_name": ".venv"
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user