本文主要是介绍Devops——制品仓库构建,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
摘要
根据官方介绍JFrogArtifactory是目前全球唯一一个支持所有开发语言,任意维度的元数据检索、跨语言正反向解析,并拥有深度递归、支持多活异地灾备的企业级、高可用二进制制品管理仓库。这里的二进制制品是指构建过程的输出物,包括软件包、测试报告,应用配置文件等可在服务器上直接运行或可查看的二进制软件制品。
JFrog Artifactory支持多种仓库类型,除了Docker镜像仓库外还支持Maven、Npm等其他类型的仓库。在正式企业级环境中镜像仓库的部署要考虑高可用、扩展性等要求,关于这方面的部署方式可以参考其他官方文档。
一、docker 中单JFrog Artifactory服务的构建
1.1 拉取JFrog Artifactory社区版Docker镜像
# 查看images
docker search JFrog# 拉取镜像
docker pull dzaunerepos/jfrog-artifactory-pro(收费版本)拉取排名最高的镜像(注意这个是付费版,有oss后缀的才是社区版,社区版的镜像下载比较慢,需要考虑科学上网)
docker pull docker.bintray.io/jfrog/artifactory-oss(免费版本)
1.2 创建JFrog Artifactory 数据卷
#创建数据目录
$ mkdir -p /home/mystic/jialexiong/dockerdata/JFrog/data_artifactory/artifactory6_data#赋予权限
chmod 777 /home/mystic/jialexiong/dockerdata/JFrog/data_artifactory/artifactory6_data
1.3 运行JFrog Artifactory 容器
# 如果是付费版用这行命令
docker run --rm --name artifactory -d -v /home/mystic/jialexiong/dockerdata/JFrog/data_artifactory/artifactory6_data:/var/opt/jfrog/artifactory -p 8081:8081 scandio/jfrog-artifactory
# 如果是社区版请用这行命令,暴露多个端口
docker run --name jfrog-oss -d -v /home/mystic/jialexiong/dockerdata/JFrog/data_artifactory/artifactory6_data:/var/opt/jfrog/artifactory -p 8081:8081 -p 8082:8082 -p 8046:8046 -p 8049:8049 -p 8070:8070 docker.bintray.io/jfrog/artifactory-oss
完成上述操作后,如果容器运行成功,此时浏览器输入访问地址:http://127.0.0.1:8081,将会显示如图所示界面:
输入初始密码(admin/password)后,会继续跳转到管理员密码重置界面,如图所示:
依据步骤设置好管理员密码。之后会继续要求设置如订阅邮箱、访问网站域名、代理配置等信息,这里可以暂时忽略直接跳到仓库创建的页面,如图所示:
从上图可以看到JFrogArtifactory支持多种类型的仓库,例如Maven私有仓库也可以通过JFrog Artifactory来进行配置,由于是社区版所以很多其他类型的仓库并未免费开放!这里我们只选择创建Docker镜像仓库,创建后效果如图所示:
如上图所示,默认创建了一个RepositoryKey为docker-local的本地仓库。在实际工作场景中为了便于Docker镜像的管理,可以分别为同一代码空间的项目创建单独的镜像仓库,例如我们本书中所有的Spring Cloud实战项目创建一个单独镜像仓库,点击右上角“New LocalRepository”,如图所示:
到这里JFrog Repository容器镜像仓库的基本部署工作就完成了。
二、docker中多JFrog Artifactory集群的构建
三、源码中JFrog Artifactory集群的构建
3.1 源文件安装
PS G:\artifactory-pro-6.6.0> java -jar .\artifactory-injector-1.1.jar
What do you want to do?
1 - generate License String
2 - inject artifactory
exit - exit
2
where is artifactory home? ("back" for back)
G:\artifactory-pro-6.6.0/
artifactory detected. continue? (yes/no)
yes
putting another WEB-INF/lib/artifactory-addons-manager-6.6.0.jar
META-INF/
org/
org/jfrog/
com/
com/jfrog/
com/jfrog/bintray/
com/jfrog/bintray/pro/
com/jfrog/bintray/pro/client/
com/jfrog/bintray/pro/client/api/
com/jfrog/bintray/pro/client/api/model/
com/jfrog/bintray/pro/client/api/a/
com/jfrog/bintray/pro/client/api/b/
com/jfrog/bintray/pro/client/api/handle/
com/jfrog/bintray/pro/client/api/model/AttachDetachLicenseModel$LicenseActivationStatus.class
com/jfrog/bintray/pro/client/api/model/ActivationKeyValidationResult.class
com/jfrog/bintray/pro/client/api/model/AttachDetachLicenseModel.class
com/jfrog/bintray/pro/client/api/model/LicenseActivationKey.class
com/jfrog/bintray/pro/client/api/a/a.class
com/jfrog/bintray/pro/client/api/a/b$a.class
com/jfrog/bintray/pro/client/api/a/b.class
com/jfrog/bintray/pro/client/api/b/a.class
com/jfrog/bintray/pro/client/api/b.class
com/jfrog/bintray/pro/client/api/a.class
com/jfrog/bintray/pro/client/api/handle/b.class
com/jfrog/bintray/pro/client/api/handle/SignedLicenseActivationKey.class
com/jfrog/bintray/pro/client/api/handle/d.class
com/jfrog/bintray/pro/client/api/handle/c.class
com/jfrog/bintray/pro/client/api/handle/f.class
com/jfrog/bintray/pro/client/api/handle/g.class
com/jfrog/bintray/pro/client/api/handle/LicenseActivationKeyData.class
com/jfrog/bintray/pro/client/api/handle/e.class
com/jfrog/bintray/pro/client/api/handle/a.class
META-INF/MANIFEST.MF
org/artifactory/
org/artifactory/addon/
org/artifactory/addon/a/
org/artifactory/addon/PeriodicReportModel.class
org/artifactory/addon/ConverterBlockerImpl.class
org/artifactory/addon/OnlineLicenseValidationServiceImpl$1.class
org/artifactory/addon/c.class
org/artifactory/addon/LicenseStatus.class
org/artifactory/addon/a/a.class
org/artifactory/addon/AddonsManagerImpl$1.class
org/artifactory/addon/LicenseManagerHelper.class
org/artifactory/addon/e.class
org/artifactory/addon/OnlineLicenseValidationServiceImpl.class
org/artifactory/addon/ArtifactoryLicensePool.class
org/artifactory/addon/ArtifactoryLicenseVerifier.class
org/artifactory/addon/b.class
org/artifactory/addon/OnlineLicenseValidationService.class
org/artifactory/addon/AddonsManagerImpl.class
org/artifactory/addon/a.class
org/artifactory/addon/d.class
org/artifactory/addon/LicenseHolder.class
org/artifactory/addon/PeriodicJobUtil.class
org/artifactory/addon/LicenseProvider.class
META-INF/maven/
Injecting org/jfrog/license/
Injecting org/jfrog/license/legacy/
Injecting org/jfrog/license/legacy/License$Type.class
Injecting org/jfrog/license/legacy/License.class
Injecting org/jfrog/license/api/
Injecting org/jfrog/license/api/a.class
Injecting org/jfrog/license/multiplatform/
Injecting org/jfrog/license/multiplatform/a.class
Injecting org/jfrog/license/a/
Injecting org/jfrog/license/a/a.class
Injecting org/jfrog/license/legacy/SignedLicense.class
Injecting org/jfrog/license/multiplatform/b$1.class
Injecting org/jfrog/license/api/License.class
Injecting org/jfrog/license/api/Product$Type.class
Injecting org/jfrog/license/multiplatform/b.class
Injecting org/jfrog/license/api/Product.class
Injecting org/jfrog/license/multiplatform/License.class
Injecting org/jfrog/license/exception/
Injecting org/jfrog/license/exception/LicenseException.class
Injecting org/jfrog/license/multiplatform/SignedLicense.class
Injecting org/jfrog/license/exception/LicenseRuntimeException.class
Injecting org/jfrog/license/multiplatform/SignedProduct.class
Injecting org/jfrog/license/legacy/JsonLicenseSerializer$1.class
Injecting org/jfrog/license/legacy/b.class
Injecting org/jfrog/license/legacy/JsonLicenseSerializer.class
DONE!
What do you want to do?
1 - generate License String
2 - inject artifactory
exit - exit
1
eyJhcnRpZmFjdG9yeSI6eyJpZCI6IiIsIm*************InZhbGlkRnJvbSI6MTYxNzY3NDgzNTg1MCwiZXhwaXJlcyI6NDc3MzM3NzIzNT**************************yaWFsIjpmYWxzZSwicHJvcGVydGllcyI6e319fQ== (这里打码处理了)
注意: 这个是激活码,一定要记下来,等会要用
eyJhcnRpZmFjdG9yeSI6eyJpZCI6IiIsIm*************InZhbGlkRnJvbSI6MTYxNzY3NDgzNTg1MCwiZXhwaXJlcyI6NDc3MzM3NzIzNT**************************yaWFsIjpmYWxzZSwicHJvcGVydGllcyI6e319fQ== (这里打码处理了)
3.2 运行artifactory
找到G:\artifactory-pro-6.6.0\bin
目录下的artifactory.bat
执行文件来执行。artifactory
服务默认的端口号是8081,直接使用浏览器打开localhost:8081
就可以进入artifactory
的页面。
3.3 设置仓库
Jfroge的artifactory 是一款Maven仓库服务端软件,可以用来在内网搭建maven仓库,供公司内部公共库的上传和发布,以提供公共代码使用的便利性。
Artifactory的仓库主要分三类:local、remote、virtual
- 本地私有仓库(local):用于内部使用,上传的组件不会向外部进行同步;
- 远程仓库(remote):用于代理及缓存公共仓库,不能向此类型的仓库上传私有组件;
- 虚拟仓库(virtual):不是真实在存储上的仓库,用于组织本地仓库和远程仓库
3.3.1 设置远程仓库
找到阿里云的镜像地址
https://maven.aliyun.com/mvn/guide
3.3.2 设置本地仓库
3.3.3 设置虚拟仓库
四、源码中多JFrog Artifactory集群的构建
博文参考
这篇关于Devops——制品仓库构建的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!