opencomponents 私服minio 模式运行

opencomponents 官方是提供了一个简单的私服核心的,我们可以自己构建部署(基于minio)

运行

  • 环境准备 (minio s3)
version: "3"
services:
  s3:
    image: minio/minio
    environment:
      - "MINIO_ACCESS_KEY=minio"
      - "MINIO_SECRET_KEY=minio123"
    command: server /data --console-address ":9001"
    ports:
      - "9000:9000"
      - "9001:9001"
  • server 代码
 var oc = require('oc');
var configuration = {
  verbosity: 1111,
  baseUrl: 'http://localhost:3000/',
  port: 3000,
  tempDir: './temp/',
  refreshInterval: 600,
  pollingInterval: 5,
  s3: {
    key: 'minio',
    secret: 'minio123',
    bucket: 'mydemo',
    debug:true,
    sslEnabled:false,
    s3ForcePathStyle: true,
    region: 'us-east-1',
    path: 'http://localhost:9000/mydemo/',
    endpoint:"http://localhost:9000",
    componentsDir: 'components'
  },
  env: { name: 'production' }
};
 
var registry = oc.Registry(configuration);
 
registry.start(function(err, app){
  if(err){
    console.log('Registry not started: ', err);
    process.exit(1);
  }
});
  • 效果

 

 

运行问题

因为opencomponents 私服开启了s3 的sse 但是默认部署的minio 是没开启的,如果需要可以自己部署,或者直接修改代码禁用 oc-s3-storage-adapter
具体需要修改的部分是

 
const putFileContent = (fileContent, fileName, isPrivate, callback) => {
    const fileInfo = getFileInfo(fileName);
    const obj = {
      Bucket: bucket,
      Key: fileName,
      Body: fileContent,
      ACL: isPrivate ? 'authenticated-read' : 'public-read',
     // ServerSideEncryption: 'AES256',  // 默认部署的minio 是不支持的
      Expires: getNextYear()
    };
  • oc client 访问地址问题
    如果使用以上代码运行,基本的配置是没有问题,但是oc client 会有问题,具体原因
    是官方需要使用cdn 进行加速处理,使用了s3 静态能力,如果测试需要访问简单的就
    开启s3 * readonly

发布组件

  • 命令
 
oc publish my-first-component

 

 

 

 

  • 仓库预览效果

 

 

说明

opencomponents 的设计以及仓库的设计还是比较易用的,但是如果需要生产使用推荐还是自己修改下,还是有一些问题的(尤其是安全以及使用自己的s3)

参考资料

https://github.com/opencomponents/oc/wiki#setup-a-registry
https://github.com/minio/kes/wiki/Configuration
https://github.com/opencomponents/oc/wiki/Registry

posted on   荣锋亮  阅读(161)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-10-17 waypoint hashicorp 团队新开源的跨多平台的构建部署&&发布工具
2020-10-17 pgenv 一个不错的postgres 多版本管理工具
2020-10-17 golang 一些不错的环境变量管理包
2020-10-17 treemux 集成pprof以及statsviz
2019-10-17 Aquameta 基于postgresql的web 开发平台
2019-10-17 使用google autoservice 自动生成java spi 描述文件
2019-10-17 micronaut 学习 二 创建一个简单的服务

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示