Giter Site home page Giter Site logo

chenmortal / dockyard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from open-rust-initiative/dockyard

0.0 0.0 0.0 3.48 MB

OCI Registry

License: MIT License

Shell 1.39% Dockerfile 0.25% JavaScript 0.80% HTML 0.67% Vue 21.87% TypeScript 10.66% CSS 1.69% SCSS 0.83% Rust 61.84%

dockyard's Introduction

概述

dockyard 是一个符合 OCI Distribution 标准的 Registry 服务,使用rust语言编写

技术栈

  • 后端:tokio runtime + actix-web + diesel (orm) + tracing (log)
  • 前端:vue3 + element-plus + echarts + pinia + vue-i18n

安装

  • 配置文件(.env)

    var detail
    JWT_SECRET (required) jwt服务的密钥
    TOKEN_EXPIRES_IN (required) token有效时间
    SERVERHOST (required) 对为暴露的域名,容器化部署时不可为localhost,需要http或https前缀
    BASE_STORGE_URL (required) 本地存储目录,镜像文件皆存于之下
    DATABASE_POOL_MAX_SIZE (default 15 ) 数据库连接池最大连接数
    DATABASE_POOL_CONNECTION_TIMEOUT (default 30 sec ) 数据库连接池超时时间
    REDIS_POOL_MAX_SIZE (default 15 ) Redis连接池最大连接数
    REDIS_POOL_CONNECTION_TIMEOUT (default 30 sec) Redis连接池超时时间
  • 容器化自动部署(适合生产环境部署,默认使用https)

    使用install.sh

    注意编译环境

    • nodejs > 14
    • libssl-dev on Ubuntu or openssl-devel on Fedora. pkg-config
    • libmysqlclient-dev on Ubuntu or mysql-devel on Fedora

    执行流程

    1. migrations下的up.sql文件复制到db目录下,运行Dockerfile(以mysql:8为基础),使得容器创建时自动运行sql文件,创建数据库和表,创建镜像 dockyard/database

    2. 使用npm编译前端工程,输出到static目录,由actix-web提供服务

    3. 创建容器网路dockyard,在该网络下创建dockyard-db dockyard-redis容器实例

    4. 编译dockyard 后端服务,基于 dbredis 实例 自动生成DATABASE_URL REDIS_URL 到 .env 文件中

    5. 修改BASE_STORGE_URL/opt/dockyard/files/ ,在容器实例中 上传的镜像文件皆保存于之下。注意

      SERVERHOST 设置为https

    6. 构建镜像,创建实例dockyard-core 默认绑定443端口

  • 手动部署(适合debug)

    1. 进入 portal 目录 安装依赖npm install 构建 npm run build 生成结果到 static目录

    2. 使用 migrations下的up.sql 创建所需的数据库和表

    3. 运行 cargo build --release 编译rust 文件

    4. 编辑.env 配置文件 根据现有 mysql 和 redis 添加 DATABASE_URL REDIS_URL

    5. target/release/dockyard 文件 、.envstatic目录 、ssl密钥文件 cert.pem key.pem 放入到同一目录下

      ./dockyard 即可运行。(注意执行环境需要libmysqlclient-dev)

  • https 配置

    将SERVERHOST前缀设置为https,根据自身需要替换ssl 密钥,或自行生成

    openssl req -x509 -newkey rsa:4096 -nodes -keyout key.pem -out cert.pem -days 365 -subj '/CN=localhost'

    注意自行生成的ssl密钥,没有三方证书,故需要在/etc/docker/daemon.json 配置

    "insecure-registries": [
        "oci.org"
    ]

测试

  • OCI 标准 提供了 一致性检验工具 https://github.com/opencontainers/distribution-spec/tree/main/conformance

    conformance 目录为该工具的复制版

  • config文件中即 conformance.test所需的变量 source ./config 加载变量的配置 source ./unconfig 取消 config变量设置

    变量细节参考 该目录下的README.md文件

  • 运行./conformance.test 会在该目录下生成report.html文件

  • 注意https测试不成功,需要配置为http,建议配置SERVERHOST=http://127.0.0.1:4000, 并修改conformance/config文件:OCI_ROOT_URL="http://127.0.0.1:4000" 注意 BASE_STORGE_URL 对应路径有文件创建权限 注意必须声明 DATABASE_URL REDIS_URL

dockyard's People

Contributors

genedna avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.