zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    很经典的GDB调试命令,包括查看变量,查看内存
    ACE编程(2)
    GDB调试用列
    gdb调试带参数程序
    http与https的区别
    gdb使用方法简介
    TCP/IP三次握手和HTTP过程
    gdb调试器命令学习总结笔记
    Linux gdb设置和管理断点
    ATMEGA128单片机的软件远程升级(转)
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/15417982.html
Copyright © 2011-2022 走看看