JFrog Artifactory使用中遇到的一些坑 2019-10-24 16:49:01 最近用JFrog的Artifactory把公司的nodejs、java、python、golang、docker等技术栈的包管理统一管理起来了。 用来加速研发的开发过程,一套系统搞定爽歪歪。 使用中也遇到一些问题,记录之,以备用。 ## 默认readers组无法下载包的问题 定位,到logs目录下:`tail -f access.log` ``` 2019-10-24 16:15:24,004 [ACCEPTED LOGIN] for client : zhaishidan / xxx.xx.xx.xx. 2019-10-24 16:16:36,482 [DENIED DEPLOY] pypi-remote-cache:.pypi/pyenv.html for client : zhaishidan / xxx.xx.xx.xx. ``` 看来是没有Deploy权限导致的,我用`pip install xxx`,Artifactory会从远端仓库下载,并缓存,默认的readers组只有读权限,所以报了这个问题。 ![图片标题](https://stanzhai.site/api/file/getImage?fileId=5e61099566f3b358d50006b1) 找到问题,就好办了,添加一个Permission设置,并设置Deploy/Cache权限就可以了。 ## Scala sbt Here's what I did (sbt 0.13 + artifactory - setup should be similar for nexus): 1) Edited the file ~/.sbt/repositories as specified here: https://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html ``` [repositories] local my-ivy-proxy-releases: http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] my-maven-proxy-releases: http://repo.company.com/maven-releases/ ``` 2) Locked down my artifactory to disable anonymous access. 3) Created a credentials file in ~/.sbt/.credentials ``` realm=Artifactory Realm host=artifactory.mycompany.com user=username password=password ``` 4) Created a file under ~/.sbt/0.13/plugins/credentials.sbt that wires up the default credentials credentials += Credentials(Path.userHome / ".sbt" / ".credentials") Now when my project loads sbt hits artifactory like normal. The reason I did it this way is to keep the repository definitions, etc, out of the project files to enable teams to have flexibility (they can set up an internal server to serve in-progress artifacts, etc). ## Python 项目中使用poetry管理了依赖,但是poetry使用的是pip官方的源,且无法修改,只能将pip的默认源进行全局修改。 修改:`~/.pip/pip.conf`,添加如下内容: ``` [global] index-url = https://user:password@ip:port/artifactory/api/pypi/pypi/simple ``` ## Docker CentOS下通过Rancher获取docker镜像提示`--insecure-registry`的问题。 添加或修改`/etc/docker/daemon.json`,示例内容如下: ``` { "insecure-registries":["域名或ip:port"] } ``` 重启Docker生效 ``` systemctl restart docker ``` Mac系统下,则需要添加一个insecure-registries的配置,然后重启Docker Engine,示例如下: ![](https://stanzhai.site/api/file/getImage?fileId=5e61099566f3b358d50006b2) 非特殊说明,均为原创,原创文章,未经允许谢绝转载。 原始链接:JFrog Artifactory使用中遇到的一些坑 赏 Prev 最小化构建Docker镜像 Next 关于Hadoop NameNode启动时Loading edits时间超长的问题