diff --git a/build.ipynb b/build.ipynb index 052e2b9..47abcc6 100644 --- a/build.ipynb +++ b/build.ipynb @@ -12,7 +12,8 @@ "outputs": [], "source": [ "!pip install -r requirements.txt" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -72,7 +73,8 @@ "EOF\n", "\n", "chmod +x .git/hooks/pre-commit\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -120,7 +122,8 @@ " load_env('env')\n", "except:\n", " load_env('env_example')" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -132,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "2809c42c", "metadata": {}, "outputs": [], @@ -161,7 +164,8 @@ " f.write('\\n\\n'.join(app))\n", "\n", "build()" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -195,7 +199,8 @@ "kubectl -n container-registry create secret generic registry-basic-auth \\\n", " --from-file=auth=/tmp/registry.htpasswd \\\n", " --dry-run=client -o yaml | kubectl apply -f -\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -209,7 +214,8 @@ "outputs": [], "source": [ "!kubectl create secret docker-registry regcred --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\"$(git config --global --get user.email)\"" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -224,7 +230,8 @@ "source": [ "!kubectl create namespace kultmost\n", "!kubectl create secret docker-registry regcred -n kultmost --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\"$(git config --global --get user.email)\"" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -238,7 +245,8 @@ "outputs": [], "source": [ "!docker login $REGISTRY_HOST -u 'user' -p $REGISTRY_PASS" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -260,7 +268,8 @@ "outputs": [], "source": [ "!docker pull $REGISTRY_HOST/python:3.13-alpine" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -274,7 +283,8 @@ "outputs": [], "source": [ "!docker pull $REGISTRY_HOST/python:3.13-slim" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -296,7 +306,8 @@ "outputs": [], "source": [ "!docker build -t $REGISTRY_HOST/api-tg:latest tg/." - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -310,7 +321,8 @@ "outputs": [], "source": [ "!docker push $REGISTRY_HOST/api-tg:latest" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -332,7 +344,8 @@ "outputs": [], "source": [ "!docker build -t $REGISTRY_HOST/avtopost-api:latest ." - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -346,7 +359,8 @@ "outputs": [], "source": [ "!docker image push $REGISTRY_HOST/avtopost-api:latest" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -360,7 +374,8 @@ "outputs": [], "source": [ "!kubectl rollout restart deployments/kultmost-api -n kultmost" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -382,7 +397,8 @@ "outputs": [], "source": [ "!kubectl rollout restart deployments/vk-celery -n kultmost" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -396,7 +412,8 @@ "outputs": [], "source": [ "!kubectl rollout restart deployments/email-celery -n kultmost" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -421,7 +438,8 @@ "docker pull gitea/gitea:1.22\n", "docker tag gitea/gitea:1.22 $REGISTRY_HOST/gitea/gitea:1.22\n", "docker push $REGISTRY_HOST/gitea/gitea:1.22" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -445,7 +463,8 @@ "docker tag busybox:1.36 $REGISTRY_HOST/busybox:1.36\n", "docker tag rabbitmq:3.11-management $REGISTRY_HOST/rabbitmq:3.11-management\n", "docker tag alpine:3.14 $REGISTRY_HOST/alpine:3.14" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -464,7 +483,8 @@ "docker push $REGISTRY_HOST/busybox:1.36\n", "docker push $REGISTRY_HOST/rabbitmq:3.11-management\n", "docker push $REGISTRY_HOST/alpine:3.14" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -486,7 +506,8 @@ "outputs": [], "source": [ "!docker build -t $REGISTRY_HOST/ssh-tunnel:2 tunnel/" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -500,7 +521,8 @@ "outputs": [], "source": [ "!docker push $REGISTRY_HOST/ssh-tunnel:2" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -514,7 +536,8 @@ "outputs": [], "source": [ "!kubectl create secret generic ssh-id-rsa --from-file=id_rsa=/home/user/.ssh/id_rsa -n kultmost" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -528,7 +551,8 @@ "outputs": [], "source": [ "!kubectl apply -n kultmost -f k8s/stunnel.yaml" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -550,7 +574,8 @@ "outputs": [], "source": [ "!envsubst < k8s/prod.yaml | kubectl apply -n kultmost -f -" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -564,7 +589,8 @@ "outputs": [], "source": [ "!envsubst < k8s/kultmost.yaml | kubectl apply -n kultmost -f -" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -578,7 +604,8 @@ "outputs": [], "source": [ "!envsubst < k8s/mq.yaml | kubectl apply -n kultmost -f -" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -592,7 +619,8 @@ "outputs": [], "source": [ "!envsubst < k8s/gitea.yaml | kubectl apply -n gitea -f -" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -606,7 +634,8 @@ "outputs": [], "source": [ "!kubectl get pod -n kultmost" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -631,7 +660,8 @@ "echo \"$INIT_SSH'bash -s' <<'SCRIPT'\"\n", "echo \"kubectl create secret docker-registry regcred --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\\\"$(git config --global --get user.email)\\\" && clear && history -c && history -w\"\n", "echo \"SCRIPT\"" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -654,7 +684,8 @@ "echo \"clear\"\n", "echo \"history -c\"\n", "echo \"history -w\"" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -684,7 +715,8 @@ "outputs": [], "source": [ "!rsync -avz -ogp --chown=www-data:www-data ./static/ kultmost:/var/www/static/" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -698,7 +730,8 @@ "outputs": [], "source": [ "!echo $(git branch --show-current)" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -712,7 +745,8 @@ "outputs": [], "source": [ "!rsync -avh --exclude-from=.rsyncignore --exclude=.venv/ . kultmost:/app/$(git branch --show-current)/" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -750,7 +784,8 @@ "EOF\n", "\n", "ssh kultmost 'systemctl daemon-reload && systemctl enable --now production.service && systemctl status --no-pager -l production.service'\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -780,7 +815,8 @@ "EOF\n", "\n", "ssh kultmost 'systemctl daemon-reload && systemctl enable --now fastapi.service && systemctl status --no-pager -l fastapi.service'\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -818,7 +854,8 @@ "EOF\n", "\n", "ssh kultmost 'systemctl daemon-reload && systemctl enable --now staging.service && systemctl status --no-pager -l staging.service'\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -854,7 +891,8 @@ "[Install]\n", "WantedBy=default.target\n", "EOF" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -884,7 +922,8 @@ "EOF\n", "\n", "ssh kultmost 'systemctl daemon-reload && systemctl enable --now staging.service && systemctl status --no-pager -l staging.service'\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -906,7 +945,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl restart production.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -920,7 +960,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl status production.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -934,7 +975,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl restart fastapi.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -948,7 +990,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl status fastapi.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -986,7 +1029,8 @@ "EOF\n", "\n", "ssh kultmost 'systemctl daemon-reload && systemctl enable --now vk-celery.service && systemctl status --no-pager -l vk-celery.service'\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1000,7 +1044,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl restart vk-celery.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1014,7 +1059,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl status vk-celery.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1044,7 +1090,8 @@ "EOF\n", "\n", "ssh kultmost 'systemctl daemon-reload && systemctl enable --now email-celery.service && systemctl status --no-pager -l email-celery.service'\n" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1058,7 +1105,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl restart email-celery.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1072,7 +1120,8 @@ "outputs": [], "source": [ "!ssh kultmost 'systemctl status email-celery.service'" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -1094,7 +1143,8 @@ "outputs": [], "source": [ "# !scp kultmost:/etc/nginx/sites-enabled/default nginx_conf " - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1110,7 +1160,8 @@ "!scp nginx_conf kultmost:/tmp/default\n", "!ssh kultmost 'sudo mv /tmp/default /etc/nginx/sites-enabled/default'\n", "!ssh kultmost 'nginx -t'" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1124,7 +1175,8 @@ "outputs": [], "source": [ "!ssh kultmost 'nginx -s reload'" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -1149,7 +1201,8 @@ "sudo usermod -a -G microk8s $USER\n", "newgrp microk8s\n", "microk8s status" - ] + ], + "display_name": ".venv" }, { "cell_type": "code", @@ -1165,7 +1218,8 @@ "curl -LO https://cert-manager.io/public-keys/cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg\n", "helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.20.2 --namespace cert-manager --create-namespace --verify --keyring ./cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg --set crds.enabled=true\n", "microk8s helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.20.2 --namespace cert-manager --create-namespace --verify --keyring ./cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg --set crds.enabled=true" - ] + ], + "display_name": ".venv" }, { "cell_type": "markdown", @@ -1186,6 +1240,16 @@ }, "outputs": [], "source": [ + "// MIT License\n", + "\n", + "// Copyright (c) 2026 vladislav\n", + "\n", + "// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n", + "\n", + "// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n", + "\n", + "// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "\n", "m1 = figma.currentPage.children[0]\n", "HTML_TAGS = new Set(['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr']);\n", "\n", @@ -1386,7 +1450,8 @@ "\n", "sss = await element_create(pc, tablet, mob)\n", "sss.innerHTML" - ] + ], + "display_name": ".venv" } ], "metadata": {