Giter Site home page Giter Site logo

sae's People

Contributors

anycodes avatar heimanba avatar joycepy avatar sujie1024 avatar wss-git avatar xsahxl avatar yangsoon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sae's Issues

SAE namespace 相关字段设计

总体API设计

region: cn-hangzhou
namespace: ## 命名空间相关,或者为: auto  ## service
  config: # auto 或者 一个Object
    id: cn-hangzhou:test
    name: test-name
    description: namespace desc
    vpcConfig: # 选填
      vpcId: vpc-bxxxxc7pobl
      vSwitchId: vsw-bp17xxxxpfg9zr
      securityGroupId: sg-bp1xxxxxpzx4db    
  applications: ## 应用  ## function
    - name: test
      decription: This is a test description.
      code:
        packageType: PhpZip # 必填
        packageVersion: 0.0.1
        packageUrl: test.war # 文件路径
        ossConfig: bucket4sae
      cpu: 500 #  选填
      memory: 1024 #  选填
      replicas: 1 #  选填
slb:  ## 非必填
    Internet: [{ "port": 80, "targetPort": 8080, "protocol": "HTTP" }]

namespace

namespace 必须存在,可能为 Object对象或者 auto

namespace 还需要考虑创建

namespace 可以为 auto 字段,等价于 autoConfig: auto

namespace 不为auto时候

  1. id 必须存在 ,需要校验
  2. vpcConfig:
    a: auto:
    a1: 获取namespace下面的vpc信息获取成功,则进行下一步
    a2: 如果namespace下面不存在 vpc信息.。则直接报错,(当然也可以直接创建【TODO】)
    b: 对象值
    b1: 校验里面填写的字段:是否存在vpcId/vSwitchId/securityGroupId
    b2: 直接填写

SAE 新版设计

s.yaml设计

region: cn-hangzhou
name: test
description: This is a test description
namespace: # 选填
  id: cn-beijing:test
  name: name
  description: namespace desc
vpcConfig: # 选填
  vpcId: xx
  vSwitchId: xx
  securityGroupId: xxx
package: 
  javaWar/javaJar/javaImage
  phpZip/phpImage
  image
cpu: 500(默认)
memory: 1024(默认)
replicas: 1

slb: 
  type: Intranet
    id: lb-bp1tg0k6d9nqaw7l1****
    config:
      - port: 80
        targetPort: 8080
        protocol: TCP
     

javaWar

type: FatJar
version: 0.0.1
url: xxxx
jdk: xxx

查看指令帮助,展示的提示信息有误

执行 s deploy -h的时候,Document 链接 错误,所有的子命令都有这个问题。

https://github.com/devsapp/sae/blob/main/docs/command/deploy.md 地址错误,
应该是 https://github.com/devsapp/sae/blob/master/docs/deploy.md

image

SAE新版设计思路

  1. 主要场景
    • CI/CD的支持,借助Serverless Devs整体自动对接各类CI/CD平台
    • 与已有工具的集成,例如Cloudshell,以及我们之后的webide等,云效的IDE等
    • 对外形成统一产品心智,阿里云Serverless产品

0.1. 要明确的事情:

  • 场景
  • Yaml规范
  • Yaml格式
  1. 检查服务是否开通,没有开通的话调用开通的接口

    • 需要明确是否交互式提醒开通,还是默认帮忙开通
  2. 初步考虑了一个Yaml格式:

edition: 1.0.0
name: hello-world-app
access: "default"

services:
  helloworld: # 业务名称/模块名称
    component:  sae
#    actions: # 自定义执行逻辑
#      pre-deploy: # 在deploy之前运行
#        - run: s build --use-docker --dockerfile ./code/Dockerfile  # 要运行的命令行
#          path: ./ # 命令行运行的路径
#      post-deploy: # 在deploy之后运行
#        - run: s versions   # 要运行的命令行
#          path: ./ # 命令行运行的路径
    props: #  组件的属性值
      Region: cn-hangzhou
      Namespace:
        Id: cn-beijing:test
        Name: name
        Description: desc
        Vpc:
          Id: vpc-2ze0i263cnn311nvj****
          VSwitchId: vsw-bp12mw1f8k3jgygk9****
          SecurityGroupId: sg-wz969ngg2e49q5i4****
      Ingress:
        - Description: desc
          SlbId: lb-uf6hucc7inlqrtcq5****
          ListenerPort: 80
          CertId: 188077086902****_176993d****_181437****_108724****
          DefaultRule:
            appId: 395b60e4-0550-458d-9c54-a265d036****
            containerPort: 8080
          Rules:
            - appId: 395b60e4-0550-458d-9c54-a265d036****
              containerPort: 8080
              domain: www.sae.site
              path: /path1
      Application:
        AutoConfig: false
        AppName: test
        Description: desc
        Package:
          Type: FatJar
          Version: 1.0.0
          Url: http://myoss.oss-cn-hangzhou.aliyuncs.com/my-buc/2019-06-30/sae-test.jar
          Jdk: Open JDK 8
          WebContainer: apache-tomcat-7.0.91
        Cpu: 1000
        Memory: 1024
        Replicas: 1
        Command: sleep
        CommandArgs: 1d
        Envs:
          - name: envtmp
            value: 0
        CustomHostAlias:
          - hostName: samplehost
            ip: 127.0.0.1
        JarStart:
          Options: -Xms4G -Xmx4G
          Args: custom-args
        Liveness:
          exec:
            command: ["sh","-c","cat /home/admin/start.sh"]
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 2
        Readiness:
          exec:
            command: ["sh","-c","cat /home/admin/start.sh"]
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 2
        EdasContainerVersion: 3.5.3
        Timezone: Asia/Shanghai
        SlsConfigs:
          - logDir: /root/logs/hsf.log
        
        PreStop:
          exec:
            command:
              - ["cat","/etc/group"]
        PostStart:
          exec:
            command:
              - ["cat","/etc/group"]
        WarStartOptions: CATALINA_OPTS=\"$CATALINA_OPTS $Options\" catalina.sh run
        ConfigMapMountDesc:
          - configMapId: 16
            key: test
            mountPath: /tmp
        TerminationGracePeriodSeconds: 30
        PHPConfig:
          ArmsConfigLocation: /usr/local/etc/php/conf.d/arms.ini
          ConfigLocation: /usr/local/etc/php/php.ini
          Config: k1=v1
        TomcatConfig:
          "port":8080
          "contextPath":"/"
          "maxThreads":400
          "uriEncoding":"ISO-8859-1"
          "useBodyEncodingForUri":true}
        OSS:
          MountDescs:
            - "bucketName": "oss-bucket"
              "bucketPath": "data/user.data"
              "mountPath": "/usr/data/user.data"
              "readOnly": true}]
          AkId: xxxxxx
          OssAkSecret: xxxxxx
        Nas:
          Id: KSAK****
          MountHost: example.com
          MountDesc:
            - mountPath: /tmp
              nasPath: /
        AcrAssumeRoleArn: acs:ram::123456789012****:role/adminrole
        AssociateEip: true
    SLB:
      Type: Intranet
      SlbId: lb-bp1tg0k6d9nqaw7l1****
      Config:
        - port: 80
          targetPort: 8080
          protocol: TCP

