简体   繁体   English

添加 URL 路径前缀到 artifactory 安装 (Docker)

[英]Add a URL path prefix to artifactory installation (Docker)

I'm running Artifactory CPP CE 7.7.3 and Traefik v2.2 using docker-compose .我正在使用docker docker-compose运行Artifactory CPP CE 7.7.3Traefik v2.2 The service is only available over http://localhost/ui/ .该服务仅在http://localhost/ui/可用。 Now, what I need is an option which allows to add a URL path-prefix (eg http://localhost/artifactroy/ui ).现在,我需要的是一个允许添加 URL 路径前缀的选项(例如http://localhost/artifactroy/ui )。

My Setup我的设置

  • I used the described setup process from the Artifactory Docs suggest it.我使用了Artifactory Docs 中所描述的设置过程。
  • Mydocker.compose.yaml is the official extracted from the jfrog-artifactory-cpp-ce-7.7.3-compose.tar.gz : ./templates/docker-compose.yaml .我的docker.compose.yaml是官方提取自jfrog-artifactory-cpp-ce-7.7.3-compose.tar.gz : ./templates/docker-compose.yaml
  • I'm using a reverse proxy (traefik).我正在使用反向代理(traefik)。 For this, I've added the necessary traefik configuration lines to the docker-compose-file.为此,我在 docker-compose-file 中添加了必要的 traefik 配置行。 Here is a small extract what I've added:这是我添加的一小段摘录:
     [...] labels: - "traefik.http.routers.artifactory.rule=Host(`localhost`) && PathPrefix(`/ui`)" - "traefik.http.routers.artifactory.middlewares=artifactory-stripprefix" - "traefik.http.middlewares.artifactory-stripprefix.stripprefix.prefixes=/" - "traefik.http.services.artifactory.loadbalancer.server.port=8082"

With this I managed to access artifactory over http://localhost/ui/ .有了这个,我设法通过http://localhost/ui/访问了 artifactory。


Problem:问题:

I have multiple small services running on my server, each of this service is accusable via http://localhost/<service-name> .我的服务器上运行着多个小服务,每个服务都可以通过http://localhost/<service-name>指责。 This is very convenient and want to make clear that this URL is related to this service on my production server.这个很方便,想说明这个网址和我生产服务器上的这个服务有关。 Because of this, I want to have an URL like http://localhost/artifactroy/ui/... instead of http://localhost/ui/...因此,我想要一个像http://localhost/artifactroy/ui/...这样的 URL 而不是http://localhost/ui/...

I struggled getting artifactory setup in that way.我很难以这种方式获得人工设置。 I already managed to get a redirection from typing eg http://localhost/artifactroy/ to http://localhost/ui/ but this is not what I want on my production server.我已经设法从键入例如http://localhost/artifactroy/重定向到http://localhost/ui/但这不是我想要的我的生产服务器。

What I did我做了什么

  • Went through the documentation in hope of finding an option which I just can passt to artifactroy to add a prefix ( Not successful).通过在文档中找到我正好可以passt到artifactroy添加前缀(不成功)期权的希望去了。
  • Tried configure traefik two full days, to alter headers to get the repose point to http://localhost/artifactroy/ui/... (Only partially successful, redirection didn't work afterwards)尝试配置 traefik 整整两天,以更改标题以将 repose 指向http://localhost/artifactroy/ui/... (仅部分成功,之后重定向不起作用)
  • Tried finding the configuration which is responsible for configure artifactory in $JFROG_HOME/artifactory/var/etc ( Not successful)试图寻找它负责在配置artifactory的配置$JFROG_HOME/artifactory/var/etc没有成功)

Is this even possible?这甚至可能吗? Help is highly appreciated..非常感谢帮助..

This example (even though not traefic example) gives you a direction to implement it.这个示例(即使不是 traefic 示例)为您提供了实现它的方向。 There are certain routes already used within the product.产品中已经使用了某些路线。 You need to add a context over and above it to ensure all comes via the new context path.您需要在其上方添加一个上下文,以确保所有内容都来自新的上下文路径。

https://jfrog.com/knowledge-base/how-to-remove-artifactory-from-the-context-url-in-artifactory-7/ https://jfrog.com/knowledge-base/how-to-remove-artifactory-from-the-context-url-in-artifactory-7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM