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
     
  • 相关阅读:
    elselect下拉数据过多解决办法
    移动端开发遇到的问题汇总
    win7系统可关闭的服务
    安装Qcreator2.5 + Qt4.8.2 + MinGW_gcc_4.4 (win7环境)
    学习Qt的资源
    c++学习 定位new表达式
    eltablecolumn中添加echarts
    js对象数组封装,形成表格,并在表格中添加echarts直折线图
    Unity学习笔记3:随机数和动画脚本
    关于Unity的一些概念和语法
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/8886309.html
Copyright © 2011-2022 走看看