diff --git a/build.ipynb b/build.ipynb index 60915f3..9e3b518 100644 --- a/build.ipynb +++ b/build.ipynb @@ -269,6 +269,55 @@ ], "display_name": ".venv" }, + { + "cell_type": "markdown", + "id": "fef1918f", + "metadata": {}, + "source": [ + "### tg build" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4489de4b", + "metadata": {}, + "outputs": [], + "source": [ + "!docker tag mongo:latest registry.spiritofweb.ru/mongo:latest" + ], + "display_name": ".venv" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "81571f0b", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "!docker build -t $REGISTRY_HOST/api-tg:latest tg/." + ], + "display_name": ".venv" + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3244466f", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "!docker push $REGISTRY_HOST/api-tg:latest" + ], + "display_name": ".venv" + }, { "cell_type": "markdown", "id": "37eabaef", @@ -368,6 +417,24 @@ "### containers" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "f4b322e5", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "%%bash\n", + "docker pull redis:latest\n", + "docker tag redis:latest $REGISTRY_HOST/redis:latest\n", + "docker push $REGISTRY_HOST/redis:latest" + ], + "display_name": ".venv" + }, { "cell_type": "code", "execution_count": null, @@ -383,7 +450,9 @@ "docker pull busybox:1.36\n", "docker pull rabbitmq:3.11-management\n", "docker pull alpine:3.14\n", + "docker pull redis:latest\n", "docker pull mongo:latest\n", + "docker tag redis:latest $REGISTRY_HOST/redis:latest\n", "docker tag mongo:latest $REGISTRY_HOST/mongo:latest\n", "docker tag busybox:1.36 $REGISTRY_HOST/busybox:1.36\n", "docker tag rabbitmq:3.11-management $REGISTRY_HOST/rabbitmq:3.11-management\n", @@ -403,6 +472,7 @@ "outputs": [], "source": [ "%%bash\n", + "docker push $REGISTRY_HOST/redis:latest\n", "docker push $REGISTRY_HOST/mongo:latest\n", "docker push $REGISTRY_HOST/busybox:1.36\n", "docker push $REGISTRY_HOST/rabbitmq:3.11-management\n", diff --git a/k8s/kultmost.yaml b/k8s/kultmost.yaml index 8e4521f..c85e567 100644 --- a/k8s/kultmost.yaml +++ b/k8s/kultmost.yaml @@ -17,7 +17,7 @@ spec: - name: regcred containers: - name: kultmost-api-container - image: registry.spiritofweb.ru/avtopost-api:latest + image: $REGISTRY_HOST/avtopost-api:latest command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080","--workers","8"] envFrom: - secretRef: @@ -56,7 +56,7 @@ spec: - name: regcred containers: - name: email - image: registry.spiritofweb.ru/avtopost-api:latest + image: $REGISTRY_HOST/avtopost-api:latest command: ["celery", "-A", "email_task.celery_app_email", "worker", "--loglevel=info"] envFrom: - secretRef: @@ -81,7 +81,7 @@ spec: - name: regcred containers: - name: vk - image: registry.spiritofweb.ru/avtopost-api:latest + image: $REGISTRY_HOST/avtopost-api:latest command: ["celery", "-A", "vk.celery_app_vk", "worker", "--loglevel=info"] envFrom: - secretRef: @@ -229,7 +229,7 @@ spec: spec: containers: - name: redis - image: redis:latest + image: $REGISTRY_HOST/redis:latest ports: - containerPort: 6379 volumeMounts: @@ -339,7 +339,7 @@ spec: - name: regcred containers: - name: mongodb - image: registry.spiritofweb.ru/mongo:latest + image: $REGISTRY_HOST/mongo:latest ports: - containerPort: 27017 env: @@ -447,7 +447,7 @@ stringData: # restartPolicy: OnFailure # containers: # - name: cron-day -# image: registry.spiritofweb.ru/alpine/curl +# image: $REGISTRY_HOST/alpine/curl # command: ["sh","-c","curl -sS http://kultmost-api.kultmost/cron/day -H \"Authorization: Bearer ${ATOKEN}\""] # env: # - name: ATOKEN @@ -472,7 +472,7 @@ stringData: # restartPolicy: OnFailure # containers: # - name: cron-five -# image: registry.spiritofweb.ru/alpine/curl +# image: $REGISTRY_HOST/alpine/curl # command: ["sh","-c","curl -sS http://kultmost-api.kultmost/cron/5 -H \"Authorization: Bearer ${ATOKEN}\""] # env: # - name: ATOKEN diff --git a/k8s/mq.yaml b/k8s/mq.yaml index 8b84764..82d6eca 100644 --- a/k8s/mq.yaml +++ b/k8s/mq.yaml @@ -54,7 +54,7 @@ spec: fsGroup: 999 initContainers: - name: fix-permissions - image: registry.spiritofweb.ru/busybox:1.36 + image: localhost:32000/busybox:1.36 command: - sh - -c @@ -69,7 +69,7 @@ spec: mountPath: /var/lib/rabbitmq containers: - name: rabbitmq - image: registry.spiritofweb.ru/rabbitmq:3.11-management + image: localhost:32000/rabbitmq:3.11-management ports: - containerPort: 5671 name: amqps @@ -169,7 +169,8 @@ kind: Ingress metadata: name: rabbitmq-management annotations: - cert-manager.io/cluster-issuer: letsencrypt + cert-manager.io/cluster-issuer: google-public-ca + nginx.ingress.kubernetes.io/use-forwarded-headers: "true" spec: tls: - hosts: diff --git a/main.ipynb b/main.ipynb index 5515977..d614b06 100644 --- a/main.ipynb +++ b/main.ipynb @@ -4748,10 +4748,10 @@ " obj_ids = [ObjectId(x) for x in exhibition.get('posts', [])]\n", " posts = await posts_collection.find({\"_id\": {\"$in\": obj_ids}}).to_list() if obj_ids else []\n", " d_posts = await delivery_collection.find({'post_id':{'$in':[str(i.get('_id')) for i in posts]}}).to_list()\n", - " for doc in posts:\n", - " for post in d_posts:\n", - " if str(doc.get('_id')) == post.get('post_id'):\n", - " doc.update({'status':post.get('status')})\n", + " for post in posts:\n", + " for doc in d_posts:\n", + " if str(post.get('_id')) == doc.get('post_id'):\n", + " post.update({'status':doc.get('status'), 'd_id':doc.get('_id')})\n", " return templates.TemplateResponse(\n", " request=request, name=\"profile/partner/exhibition.html\", context={\"now\": datetime.now(), \"user\": user, \"exhibition\": exhibition, \"posts\": posts}\n", " )\n", diff --git a/main.py b/main.py index 645c696..b54cc5a 100644 --- a/main.py +++ b/main.py @@ -3617,10 +3617,10 @@ async def profile_partner_exhibitions( obj_ids = [ObjectId(x) for x in exhibition.get('posts', [])] posts = await posts_collection.find({"_id": {"$in": obj_ids}}).to_list() if obj_ids else [] d_posts = await delivery_collection.find({'post_id':{'$in':[str(i.get('_id')) for i in posts]}}).to_list() - for doc in posts: - for post in d_posts: - if str(doc.get('_id')) == post.get('post_id'): - doc.update({'status':post.get('status')}) + for post in posts: + for doc in d_posts: + if str(post.get('_id')) == doc.get('post_id'): + post.update({'status':doc.get('status'), 'd_id':doc.get('_id')}) return templates.TemplateResponse( request=request, name="profile/partner/exhibition.html", context={"now": datetime.now(), "user": user, "exhibition": exhibition, "posts": posts} ) diff --git a/templates/profile/partner/exhibition.html b/templates/profile/partner/exhibition.html index 62e56e2..7030ec7 100644 --- a/templates/profile/partner/exhibition.html +++ b/templates/profile/partner/exhibition.html @@ -20,8 +20,13 @@ Каталог картин - {% set ids = posts | map(attribute='user._id') | list %} + {% set ids = posts + | selectattr('status', 'equalto', 'В каталоге') + | map(attribute='user._id') + | list + %} {% set uniq_count = ids | unique | list | length %} + {% if uniq_count > 0 %} + {% endif %} + {% if post.status == 'Ожидает получения' %} + + {% endif %} {% endfor %} @@ -97,6 +109,44 @@