我有一个 docker swarm,目前只有一个节点和几个堆栈。为了能够获取请求我的一项服务的客户端的 IP 地址,我将一项服务上的端口切换为模式:主机。除非我想更新该服务,否则这工作正常。我没有更改部署顺序,因此它应该是默认的“停止优先”,但是当我使用任务时stack deploy,任务失败并显示以下消息:
no suitable node (host-mode port already in use on 1 node)
Run Code Online (Sandbox Code Playgroud)
当我将服务缩小到 0 然后使用stack deploy它时,它可以正常工作,但我不明白为什么直接更新时会出现问题。“stop-first”不应该意味着先终止旧服务(释放端口),然后启动新服务吗?如何在部署更改之前更改 yml 而不必缩放到 0?
这是有问题的 application.yml:
version: "3.7"
services:
myservice:
image: myrepo/gateway
ports:
- mode: host
protocol: tc
published: 443
target: 443
networks:
- gateway_net
networks:
gateway_net:
external: true # was created with 'docker network create -d overlay gateway_net', is used to connect gw with other services
Run Code Online (Sandbox Code Playgroud) docker docker-compose docker-swarm docker-network docker-stack
我有以下用例:
有一个input,应该旁边时,它具有焦点的输入来显示弹出。因此,当input具有焦点时,用户可以输入input或使用弹出窗口来选择某些内容。
用户完成后,他可以通过单击其他位置或按 Tab 键并聚焦下一个元素来取消对元素的聚焦。但是,如果他单击弹出窗口内的按钮,弹出窗口应保持打开状态,输入应保持聚焦,以便用户可以继续键入。
我遇到的问题是,(click)在弹出窗口中处理输入之前,角度处理(模糊)。这意味着当用户在弹出窗口中点击时,输入失去焦点,它被隐藏,然后用户的点击将不再被处理。
我为这个问题制作了一个stackblitz-demo:
这是源代码:
应用程序组件.html
<h1>Hello</h1>
<p>
Type 'one', 'two' or 'three' to change number or select a number
from popup.
<br>
<input type="checkbox" [(ngModel)]="hideHelperOnBlur" /> Hide
helper on blur (if this is set, then the buttons in the popup don't work
but if this is not set, the popup doesn't close if the input looses
focus -> how can I get both? The buttons to …Run Code Online (Sandbox Code Playgroud) 我使用此图像设置我自己的 docker 注册表:https ://hub.docker.com/_/registry
我注意到的第一件事是最新标签没有自动设置。将映像推送到 dockerHub 时,它会自动分配最新的标签,因此您始终可以使用该标签访问最新的映像。
这似乎不是自托管 docker 注册表的默认行为。有什么方法可以配置它以便我自动获得最新标签吗?
我在我的elasticsearch存储库之一中有一个自定义@Query,因为自动生成方法没有使用匹配(而是使用query_string和analyze_wildcard),因此不适用于空格等。这个查询对我来说看起来很简单,所以我认为自己编写它不会有问题。
@Query("\"bool\": { " +
" \"filter\": [ " +
" { " +
" \"term\": { " +
" \"userId.keyword\": \"?0\" " +
" } " +
" }, " +
" {" +
" \"match\": { " +
" \"content\": \"?1\" " +
" }" +
" } " +
" ] " +
" }")
Page<SearchablePageHistory> findAllByUserIdAndContentLike(String userId, String content, Pageable pageable);
Run Code Online (Sandbox Code Playgroud)
但是当我尝试执行该函数时,出现以下错误:
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=x_content_parse_exception, reason=Failed to derive xcontent]
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1793) ~[elasticsearch-rest-high-level-client-7.6.2.jar:7.6.2] …Run Code Online (Sandbox Code Playgroud) 我想要一个带有基本映射“/user”的 RestController 类(因此不同的函数将具有“/user/add”、“/user/remove”等路径或使用 POST/GET 等)
这是我不明白并且无法开始工作的部分:
@RestController
public class UserController {
@GetMapping("/user")
public Response login(Principal principal){
//some output
}
}
Run Code Online (Sandbox Code Playgroud)
这种情况下的预期行为是我可以在“/user”下访问我的输出。这按预期工作。现在,如果我将其修改为以下内容(因为此控制器中的所有功能都应该有一个以“/user”开头的路径,这会更清晰)
@RestController
@RequestMapping("/user")
public class UserController {
@GetMapping("/")
public Response login(Principal principal){
//some output
}
}
Run Code Online (Sandbox Code Playgroud)
我得到一个 404-Error 页面并且无法再访问“/user”我发现的所有示例都使用相同的语法(或者有时@RequestMapping(path="/user") 但它不起作用)并且我不知道为什么它不起作用。有人能告诉我我的错误在哪里吗?
docker ×2
java ×2
angular ×1
blur ×1
docker-stack ×1
docker-swarm ×1
docker-tag ×1
dockerhub ×1
events ×1
focus ×1
javascript ×1
jpa ×1
spring ×1
spring-mvc ×1