fis-receiver:一行命令將項目部署到遠程服務器

前言

本項目基於FIS2,沒了。其實fis項目自己就提供了php版本的範例,這裏翻譯成node版本。php

項目地址:https://github.com/chyingp/fis-receivercss

服務端接收腳本部署

首先,克隆項目html

git clone https://github.com/chyingp/fis-receiver.git

跟着,安裝依賴node

cd fis-receiver/
npm install

而後,啓動服務git

npm start

配置修改:fis-conf.js

如下內容參考 fis-receiver/examples 的例子github

fis-conf.js中加入以下配置。其中:npm

  • receiver:修改爲服務端腳本實際部署的路徑。json

  • to:修改爲項目打算部署到的遠程服務器上的路徑。api

fis.config.merge({
    deploy: {
        remote: {               
            receiver: 'http://127.0.0.1:3000/cgi-bin/release',  // 接收服務的地址
            from: '/',
            to: '/tmp/test' // 服務器上部署的的路徑
        }       
    }   
});

啓動遠程部署。服務器

fis release -d remote

從打印的日誌能夠看到項目已經被部署到遠程服務器。

δ 7ms

 Ω ... 35ms
 - [22:53:51] css/index.css >> /tmp/test/css/index.css
 - [22:53:51] index.html >> /tmp/test/index.html
 - [22:53:51] js/index.js >> /tmp/test/js/index.js
 - [22:53:51] map.json >> /tmp/test/map.json

打開遠程服務器目錄,查看部署結果。

cd /tmp/test 
test  ll

從目錄下的內容來看,部署成功。

total 16
drwxr-xr-x   6 a     wheel  204  3  3 22:53 .
drwxrwxrwt  13 root  wheel  442  3  3 22:56 ..
drwxr-xr-x   3 a     wheel  102  3  3 22:53 css
-rw-r--r--   1 a     wheel   82  3  3 22:53 index.html
drwxr-xr-x   3 a     wheel  102  3  3 22:53 js
-rw-r--r--   1 a     wheel  233  3  3 22:53 map.json

相關連接

官方部署配置:
http://fex.baidu.com/fis-site/docs/api/fis-conf.html#deploy

fis中自帶的php版本的例子
https://github.com/fex-team/fis-command-release/blob/master/tools/receiver.php

相關文章
相關標籤/搜索