这个要和sae的同学一起研究探讨一下

  1. 第一期支持的功能
    • deploy:部署(需要考虑是否要进行自动push)
    • build:构建

sae 部署缓存

sae 主要的部署分为应用部署以及 slb的部署
但是SLB部署一般不会改动,这里可否将SLB的信息缓存到本地,部署的时候进行对比,再次部署的时候进行skip

希望可以支持Jar和Dockerfile的模式

edition: 1.0.0          #  命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范
name: sae-app            #  项目名称
access: aliyun-release  #  秘钥别名

services:
  sae-test: #  服务名称
    component:  devsapp/sae
    props:
      region: cn-shenzhen
      appName: dankun-sae
      appDescription: saedemo
      code:
        imageUrl: registry-vpc.cn-shenzhen.aliyuncs.com/sae-demo-image/consumer:1.0
        path: 可以是.jar, war
        image: xxx /指定本地镜像
      replicas: 1
      cpu: 500
      memory: 1024
      port: 80
      targetPort: 8080

关于docker image push到acr,可以参考:https://github.com/devsapp/fc-deploy/blob/e52ce40dcaf2e44f0ab14433272aa7fcc4beafbf/src/lib/fc/function.ts#L291

namespace 设计

现在设计为

namespace: #  选填
        id: cn-beijing:test
        name: test-name
        description: namespace desc

namespace 不会存在创建的场景,因为这里需要和vpc/vswitchId 配合,所以namespace只能是导入。这里是否可以设计为

namespaceId: cn-beijing:test

image

slbConfig参数

services:
  sae-test: #  服务名称
    component:  devsapp/sae
    props:
      application:
        region: cn-beijing
        port: 8080
      slbConfig: auto
  1. auto:
  • 公网访问地址
  • 使用是HTTP协议,并且HTTP端口为80
  1. 用户自己填写

s deploy 部署完详情优化

  1. 样式优化,输出可以使用 core里面的进行显示。
logger.output({

})
  1. 理论上需要显示应用所有的配置。
    image
 namespace: 
    id:   cn-hangzhou
    name: China East 1 (Hangzhou)
  application: 
    appId: cd58f167-ebda-491f-b0e0-6771c294cb1d
    name:  test-1
 slb: 
    InternetIp: 121.41.49.27
  console:     https://sae.console.aliyun.com/#/AppList/AppDetail?appId=cd58f167-ebda-491f-b0e0-6771c294cb1d&regionId=cn-hangzhou&namespaceId=cn-hangzhou

s remove 提醒信息

image

  1. namespace
  • namespaceId
  • vpcId
  • vswitchId
  • 安全组
  1. application:
    需要加上
    applicationName,cpu,memory, runningInstances/instances

  2. slb
    InternetIp 以及 IntranetIp 应该展示全部的信息(可以把JSON给出去)

一键启停能力增加

SAE是按照时长收费的,一键启停是非常重要的能力。

一键停止

s stop -y/n
https://next.api.aliyun.com/api/sae/2019-05-06/StopApplication?params={} 

一键启动

s start -y/n
https://next.api.aliyun.com/api/sae/2019-05-06/StartApplication?params={}

ossConfig 逻辑完善

  1. OSS 文件规范
    ${regionid}_${namespace}_${appName}.zip
  2. 部署成功立即删除文件

应用扩缩容命令无效

在本地创建了一个文件夹,文件夹下有一个 s.yaml 文件,执行 deploy 指令创建成功之后,执行 rescale指令出现问题

  1. 直接执行 s rescale 指令出现问题。
    image

  2. 指定参数也出现问题
    image

支持下从阿里云ACR镜像仓库拉取镜像

目前的版本像是不支持,请支持下,我这边调用提示如下错误,
s deploy [2024-03-08 22:43:59] [ERROR] - InvalidImageUrl.MissingAcrInstanceIdError: code: 400, The specified domain of ImageUrl is from ACREE, but you are not specified AcrInstanceId.

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.