zoukankan      html  css  js  c++  java
  • 使用distillery 实现版本的动态升级&& 动态降级

    备注:

    distillery  使用很棒的elixir 打包构建工具,下面演示的是升级以及降级
     
    1. 参考项目
    https://github.com/rongfengliang/phoenix-rest-demo.git
    
    备注: 此项目已经以及配置distillery了,可以参考文档
     
     
       2. 升级&& 降级代码构建
    实际上主要是进行mix.exs  版本修改以及mix  release --upgrade  参数使用
    
    
    a.  0.0.1 版本
    
    mix.exs
    
    def project do
        [
          app: :hello,
          version: "0.0.1",
          elixir: "~> 1.4",
          elixirc_paths: elixirc_paths(Mix.env),
          compilers: [:phoenix, :gettext] ++ Mix.compilers,
          start_permanent: Mix.env == :prod,
          aliases: aliases(),
          deps: deps()
        ]
      end
      
    /web/templates/page/index.html.eex
    
    修改部分代码:
    
    <div class="row marketing">
      <div class="col-lg-6">
        <h4>dalongdmeo v 0.0.1</h4>
        <ul>
     构建:
    
      MIX_ENV=prod mix release
      
    b.  0.0.2 升级版本修改
    
    mix.exs
    
    def project do
        [
          app: :hello,
          version: "0.0.2",
          elixir: "~> 1.4",
          elixirc_paths: elixirc_paths(Mix.env),
          compilers: [:phoenix, :gettext] ++ Mix.compilers,
          start_permanent: Mix.env == :prod,
          aliases: aliases(),
          deps: deps()
        ]
      end
      
    /web/templates/page/index.html.eex
    
    修改部分代码:
    
    <div class="row marketing">
      <div class="col-lg-6">
        <h4>dalongdmeo v 0.0.2</h4>
        <ul>
     构建:
    
      MIX_ENV=prod mix release --upgrade
      
    c. 构建结果
      参考下图:
     
     
    3. 使用
    a. 启动一个版本(0.0.2)
    
    因为有两个构建,默认启动是最新的版本
    
    _build/prod/rel/hello/bin/hello foreground
    
    结果如下图:
     
     
     
    b. 演示降级
    
    _build/prod/rel/hello/bin/hello downgrade 0.0.1
    
    Release 0.0.1 not found, attempting to unpack releases/0.0.1/hello.tar.gz
    Unpacked successfully: "0.0.1"
    Release 0.0.1 is already unpacked, now installing.
    Installed Release: 0.0.1
    Made release permanent: "0.0.1"
    
    
    结果如下图:
     
     
     
    4. 总结
    功能比较棒,能够实现代码的热切换,对于业务不能停顿的系统特别有用
     
     
    5. 参考资料
    https://github.com/rongfengliang/phoenix-rest-demo
    https://hexdocs.pm/distillery/walkthrough.html#content
     
  • 相关阅读:
    spring cloud 和 阿里微服务spring cloud Alibaba
    为WPF中的ContentControl设置背景色
    java RSA 解密
    java OA系统 自定义表单 流程审批 电子印章 手写文字识别 电子签名 即时通讯
    Hystrix 配置参数全解析
    spring cloud 2020 gateway 报错503
    Spring Boot 配置 Quartz 定时任务
    Mybatis 整合 ehcache缓存
    Springboot 整合阿里数据库连接池 druid
    java OA系统 自定义表单 流程审批 电子印章 手写文字识别 电子签名 即时通讯
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/8886309.html
Copyright © 2011-2022 走看看