nexus && minio s3 存储私有镜像

时间:2023-03-09 21:16:19
nexus && minio s3 存储私有镜像

对于新版本的nexus 已经支持s3 存储了(3.12),但是企业内部可能还是需要使用私有部署的
还好我们有minio,具体的介绍就不说了

minio 项目运行

 参考项目:
https://github.com/rongfengliang/mino-thumbor-openresty 尽管里面的功能有点多,但是可以了解下,我们只需要使用minio 功能就可以了 具体的启动 docker-compose build && docker-compose up -d minio 服务信息 docker-compose logs -f minio

安装nexus

具体的安装比较简单,参考就行

配置nexus s3 存储

  • 登陆选择blob stores 设置

nexus && minio s3 存储私有镜像

  • 添加 s3 配置

信息使用docker-compose logs minio 获取 region us-east-1 (默认配置)

nexus && minio s3 存储私有镜像
我的设置
nexus && minio s3 存储私有镜像

  • 添加s3 (minio) maven proxy 支持
    nexus && minio s3 存储私有镜像
    nexus && minio s3 存储私有镜像

测试maven 集成

  • 配置maven settings 文件
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>hhttp://hostip:8081/repository/dalong-maven/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
  • 项目pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>nexus-proxy</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.1-jre</version>
</dependency>
</dependencies>
</project>
  • 执行&& 下载效果
mvn package

nexus && minio s3 存储私有镜像
nexus && minio s3 存储私有镜像
nexus && minio s3 存储私有镜像

总结

目前来说还是比较方便的,同时minio 可以支持分布式部署,可以做到ha,还是比较简单的,只是有一个兼容问题(上图)

参考资料

https://help.sonatype.com/repomanager3/quick-start-guide---proxying-maven-and-npm
https://github.com/rongfengliang/mino-thumbor-openresty
https://docs.minio.io/docs/distributed-minio-quickstart-guide