hore
This commit is contained in:
parent
f776d6ce25
commit
b06a678fb2
153
build.ipynb
153
build.ipynb
@ -817,6 +817,35 @@
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "434ecf4b",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%bash\n",
|
||||
"ssh kultmost 'tee /app/production/start-uvicorn-back.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 30080 \\\n",
|
||||
" --workers \"$workers\"\n",
|
||||
"EOF\n",
|
||||
"\n",
|
||||
"ssh kultmost 'chmod +x /app/production/start-uvicorn-back.sh'\n",
|
||||
"ssh kultmost 'ls -ln /app/production/start-uvicorn-back.sh'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@ -828,23 +857,24 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %%bash\n",
|
||||
"# ssh kultmost 'tee /etc/systemd/system/fastapi.service >/dev/null' <<'EOF'\n",
|
||||
"# [Unit]\n",
|
||||
"# Description=FastAPI prod service\n",
|
||||
"# After=network.target\n",
|
||||
"%%bash\n",
|
||||
"ssh kultmost 'tee /etc/systemd/system/fastapi.service >/dev/null' <<'EOF'\n",
|
||||
"[Unit]\n",
|
||||
"Description=FastAPI prod service\n",
|
||||
"After=network.target\n",
|
||||
"\n",
|
||||
"# [Service]\n",
|
||||
"# WorkingDirectory=/app/production\n",
|
||||
"# ExecStart=/app/production/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 30080 --workers 8\n",
|
||||
"# Restart=always\n",
|
||||
"# EnvironmentFile=/app/production/env\n",
|
||||
"[Service]\n",
|
||||
"WorkingDirectory=/app/production\n",
|
||||
"ExecStart=/app/production/start-uvicorn-back.sh\n",
|
||||
"Restart=always\n",
|
||||
"EnvironmentFile=/app/production/env\n",
|
||||
"CPUWeight=60\n",
|
||||
"\n",
|
||||
"# [Install]\n",
|
||||
"# WantedBy=default.target\n",
|
||||
"# EOF\n",
|
||||
"[Install]\n",
|
||||
"WantedBy=multi-user.target\n",
|
||||
"EOF\n",
|
||||
"\n",
|
||||
"# ssh kultmost 'systemctl daemon-reload && systemctl enable --now fastapi.service && systemctl status --no-pager -l fastapi.service'\n"
|
||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now fastapi.service && systemctl status --no-pager -l fastapi.service'\n"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
@ -960,9 +990,75 @@
|
||||
"id": "0474516d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### restart fastapi"
|
||||
"### restart production "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "5d35489f",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!ssh kultmost 'systemctl start fastapi.service'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c477dcdd",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!ssh kultmost 'systemctl status fastapi.service'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1eccaed4",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%bash\n",
|
||||
"ssh kultmost 'tee /etc/nginx/sites-enabled/avtopost_back >/dev/null' <<'EOF'\n",
|
||||
"upstream backend_avtopost_servers {\n",
|
||||
" server 127.0.0.1:30080;\n",
|
||||
"}\n",
|
||||
"EOF\n",
|
||||
"ssh kultmost 'nginx -t'\n"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "11a407c2",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!ssh kultmost 'nginx -s reload'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@ -996,7 +1092,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6fdc2d37",
|
||||
"id": "1cef4109",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
@ -1004,7 +1100,28 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# !ssh kultmost 'systemctl restart fastapi.service'"
|
||||
"%%bash\n",
|
||||
"ssh kultmost 'tee /etc/nginx/sites-enabled/avtopost_back >/dev/null' <<'EOF'\n",
|
||||
"upstream backend_avtopost_servers {\n",
|
||||
" server 127.0.0.1:30081;\n",
|
||||
"}\n",
|
||||
"EOF\n",
|
||||
"ssh kultmost 'nginx -t'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "42b4958a",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "shellscript"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!ssh kultmost 'nginx -s reload'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
@ -1019,7 +1136,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# !ssh kultmost 'systemctl status fastapi.service'"
|
||||
"!ssh kultmost 'systemctl stop fastapi.service'"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user