This commit is contained in:
Vladislav 2026-07-23 04:01:10 -04:00
parent dc796ca4fc
commit c76078da87
3 changed files with 40 additions and 23 deletions

View File

@ -645,27 +645,13 @@
"outputs": [],
"source": [
"!ssh kultmost 'systemctl restart production.service'\n",
"!ssh kultmost 'systemctl restart fastapi.service'"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a87971ac",
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"!ssh kultmost 'systemctl status production.service'"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8714f4cc",
"id": "6fdc2d37",
"metadata": {
"vscode": {
"languageId": "shellscript"
@ -673,6 +659,7 @@
},
"outputs": [],
"source": [
"!ssh kultmost 'systemctl restart fastapi.service'\n",
"!ssh kultmost 'systemctl status fastapi.service'"
]
},
@ -684,6 +671,36 @@
"### restart celery"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "88961bb1",
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"%%bash\n",
"ssh kultmost 'tee /etc/systemd/system/vk-celery.service >/dev/null' <<'EOF'\n",
"[Unit]\n",
"Description=Celery VK\n",
"After=network.target\n",
"\n",
"[Service]\n",
"WorkingDirectory=/app/production\n",
"ExecStart=/app/production/.venv/bin/celery -A vk.celery_app_vk worker --loglevel=info\n",
"Restart=always\n",
"EnvironmentFile=/app/production/env\n",
"\n",
"[Install]\n",
"WantedBy=default.target\n",
"EOF\n",
"\n",
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now vk-celery.service && systemctl status --no-pager -l vk-celery.service'\n"
]
},
{
"cell_type": "code",
"execution_count": null,

View File

@ -425,7 +425,7 @@
" query[\"$or\"].append({'service': True})\n",
" query[\"$or\"].append({'user_id': exhibition['user']['_id']})\n",
"\n",
" post_ref = {'_id': exhibition['_id'], 'db': 'exhibition', 'col': 'exhibition'}\n",
" post_ref = {'_id': str(exhibition['_id']), 'db': 'exhibition', 'col': 'exhibition'}\n",
" medias = [exhibition.get(\"poster_orig_id\")]\n",
"\n",
" platforms = [\n",
@ -458,7 +458,7 @@
" print(f\"nospamsends:{exhibition['_id']}:{social['_id']}\")\n",
" if already_sent:\n",
" print(social)\n",
" client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)"
" client.notify.delay(post_ref, text, attachments, bson_clear(social), False)"
]
},
{
@ -479,7 +479,7 @@
" if usersSocial:\n",
" query[\"$or\"].append({\"competition\": True})\n",
" query[\"$or\"].append({\"competition\": {\"$exists\": False}})\n",
" post_ref = {'_id': competition['_id'], 'db': 'competitions', 'col': 'competitions'}\n",
" post_ref = {'_id': str(competition['_id']), 'db': 'competitions', 'col': 'competitions'}\n",
" medias = [competition.get(\"poster_file_id\")]\n",
"\n",
" platforms = [\n",
@ -511,7 +511,7 @@
" print(f\"nospamsends:{competition['_id']}:{social['_id']}\")\n",
" if already_sent:\n",
" print(social)\n",
" client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)"
" client.notify.delay(post_ref, text, attachments, bson_clear(social), False)"
]
},
{

View File

@ -323,7 +323,7 @@ async def service_social_exhibition(exhibition):
query["$or"].append({'service': True})
query["$or"].append({'user_id': exhibition['user']['_id']})
post_ref = {'_id': exhibition['_id'], 'db': 'exhibition', 'col': 'exhibition'}
post_ref = {'_id': str(exhibition['_id']), 'db': 'exhibition', 'col': 'exhibition'}
medias = [exhibition.get("poster_orig_id")]
platforms = [
@ -356,7 +356,7 @@ async def service_social_exhibition(exhibition):
print(f"nospamsends:{exhibition['_id']}:{social['_id']}")
if already_sent:
print(social)
client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)
client.notify.delay(post_ref, text, attachments, bson_clear(social), False)
async def service_social_competition(competition, serviceSocial, userSocial, usersSocial):
query = { 'active': True, "$or": []}
@ -369,7 +369,7 @@ async def service_social_competition(competition, serviceSocial, userSocial, use
if usersSocial:
query["$or"].append({"competition": True})
query["$or"].append({"competition": {"$exists": False}})
post_ref = {'_id': competition['_id'], 'db': 'competitions', 'col': 'competitions'}
post_ref = {'_id': str(competition['_id']), 'db': 'competitions', 'col': 'competitions'}
medias = [competition.get("poster_file_id")]
platforms = [
@ -401,7 +401,7 @@ async def service_social_competition(competition, serviceSocial, userSocial, use
print(f"nospamsends:{competition['_id']}:{social['_id']}")
if already_sent:
print(social)
client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)
client.notify.delay(post_ref, text, attachments, bson_clear(social), False)
async def email_new_user(new_user):
async for user in users_collection.find({'roles':'admin'}):