原文:Docker
如果你在单个生产节点上用过Docker,然后发现单个节点的资源不够用,那么你会怎么做呢?我也遇到过这种情况! 关于在生产环境中使用Docker Swarm,我会为你提供一些建议,也许能够帮到你。这些都是我一年来积累的一些经验。
另外,如果你对Docker Swam不熟悉的话,可以参考我之前的博客My experience with Docker Swarm - when you may need it?(http://suo.im/1m7qW8)
1. 阅读官方文档
| // Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/ | |
| let context = []; | |
| export function untrack(fn) { | |
| const prevContext = context; | |
| context = []; | |
| const res = fn(); | |
| context = prevContext; | |
| return res; |
| import regex as re | |
| import requests | |
| MAX_HEADING_LENGTH = 7 | |
| MAX_HEADING_CONTENT_LENGTH = 200 | |
| MAX_HEADING_UNDERLINE_LENGTH = 200 | |
| MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100 | |
| MAX_LIST_ITEM_LENGTH = 200 | |
| MAX_NESTED_LIST_ITEMS = 6 | |
| MAX_LIST_INDENT_SPACES = 7 |
| /* | |
| * This document is provided to the public domain under the | |
| * terms of the Creative Commons CC0 public domain license | |
| */ | |
| How to boot Arch Linux ARM in QEMU (patched for M1) | |
| Prerequisites: | |
| QEMU - patched for M1 processors - patches: https://github.com/utmapp/qemu |
| <artifacts_info> | |
| The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. | |
| # Good artifacts are... | |
| - Substantial content (>15 lines) | |
| - Content that the user is likely to modify, iterate on, or take ownership of | |
| - Self-contained, complex content that can be understood on its own, without context from the conversation | |
| - Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) | |
| - Content likely to be referenced or reused multiple times |
| version: '2' | |
| services: | |
| nextchat: | |
| image: yidadaa/chatgpt-next-web | |
| ports: | |
| - "3000" | |
| nginx: | |
| image: nginx:alpine | |
| ports: |
| import asyncio | |
| import logging | |
| import webbrowser | |
| from urllib.parse import quote | |
| import httpx | |
| from uuid import uuid4 | |
| from connectai.lark.websocket import WS_LARK_PROXY_SERVER, WS_LARK_PROXY_PROTOCOL |
| #!/usr/bin/python3 | |
| import sys | |
| import asyncio | |
| import greenlet | |
| class AsyncIoGreenlet(greenlet.greenlet): | |
| def __init__(self, driver, fn): | |
| greenlet.greenlet.__init__(self, fn, driver) | |
| self.driver = driver |
原文:Docker
如果你在单个生产节点上用过Docker,然后发现单个节点的资源不够用,那么你会怎么做呢?我也遇到过这种情况! 关于在生产环境中使用Docker Swarm,我会为你提供一些建议,也许能够帮到你。这些都是我一年来积累的一些经验。
另外,如果你对Docker Swam不熟悉的话,可以参考我之前的博客My experience with Docker Swarm - when you may need it?(http://suo.im/1m7qW8)
1. 阅读官方文档
| /** | |
| * 1. 创建websocket连接,后端会生成对应的channel<user_id, task_id>,前端是一个固定的url | |
| * 2. 监听创建成功事件 | |
| * 2.1 如果创建成功就将任务<source_url, title, author>通过创建好的websocket发送到服务端 | |
| * 2.2 如果创建失败,直接reject | |
| * 3. 监听接收消息事件 | |
| * 3.1 如果收到转换成功的url,代表后端的整个转换任务成功,将url resove出去 | |
| * 3.2 收到其他任务进度消息,可以忽略 | |
| */ | |
| export const submitTask = ( |
| FROM nginx:alpine AS builder | |
| # nginx:alpine contains NGINX_VERSION environment variable, like so: | |
| # ENV NGINX_VERSION 1.15.0 | |
| # Our NCHAN version | |
| ENV NCHAN_VERSION 1.1.15 | |
| # Download sources | |
| RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \ |