npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

br2k-truffle

v1.0.6

Published

## modify() -[2020.12.03] change k8s client: kubernetes-client(3rd party module) => @kubernetes/client-node(officially library) - spary add localDB yaml ->> yaml file Hash store --> Service Registry+ context.json

Downloads

427

Readme

트러플 확장 프레임워크를 위한 커맨드 라인 인터페이스

modify()

-[2020.12.03] change k8s client: kubernetes-client(3rd party module) => @kubernetes/client-node(officially library)

  • spary add localDB yaml ->> yaml file Hash store --> Service Registry+ context.json

구현 환경

  • node v14.15.1
  • npm 6.14.8
  • truffle 5.1.55 (install: npm install -g truffle)
  • docker 19.03

All br2k commands work only in the project root!

$ mkdir PROJECT_NAME
$ cd PROJECT_NAME
$ br2k init
$ br2k ask-context -f CONTEXT_ASK_FILE.yaml -r CONTEXT_ASSIGN_SERVER_URL
$ br2k set-context -f ./context.yaml
$ br2k list-context (or br2k cur-context)
$ (option) br2k add-image-registry -f REGISTRY_ACCOUNT_FILE.yaml (example ->DIR: specific-document-example)
$ (option) br2k add-service-registry -f SERVICE_ACCOUNT_FILE.yaml (example ->DIR: specific-document-example)
$ br2k build -n APP_NAME(option)   (Place your custom docker file PROJECT_ROOT/util/docker/ )
$ br2k list (Get BUILD_IMAGE_NAME or BUILD_IMAGE_ID )
$ br2k login-registry -p REGISTRY_PASSWORD (Cert ref -> docs.docker.com/engine.security/certificates/)
$ br2k push -i BUILD_IMAGE_NAME(or BUILD_IMAGE_ID) -p CONTAINER_REGISTRY_PROJECT
$ br2k set-secret -p PASSWORD_CONTAINER_REGISTRY
$ br2k register -f SERVICE_INFO.yaml -p ACCOUNT_PASSWORD
$ br2k view-service (or br2k view-service -f ./service-info.json)
$ br2k test -i IMAGE_NAME -s SECRET_NAME(option)
$ br2k test -e
$ br2k spray -i IMAGE_NAME -r REPLICAS -s SECRET(when step.13) -n APP_NAME
$ br2k state && br2k view-service

context struct

  • api-server: array
  • access-token: string
  • assign-resource: object
    • node-id: string(node label 값)
    • network-id: string(service 오브젝트를 생성할 때 명세해준 label 값을 의미)
    • service-protocol: string(http, https,...)
    • service-points: array(external ip )
    • service-port: 3000(array로 수정 )

쿠버네티스 우선 설정해야하는 것들

  • 사용할 쿠버네티스 클러스터에 kubectl 연결
  • 쿠버네티스의 각 노드에 label 할당(./k8s-managers-example/add_node_labels/label.sh 실행)
  • 온 프레미너스 쿠버네티스인 경우 service 오브젝트의 ip 자동할당을 위한 baremetal-lb 셋팅

context 생성

  • 서비스 오브젝트들 생성(for 복제 앱의 외부 접근을 위하여, 그 유저의 할당량 만큼, ./k8s-managers-example/assign-service(external_ip).yaml 사용)
  • 유저가 사용할 namespace 발급(쿠버네티스의 논리적 구역 단위)
  • 유저가 사용할 서비스 계정(Service Account) 생성(서비스 계정의 액세스 토큰를 context에 사용, ./k8s-managers-example/assign_accessToken_to_user/access_token.sh 실행 )

example-framework

해당 framework를 사용한 3개의 예시 프로젝트

res

br2k init할 때 사용되는 리소스들(init할 프로젝트에 파일 및 폴더 생성)

  1. /res/util/regsitry: 블록체인 서비스 레지스트리 스마트 컨트랙트 ABI 파일 있는 곳
  2. /res/util/k8s:
    • contexts.json: br2k 프로젝트 핵심 명세파일
    • example: contexts.json 기록되는 예시가 담긴 폴더
    • template: 서비스를 배포할 때 사용될 쿠버네티스 yaml 템플릿 파일(pod.yaml[core], secret 폴더[쿠버네티스 컨테이너 이미지 다운받을 때 사용되는 계정 정보:쿠버네티스 계정], test-pod.yaml[?])
    • command: ?
  3. /res/util/docker:
    • image.json: 빌드된 이미지 기록된 파일
    • ? registry.json: 빌드된 이미지가 컨테이너 레지스트리에 푸시할 때 기록하는 것
  4. k8s-managers-exmaple: 쿠버네티스 관리자가 contexts.yaml을 만들 때 필요한 스크립트와 파일들
  5. /res/specific-document-example: br2k에서 사용되는 파일 양식 예제
    • context.yaml: 쿠베 관리자에 의해서 전달받은 context(사용할 수 있는 context 명세)
    • context-ask.yaml: file for ask context to manager
    • registry-auth.yaml: (하버) 레지스트리 로그인
    • service-registry-auth.yaml: 서비스 레지스트리 컨트랙트에 접근할 계정 정보
    • service-registry-content.yaml: 서비스 레지스트리에 서비스 정보를 넣을 때 명세해야하는 파일
  6. /res/Dockerfile AND /res/.dockerignore
    • Dockerfile: 복제 앱을 컨테이너 이미지로 만들 때 사용되는 도커 이미지 빌드 파일
    • .dockerignore:

init

기본 트러플 프레임워크 프로젝트에서 br2k CLI을 사용하기 위한 폴더, 파일 생성

동작 과정
  1. .br2k.json(br2k을 사용하기 위한 프로젝트에 대한 메타정보) 생성 여부 확인 후, 이미 존재하면 커맨드 종료 아니라면 파일 생성
  2. truffle 설치 여부 확인 및 안되면 설치
  3. 현재 위치에 truffle init(기본 프레임워크 구성)
  4. npm init (+express)
  5. br2k 관련된 파일, 폴더 추가 (./server, ./util/registry, ./util/k8s, ./util/docker, ./specific-document-example)

ask-context

Ask context for context-assign-server(k8s-managers)