Repository: TarsCloud/Tars Branch: master Commit: be9b98bab706 Files: 34 Total size: 60.0 KB Directory structure: gitextract_q0df83d1/ ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── custom.md │ │ └── feature_request.md │ ├── ISSUE_TEMPLATE.md │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ ├── deploy-framework-docker.yml │ ├── deploy-latest-framework-docker.yml │ ├── deploy-latest-tars-docker.yml │ └── deploy-tars-docker.yml ├── .gitignore ├── .gitmodules ├── Contributing.md ├── LICENSE ├── PerfTestSoft/ │ ├── Readme.md │ ├── StressBenchmark/ │ │ ├── README.md │ │ ├── TarsStressClient/ │ │ │ ├── Stress.h │ │ │ ├── main.cpp │ │ │ ├── makefile │ │ │ └── teststress.sh │ │ └── TarsStressServer/ │ │ ├── Stress.tars │ │ ├── StressImp.cpp │ │ ├── StressImp.h │ │ ├── TarsStressServer.cpp │ │ ├── TarsStressServer.h │ │ └── makefile │ └── introduction.md ├── README.md ├── README.zh.md ├── tag.sh ├── tars-deploy-framework.sh ├── tars-deploy-tars.sh ├── tars-latest-deploy-framework.sh └── tars-latest-deploy-tars.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ * linguist-language=C++ ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: "[BUG]" labels: bug assignees: '' --- **What version of TARS and what language are you using?** **What operating system (Linux, Windows, ...) and version?** [e.g. CentOS 7.8] **What runtime/compiler are you using?** [e.g. JDK version or version of gcc] **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/custom.md ================================================ --- name: Custom issue template about: Describe this issue template's purpose here. title: '' labels: '' assignees: '' --- ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: "[FEATURE]" labels: enhancement assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ ### What language are you using? ### What operating system (Linux, Ubuntu, …) and version? ### What runtime / compiler are you using (e.g. jdk version or version of gcc) Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs). ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ **IMPORTANT: Please do not create a Pull Request without creating an issue first.** *Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.* Please provide enough information so that others can review your pull request: Explain the **details** for making this change. What existing problem does the pull request solve? **Test plan (required)** Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. **Code formatting** **Closing issues** Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). ================================================ FILE: .github/workflows/deploy-framework-docker.yml ================================================ name: deploy-framework-docker on: push: tags: - v* jobs: build: runs-on: ubuntu-20.04 steps: - name: docker login run: | docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} - name: Get version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - uses: actions/checkout@v3 with: submodules: true - name: deploy docker run: | echo $GITHUB_SHA ./tars-deploy-framework.sh ${{ steps.get_version.outputs.VERSION }} true ================================================ FILE: .github/workflows/deploy-latest-framework-docker.yml ================================================ name: deploy-latest-framework-docker on: push: branches: - master jobs: build: runs-on: ubuntu-20.04 steps: - name: docker login run: | docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} - uses: actions/checkout@v3 with: submodules: true - name: deploy docker run: | echo $GITHUB_SHA ./tars-latest-deploy-framework.sh true ================================================ FILE: .github/workflows/deploy-latest-tars-docker.yml ================================================ name: deploy-latest-tars-docker on: push: branches: - master jobs: build: runs-on: ubuntu-20.04 steps: - name: docker login run: | docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} - uses: actions/checkout@v3 with: submodules: true - name: deploy docker run: | echo $GITHUB_SHA ./tars-latest-deploy-tars.sh true ================================================ FILE: .github/workflows/deploy-tars-docker.yml ================================================ name: deploy-tars-docker on: push: tags: - v* jobs: build: runs-on: ubuntu-20.04 steps: - name: docker login run: | docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} - name: Get version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - uses: actions/checkout@v3 with: submodules: true - name: deploy docker run: | echo $GITHUB_SHA ./tars-deploy-tars.sh ${{ steps.get_version.outputs.VERSION }} true ================================================ FILE: .gitignore ================================================ /java/core/.settings /java/core/.classpath /java/core/.project /java/examples/quickstart-client/.settings /java/examples/quickstart-client/.project /java/examples/quickstart-client/.classpath /java/examples/quickstart-server/.settings /java/examples/quickstart-server/.project /java/examples/quickstart-server/.classpath /java/net/.settings /java/net/.project /java/net/.classpath /java/tools/tars-maven-plugin/.settings /java/tools/tars-maven-plugin/.project /java/tools/tars-maven-plugin/.classpath /java/core/target /java/examples/quickstart-client/target /java/examples/quickstart-server/target /java/net/target /java/tools/tars-maven-plugin/target /java/examples/stress-server/.classpath /java/examples/stress-server/.project /java/examples/stress-server/.settings /java/examples/stress-server/target /java/.project /java/.settings/org.eclipse.m2e.core.prefs /java/examples/.project /java/examples/.settings/org.eclipse.m2e.core.prefs /java/tools/.project /java/tools/.settings/org.eclipse.m2e.core.prefs /php/.idea/* .idea/* ================================================ FILE: .gitmodules ================================================ [submodule "framework"] path = framework url = https://github.com/TarsCloud/TarsFramework [submodule "cpp"] path = cpp url = https://github.com/TarsCloud/TarsCpp [submodule "java"] path = java url = https://github.com/TarsCloud/TarsJava [submodule "nodejs"] path = nodejs url = https://github.com/tars-node/Tars.js [submodule "php"] path = php url = https://github.com/TarsPHP/TarsPHP [submodule "tup"] path = tup url = https://github.com/TarsCloud/TarsTup [submodule "web"] path = web url = https://github.com/TarsCloud/TarsWeb [submodule "go"] path = go url = https://github.com/TarsCloud/TarsGo [submodule "docs"] path = docs url = https://github.com/TarsCloud/TarsDocs [submodule "docker"] path = docker url = https://github.com/TarsCloud/TarsDocker.git [submodule "docs_en"] path = docs_en url = https://github.com/TarsCloud/TarsDocs_en ================================================ FILE: Contributing.md ================================================ # Contributing If you contributed but cannot find your ID in the file, please submit PR and add your GitHub ID to **both contributing file under your contributed repo** and [Tars repo](https://github.com/TarsCloud/Tars/pulls). ## Tars ### Committer - ruanshudong - loveyacper - LawlietLi - meijing0114 - medns - dpp2009 - TOKISAKIKURUMI - change93 - helloopenworld - meiping - copyrenzhe - bobzhangyong - wjx82850707 - Spacebody - souldancer - zerolocusta - markshan ### Contributors List - 9chu - Abioy - bartdong - bishaoqing - bobzhangyong - change93 - Cnlouds - copyrenzhe - cygsxak - deepzliu - dolphinxwc - dpp2009 - duoyu119 - ETZhangSX - Fr1ck - ganziqim - guzitajiu - helloopenworld - higithubhi - isabellavieira - jerrylucky - KatharineOzil - kuangxc - lanffy - lanyutc - LawlietLee - LawlietLi - loveyacper - maplebeats - marklightning - mdhender - medns - meijing0114 - meiping - MR-workaholic - munglechina - parchk - qiuxin - ruanshudong - sandyskies - scguoi - serverlessplus - songvy - souldancer - Spacebody - sy-records - tarstest - TCZWJ - TimmyYu - tinkercloud - TOKISAKIKURUMI - wjx82850707 - youngdou - YoungZiyi - yuansx - yukkiball - zehuaiWANG - zerolocusta - BeyondWUXF ## TarsCpp ### Committer - ruanshudong - markshan ### Contributors List - Abioy - jerrylucky - langio - marklightning - ruanshudong - shevqko - Spacebody - TCZWJ - viest - YMChenLiye - zhanleewo - BeyondWUXF ## TarsBenchmark ### Committer - forrestlinfeng - markshan ### Contributor List - forrestlinfeng - wincsb ## plugins - diracccc ## TarsDemo - ruanshudong ## TarsDocker ### Committer - ruanshudong - markshan ### Contributor List - bartdong - Frankie - franklee0817 - ruanshudong - RuizhaoLi ## TarsDocs ### Committer - ruanshudong - KatharineOzil - bartdong - Cnlouds - markshan ### Contributor List - bartdong - Cnlouds - danielzheng-Tencent - jerrylucky - KatharineOzil - meijing0114 - ruanshudong - yukkiball - zouchengzhuo ## TarsFramework ### Committer - ruanshudong - wincsb - markshan ### Contributor List - diracccc - ETZhangSX - jerrylucky - lanhy - MindHook - mygrsun - renyang9876 - ruanshudong - shevqko - wincsb - ypingcn - yuansx - BeyondWUXF ## TarsGo ### Committer - sandyskies - jchalex - chenhengqi - MonkeyLi - tensorchen - rikewang - markshan - lbbniu ### Contributor List - 0xflotus - agchrys - Andrew-M-C - bartdong - BurningXFlame - chenhengqi - Clark-zhang - ClaudeLiang - cokeboL - defool - erjanmx - hooligan520 - hotWing17 - imthx - jchalex - jyuan68 - lanhy - louishlz - marklightning - maplebeats - mdhender - mjaow - MonkeyLi - mountkin - nickwanninger - philippgille - qiuxin - rbarros - rikewang - ruanshudong - sandyskies - skelway - TauWu - tensorchen - terryding77 - wqliang - wzshiming - xiaoxubeii - xuri - YaffaBeauty - YouEclipse - lbbniu - BeyondWUXF ## TarsJava ### Committer - TimmyYu - XenoAmess - diracccc - LawlietLi - markshan ### Contributor List - diracccc - kahn - LawlietLi - LiuMenghan - TimmyYu - walkertest - woodwind - XenoAmess - yukkiball ## TarsPHP ### Committer - meijing0114 - bobzhangyong - copyrenzhe - dpp2009 - markshan ### Contributor List - bobzhangyong - copyrenzhe - cuixg - danielzheng-Tencent - dpp2009 - meijing0114 - wodetian55 - medmin - sy-records ## TarsProtocol ### Committer - ruanshudong - shevqko - markshan ### Contributor List - jerrylucky - ruanshudong - shevqko - hpeiy98 ## TarsWeb ### Committer - ruanshudong - zouchengzhuo - ziyang314 - shevqko - markshan ### Contributor List - airycanon - ETZhangSX - jerrylucky - lanhy - ouliuquan - ruanshudong - sandyskies - shevqko - wjx82850707 - ypingcn - ziyang314 - zouchengzhuo - BeyondWUXF ## TarsJMeter ### Committer - boycs007 - jnlunsb - markshan ### Contributor List - boycs007 - jnlunsb - juliuslu-tencent ## TarsNodeJS ### Committer - medmin - markshan ### Contributor List - medmin ## K8STARS ### Committer - bartdong - defool - markshan ### Contributor List - bartdong - defool - hpeiy98 - KatharineOzil - andyguo1023 ## ArtWork - cheney-ying - heisewuyu16 - Quentin-by ## TarsTools ### Committer - harveyxu-tme - markshan ### Contributor List - harveyxu-tme - hpeiy98 ## TarsGateway ### Committer - shevqko - markshan ### Contributor List - shevqko - ruanshudong - hpeiy98 - wincsb ## TARS_Landscape ### Committer - KatharineOzil - dankohn ### Contributor List - KatharineOzil - dankohn - bartdong - jordinl83 - heisewuyu16 ## TarsprotocolProxy ### Committer - shevqko - eatonzhang - markshan ### Contributor List - shevqko - eatonzhang - markshan - hpeiy98 ================================================ FILE: LICENSE ================================================ BSD 3-Clause License Copyright (c) 2020, THE TARS FOUNDATION All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: PerfTestSoft/Readme.md ================================================ # Table of contents > * [1.Description](#main-chapter-1) > * [2.Framework Environment Setup](#main-chapter-2) > * [3.Server Side Test Software](#main-chapter-3) > * [4.Client Side Test Software](#main-chapter-4) > * [5.Note Well](#main-chapter-5) # 1. Description - This folder is used to store the software for Tars performance Test. - The test software consists of the client software and the server software. - The Tars framework should be set up successfully prior to run the performance test software. # 2. Tars Framework Environment Setup - In order to run the performance test, Tars framework is a must. - You can setup the framework via script or do it step-by-step. - Refer to the following link: - https://github.com/TarsCloud/Tars/tree/master/shellDeploy - https://github.com/TarsCloud/Tars#installation # 3. Server Side Test Software - For the server side, # 4. Client Side Test Software - For the client side, # 5. Note Well - More informations you should pay special attention to. ================================================ FILE: PerfTestSoft/StressBenchmark/README.md ================================================ 该工程是Tars入门示例的代码 目录名称 |功能 -----------------|---------------- TarsStressServer | Tars性能压测服务端的程序 TarsStressClient | Tars性能压测客户端的程序 ================================================ FILE: PerfTestSoft/StressBenchmark/TarsStressClient/Stress.h ================================================ // ********************************************************************** // This file was generated by a TARS parser! // TARS version 1.1.0. // ********************************************************************** #ifndef __STRESS_H_ #define __STRESS_H_ #include #include #include #include "tup/Tars.h" using namespace std; #include "servant/ServantProxy.h" #include "servant/Servant.h" #include "promise/promise.h" namespace Test { /* callback of async proxy for client */ class StressPrxCallback: public tars::ServantProxyCallback { public: virtual ~StressPrxCallback(){} virtual void callback_test(tars::Int32 ret) { throw std::runtime_error("callback_test() override incorrect."); } virtual void callback_test_exception(tars::Int32 ret) { throw std::runtime_error("callback_test_exception() override incorrect."); } virtual void callback_testStr(tars::Int32 ret, const std::string& sOut) { throw std::runtime_error("callback_testStr() override incorrect."); } virtual void callback_testStr_exception(tars::Int32 ret) { throw std::runtime_error("callback_testStr_exception() override incorrect."); } public: virtual const map & getResponseContext() const { CallbackThreadData * pCbtd = CallbackThreadData::getData(); assert(pCbtd != NULL); if(!pCbtd->getContextValid()) { throw TC_Exception("cann't get response context"); } return pCbtd->getResponseContext(); } public: virtual int onDispatch(tars::ReqMessagePtr msg) { static ::std::string __Stress_all[]= { "test", "testStr" }; pair r = equal_range(__Stress_all, __Stress_all+2, string(msg->request.sFuncName)); if(r.first == r.second) return tars::TARSSERVERNOFUNCERR; switch(r.first - __Stress_all) { case 0: { if (msg->response.iRet != tars::TARSSERVERSUCCESS) { callback_test_exception(msg->response.iRet); return msg->response.iRet; } tars::TarsInputStream _is; _is.setBuffer(msg->response.sBuffer); tars::Int32 _ret; _is.read(_ret, 0, true); CallbackThreadData * pCbtd = CallbackThreadData::getData(); assert(pCbtd != NULL); pCbtd->setResponseContext(msg->response.context); callback_test(_ret); pCbtd->delResponseContext(); return tars::TARSSERVERSUCCESS; } case 1: { if (msg->response.iRet != tars::TARSSERVERSUCCESS) { callback_testStr_exception(msg->response.iRet); return msg->response.iRet; } tars::TarsInputStream _is; _is.setBuffer(msg->response.sBuffer); tars::Int32 _ret; _is.read(_ret, 0, true); std::string sOut; _is.read(sOut, 2, true); CallbackThreadData * pCbtd = CallbackThreadData::getData(); assert(pCbtd != NULL); pCbtd->setResponseContext(msg->response.context); callback_testStr(_ret, sOut); pCbtd->delResponseContext(); return tars::TARSSERVERSUCCESS; } } return tars::TARSSERVERNOFUNCERR; } }; typedef tars::TC_AutoPtr StressPrxCallbackPtr; /* callback of promise async proxy for client */ class StressPrxCallbackPromise: public tars::ServantProxyCallback { public: virtual ~StressPrxCallbackPromise(){} public: struct Promisetest: virtual public TC_HandleBase { public: tars::Int32 _ret; map _mRspContext; }; typedef tars::TC_AutoPtr< StressPrxCallbackPromise::Promisetest > PromisetestPtr; StressPrxCallbackPromise(const promise::Promise< StressPrxCallbackPromise::PromisetestPtr > &promise) : _promise_test(promise) {} virtual void callback_test(const StressPrxCallbackPromise::PromisetestPtr &ptr) { _promise_test.setValue(ptr); } virtual void callback_test_exception(tars::Int32 ret) { std::string str(""); str += "Function:test_exception|Ret:"; str += TC_Common::tostr(ret); _promise_test.setException(promise::copyException(str, ret)); } protected: promise::Promise< StressPrxCallbackPromise::PromisetestPtr > _promise_test; public: struct PromisetestStr: virtual public TC_HandleBase { public: tars::Int32 _ret; std::string sOut; map _mRspContext; }; typedef tars::TC_AutoPtr< StressPrxCallbackPromise::PromisetestStr > PromisetestStrPtr; StressPrxCallbackPromise(const promise::Promise< StressPrxCallbackPromise::PromisetestStrPtr > &promise) : _promise_testStr(promise) {} virtual void callback_testStr(const StressPrxCallbackPromise::PromisetestStrPtr &ptr) { _promise_testStr.setValue(ptr); } virtual void callback_testStr_exception(tars::Int32 ret) { std::string str(""); str += "Function:testStr_exception|Ret:"; str += TC_Common::tostr(ret); _promise_testStr.setException(promise::copyException(str, ret)); } protected: promise::Promise< StressPrxCallbackPromise::PromisetestStrPtr > _promise_testStr; public: virtual int onDispatch(tars::ReqMessagePtr msg) { static ::std::string __Stress_all[]= { "test", "testStr" }; pair r = equal_range(__Stress_all, __Stress_all+2, string(msg->request.sFuncName)); if(r.first == r.second) return tars::TARSSERVERNOFUNCERR; switch(r.first - __Stress_all) { case 0: { if (msg->response.iRet != tars::TARSSERVERSUCCESS) { callback_test_exception(msg->response.iRet); return msg->response.iRet; } tars::TarsInputStream _is; _is.setBuffer(msg->response.sBuffer); StressPrxCallbackPromise::PromisetestPtr ptr = new StressPrxCallbackPromise::Promisetest(); try { _is.read(ptr->_ret, 0, true); } catch(std::exception &ex) { callback_test_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } catch(...) { callback_test_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } ptr->_mRspContext = msg->response.context; callback_test(ptr); return tars::TARSSERVERSUCCESS; } case 1: { if (msg->response.iRet != tars::TARSSERVERSUCCESS) { callback_testStr_exception(msg->response.iRet); return msg->response.iRet; } tars::TarsInputStream _is; _is.setBuffer(msg->response.sBuffer); StressPrxCallbackPromise::PromisetestStrPtr ptr = new StressPrxCallbackPromise::PromisetestStr(); try { _is.read(ptr->_ret, 0, true); _is.read(ptr->sOut, 2, true); } catch(std::exception &ex) { callback_testStr_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } catch(...) { callback_testStr_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } ptr->_mRspContext = msg->response.context; callback_testStr(ptr); return tars::TARSSERVERSUCCESS; } } return tars::TARSSERVERNOFUNCERR; } }; typedef tars::TC_AutoPtr StressPrxCallbackPromisePtr; /* callback of coroutine async proxy for client */ class StressCoroPrxCallback: public StressPrxCallback { public: virtual ~StressCoroPrxCallback(){} public: virtual const map & getResponseContext() const { return _mRspContext; } virtual void setResponseContext(const map &mContext) { _mRspContext = mContext; } public: int onDispatch(tars::ReqMessagePtr msg) { static ::std::string __Stress_all[]= { "test", "testStr" }; pair r = equal_range(__Stress_all, __Stress_all+2, string(msg->request.sFuncName)); if(r.first == r.second) return tars::TARSSERVERNOFUNCERR; switch(r.first - __Stress_all) { case 0: { if (msg->response.iRet != tars::TARSSERVERSUCCESS) { callback_test_exception(msg->response.iRet); return msg->response.iRet; } tars::TarsInputStream _is; _is.setBuffer(msg->response.sBuffer); try { tars::Int32 _ret; _is.read(_ret, 0, true); setResponseContext(msg->response.context); callback_test(_ret); } catch(std::exception &ex) { callback_test_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } catch(...) { callback_test_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } return tars::TARSSERVERSUCCESS; } case 1: { if (msg->response.iRet != tars::TARSSERVERSUCCESS) { callback_testStr_exception(msg->response.iRet); return msg->response.iRet; } tars::TarsInputStream _is; _is.setBuffer(msg->response.sBuffer); try { tars::Int32 _ret; _is.read(_ret, 0, true); std::string sOut; _is.read(sOut, 2, true); setResponseContext(msg->response.context); callback_testStr(_ret, sOut); } catch(std::exception &ex) { callback_testStr_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } catch(...) { callback_testStr_exception(tars::TARSCLIENTDECODEERR); return tars::TARSCLIENTDECODEERR; } return tars::TARSSERVERSUCCESS; } } return tars::TARSSERVERNOFUNCERR; } protected: map _mRspContext; }; typedef tars::TC_AutoPtr StressCoroPrxCallbackPtr; /* proxy for client */ class StressProxy : public tars::ServantProxy { public: typedef map TARS_CONTEXT; tars::Int32 test(const map &context = TARS_CONTEXT(),map * pResponseContext = NULL) { tars::TarsOutputStream _os; tars::ResponsePacket rep; std::map _mStatus; tars_invoke(tars::TARSNORMAL,"test", _os.getByteBuffer(), context, _mStatus, rep); if(pResponseContext) { *pResponseContext = rep.context; } tars::TarsInputStream _is; _is.setBuffer(rep.sBuffer); tars::Int32 _ret; _is.read(_ret, 0, true); return _ret; } void async_test(StressPrxCallbackPtr callback,const map& context = TARS_CONTEXT()) { tars::TarsOutputStream _os; std::map _mStatus; tars_invoke_async(tars::TARSNORMAL,"test", _os.getByteBuffer(), context, _mStatus, callback); } promise::Future< StressPrxCallbackPromise::PromisetestPtr > promise_async_test(const map& context) { promise::Promise< StressPrxCallbackPromise::PromisetestPtr > promise; StressPrxCallbackPromisePtr callback = new StressPrxCallbackPromise(promise); tars::TarsOutputStream _os; std::map _mStatus; tars_invoke_async(tars::TARSNORMAL,"test", _os.getByteBuffer(), context, _mStatus, callback); return promise.getFuture(); } void coro_test(StressCoroPrxCallbackPtr callback,const map& context = TARS_CONTEXT()) { tars::TarsOutputStream _os; std::map _mStatus; tars_invoke_async(tars::TARSNORMAL,"test", _os.getByteBuffer(), context, _mStatus, callback, true); } tars::Int32 testStr(const std::string & sIn,std::string &sOut,const map &context = TARS_CONTEXT(),map * pResponseContext = NULL) { tars::TarsOutputStream _os; _os.write(sIn, 1); _os.write(sOut, 2); tars::ResponsePacket rep; std::map _mStatus; tars_invoke(tars::TARSNORMAL,"testStr", _os.getByteBuffer(), context, _mStatus, rep); if(pResponseContext) { *pResponseContext = rep.context; } tars::TarsInputStream _is; _is.setBuffer(rep.sBuffer); tars::Int32 _ret; _is.read(_ret, 0, true); _is.read(sOut, 2, true); return _ret; } void async_testStr(StressPrxCallbackPtr callback,const std::string &sIn,const map& context = TARS_CONTEXT()) { tars::TarsOutputStream _os; _os.write(sIn, 1); std::map _mStatus; tars_invoke_async(tars::TARSNORMAL,"testStr", _os.getByteBuffer(), context, _mStatus, callback); } promise::Future< StressPrxCallbackPromise::PromisetestStrPtr > promise_async_testStr(const std::string &sIn,const map& context) { promise::Promise< StressPrxCallbackPromise::PromisetestStrPtr > promise; StressPrxCallbackPromisePtr callback = new StressPrxCallbackPromise(promise); tars::TarsOutputStream _os; _os.write(sIn, 1); std::map _mStatus; tars_invoke_async(tars::TARSNORMAL,"testStr", _os.getByteBuffer(), context, _mStatus, callback); return promise.getFuture(); } void coro_testStr(StressCoroPrxCallbackPtr callback,const std::string &sIn,const map& context = TARS_CONTEXT()) { tars::TarsOutputStream _os; _os.write(sIn, 1); std::map _mStatus; tars_invoke_async(tars::TARSNORMAL,"testStr", _os.getByteBuffer(), context, _mStatus, callback, true); } StressProxy* tars_hash(int64_t key) { return (StressProxy*)ServantProxy::tars_hash(key); } StressProxy* tars_consistent_hash(int64_t key) { return (StressProxy*)ServantProxy::tars_consistent_hash(key); } StressProxy* tars_set_timeout(int msecond) { return (StressProxy*)ServantProxy::tars_set_timeout(msecond); } }; typedef tars::TC_AutoPtr StressPrx; /* servant for server */ class Stress : public tars::Servant { public: virtual ~Stress(){} virtual tars::Int32 test(tars::TarsCurrentPtr current) = 0; static void async_response_test(tars::TarsCurrentPtr current, tars::Int32 _ret) { if (current->getRequestVersion() == TUPVERSION ) { UniAttribute tarsAttr; tarsAttr.setVersion(current->getRequestVersion()); tarsAttr.put("", _ret); vector sTupResponseBuffer; tarsAttr.encode(sTupResponseBuffer); current->sendResponse(tars::TARSSERVERSUCCESS, sTupResponseBuffer); } else { tars::TarsOutputStream _os; _os.write(_ret, 0); current->sendResponse(tars::TARSSERVERSUCCESS, _os.getByteBuffer()); } } virtual tars::Int32 testStr(const std::string & sIn,std::string &sOut,tars::TarsCurrentPtr current) = 0; static void async_response_testStr(tars::TarsCurrentPtr current, tars::Int32 _ret, const std::string &sOut) { if (current->getRequestVersion() == TUPVERSION ) { UniAttribute tarsAttr; tarsAttr.setVersion(current->getRequestVersion()); tarsAttr.put("", _ret); tarsAttr.put("sOut", sOut); vector sTupResponseBuffer; tarsAttr.encode(sTupResponseBuffer); current->sendResponse(tars::TARSSERVERSUCCESS, sTupResponseBuffer); } else { tars::TarsOutputStream _os; _os.write(_ret, 0); _os.write(sOut, 2); current->sendResponse(tars::TARSSERVERSUCCESS, _os.getByteBuffer()); } } public: int onDispatch(tars::TarsCurrentPtr _current, vector &_sResponseBuffer) { static ::std::string __Test__Stress_all[]= { "test", "testStr" }; pair r = equal_range(__Test__Stress_all, __Test__Stress_all+2, _current->getFuncName()); if(r.first == r.second) return tars::TARSSERVERNOFUNCERR; switch(r.first - __Test__Stress_all) { case 0: { tars::TarsInputStream _is; _is.setBuffer(_current->getRequestBuffer()); if (_current->getRequestVersion() == TUPVERSION) { UniAttribute tarsAttr; tarsAttr.setVersion(_current->getRequestVersion()); tarsAttr.decode(_current->getRequestBuffer()); } else { } tars::Int32 _ret = test(_current); if(_current->isResponse()) { if (_current->getRequestVersion() == TUPVERSION ) { UniAttribute tarsAttr; tarsAttr.setVersion(_current->getRequestVersion()); tarsAttr.put("", _ret); tarsAttr.encode(_sResponseBuffer); } else { tars::TarsOutputStream _os; _os.write(_ret, 0); _os.swap(_sResponseBuffer); } } return tars::TARSSERVERSUCCESS; } case 1: { tars::TarsInputStream _is; _is.setBuffer(_current->getRequestBuffer()); std::string sIn; std::string sOut; if (_current->getRequestVersion() == TUPVERSION) { UniAttribute tarsAttr; tarsAttr.setVersion(_current->getRequestVersion()); tarsAttr.decode(_current->getRequestBuffer()); tarsAttr.get("sIn", sIn); tarsAttr.getByDefault("sOut", sOut, sOut); } else { _is.read(sIn, 1, true); _is.read(sOut, 2, false); } tars::Int32 _ret = testStr(sIn,sOut, _current); if(_current->isResponse()) { if (_current->getRequestVersion() == TUPVERSION ) { UniAttribute tarsAttr; tarsAttr.setVersion(_current->getRequestVersion()); tarsAttr.put("", _ret); tarsAttr.put("sOut", sOut); tarsAttr.encode(_sResponseBuffer); } else { tars::TarsOutputStream _os; _os.write(_ret, 0); _os.write(sOut, 2); _os.swap(_sResponseBuffer); } } return tars::TARSSERVERSUCCESS; } } return tars::TARSSERVERNOFUNCERR; } }; } #endif ================================================ FILE: PerfTestSoft/StressBenchmark/TarsStressClient/main.cpp ================================================ /** * Tencent is pleased to support the open source community by making Tars available. * * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. * * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ #include "Stress.h" #include "servant/Communicator.h" #include "util/tc_thread_pool.h" #include using namespace std; using namespace Test; using namespace tars; class Test1 { public: Test1(const string &sStr,const string &netthreads); Test1(){} ~Test1(); void dohandle(int excut_num,int size); private: Communicator _comm; StressPrx prx; }; Test1::Test1(const string &sStr, const string &netthreads) { _comm.setProperty("locator","tars.tarsregistry.QueryObj@tcp -h 192.168.1.100 -p 17890 -t 10000"); _comm.setProperty("stat", "tars.tarsstat.StatObj"); _comm.setProperty("netthread",netthreads); _comm.stringToProxy(sStr, prx); } Test1::~Test1() { } void Test1::dohandle(int excut_num,int size) { string s(size,'a'); tars::Int32 count = 0; unsigned long sum = 0; //time_t _iTime=TC_TimeProvider::getInstance()->getNowMs(); for(int i=0; itars_set_timeout(15000)->testStr(s,ret); if(ret.size() == s.size()) { ++sum; ++count; } if(count == excut_num) { //cout << "pthread id: " << pthread_self() << " | " << TC_TimeProvider::getInstance()->getNowMs() - _iTime << endl; count = 0; } } catch(TC_Exception &e) { cout << "pthread id: " << pthread_self() << "id: " << i << "exception: " << e.what() << endl; } catch(...) { cout << "pthread id: " << pthread_self() << "id: " << i << "unknown exception." << endl; } } cout << "succ:" << sum <(string(argv[1])); TC_ThreadPool tp; tp.init(threads); tp.start(); cout << "init tp succ" << endl; tars::Int32 times = TC_Common::strto(string(argv[2])); tars::Int32 size = TC_Common::strto(string(argv[3])); cout << "times:" << times << endl; time_t _iTime=TC_TimeProvider::getInstance()->getNowMs(); for(int i = 0; igetNowMs() - _iTime << endl; } catch(exception &e) { cout<getNowMs()-_time<getNowMs(); _num=0; } return 0; } ================================================ FILE: PerfTestSoft/StressBenchmark/TarsStressServer/StressImp.h ================================================ /** * Tencent is pleased to support the open source community by making Tars available. * * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. * * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ #ifndef _StressImp_H_ #define _StressImp_H_ #include "servant/Application.h" #include "Stress.h" #include #define gettid() syscall(__NR_gettid) /** * * */ class StressImp : public Test::Stress { public: /** * */ virtual ~StressImp() {} /** * */ virtual void initialize(); /** * */ virtual void destroy(); /** * */ virtual int test(tars::TarsCurrentPtr current); tars::Int32 testStr(const std::string& sIn, std::string &sOut, tars::TarsCurrentPtr current); private: int _num; int64_t _time; }; ///////////////////////////////////////////////////// #endif ================================================ FILE: PerfTestSoft/StressBenchmark/TarsStressServer/TarsStressServer.cpp ================================================ /** * Tencent is pleased to support the open source community by making Tars available. * * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. * * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ #include "TarsStressServer.h" #include "StressImp.h" using namespace std; TarsStressServer g_app; ///////////////////////////////////////////////////////////////// void TarsStressServer::initialize() { //initialize application here: //... addServant(ServerConfig::Application + "." + ServerConfig::ServerName + ".StressObj"); } ///////////////////////////////////////////////////////////////// void TarsStressServer::destroyApp() { //destroy application here: //... } ///////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { try { g_app.main(argc, argv); g_app.waitForShutdown(); } catch (std::exception& e) { cerr << "std::exception:" << e.what() << std::endl; } catch (...) { cerr << "unknown exception." << std::endl; } return -1; } ///////////////////////////////////////////////////////////////// ================================================ FILE: PerfTestSoft/StressBenchmark/TarsStressServer/TarsStressServer.h ================================================ /** * Tencent is pleased to support the open source community by making Tars available. * * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. * * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ #ifndef _TarsStressServer_H_ #define _TarsStressServer_H_ #include #include "servant/Application.h" using namespace tars; /** * **/ class TarsStressServer : public Application { public: /** * **/ virtual ~TarsStressServer() {}; /** * **/ virtual void initialize(); /** * **/ virtual void destroyApp(); protected: }; extern TarsStressServer g_app; //////////////////////////////////////////// #endif ================================================ FILE: PerfTestSoft/StressBenchmark/TarsStressServer/makefile ================================================ #----------------------------------------------------------------------- APP := Test TARGET := TarsStressServer CONFIG := STRIP_FLAG:= N TARS2CPP_FLAG:= INCLUDE += LIB += #----------------------------------------------------------------------- include /usr/local/tars/cpp/makefile/makefile.tars #----------------------------------------------------------------------- ================================================ FILE: PerfTestSoft/introduction.md ================================================ # Table of contents > * [1.Description](#main-chapter-1) > * [2.Framework Environment Setup](#main-chapter-2) > * [3.Server Side Test Software](#main-chapter-3) > * [4.Client Side Test Software](#main-chapter-4) > * [5.Note Well](#main-chapter-5) # 1. Description - This folder is used to store the software for Tars performance Test. - The test software consists of the client software and the server software. - The Tars framework should be set up successfully prior to run the performance test software. # 2. Tars Framework Environment Setup - In order to run the performance test, Tars framework is a must. - You can setup the framework via script or do it step-by-step. - Refer to the following link: - https://github.com/TarsCloud/Tars/tree/master/shellDeploy - https://github.com/TarsCloud/Tars#installation # 3. Server Side Test Software - For the server side, # 4. Client Side Test Software - For the client side, # 5. Note Well - More informations you should pay special attention to. ================================================ FILE: README.md ================================================ # TARS - A Linux Foundation Project - [TARS Foundation Official Website](https://tarscloud.org/foundation/index) - [TARS Project Official Website](http://tarscloud.org/) - WeChat Offical Account: TarsCloud - QQ Group: 733605310, 579079160(Full), 669339903(Full) - Twitter: [@TarsCloud](https://twitter.com/TarsCloud) - [Mailing List](https://groups.google.com/g/tars-foundation-information) - [Contacts](https://tarscloud.org/about/contacts) ## What is TARS? TARS is a Linux Foundation project. It is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule. Tars, aka TAF(Total Application Framework), has been used in Tencent since 2008. It supports C++, Java, Nodejs and PHP for now. This framework offers a set of solution for development, maintenance and testing, which making development, deployment and testing service efficiently. It integrated extensible protocol for encoding/decoding, high-performance RPC communication framework, name service, monitor, statistics and configuration. You can use it to develop your reliable distributed application based on microservice fast, and reach fully efficient service management. Nowadays it's used by hundreds of bussiness in Tencent, services that developed base on TAF run on 16 thousands of machines. See the detailed introduction [SUMMARY.md](https://tarscloud.github.io/TarsDocs_en/). ## Supported platforms For now it supports OS as below: - Linux - Mac(>=2.1.0 support) - Windows (>= Windows 7) ## Supported languages For now it supports following languages: - C++ - Java - Nodejs - PHP - Go ## Version Management Tars is composed of many modules, scattered in many warehouses, and the basic framework version and language version can develop independently. In view of this, from version 2.1.0, the Framework version tag is printed on the tarsframework warehouse, no longer reflected in the tars warehouse In addition, each component will have its own version. When there is a version dependency specification, each component will have its own version ## Installation 1. If you are new to Tars, please read documentation [installation](https://tarscloud.github.io/TarsDocs_en/installation). 2. First deploy, please read documentation [source](https://tarscloud.github.io/TarsDocs_en/installation/source.html). 3. Install by docker, detail information: [docker](https://tarscloud.github.io/TarsDocs_en/installation/docker.html)。 ## Submodule Directory |Features ------------------|---------------- framework |Source code implementation of C++ language framework basic service cpp |C++ language framework rpc source code implementation java |java language framework rpc source code implementation go |go language framework rpc source code implementation nodejs |nodejs language framework rpc source code implementation php |php language framework rpc source code implementation tup |source code implementation of tup group protocol in each language web |manage tars web source implementation ## Developer's documentation See [docs](https://github.com/TarsCloud/TarsDocs_en). ## License The open-source protocol Tars used is BSD-3-Clause, see [LICENSE.md](https://github.com/TarsCloud/TarsDocs_en/blob/master/LICENSE). ## Chinese Version [Read Chinese Version](README.zh.md) ================================================ FILE: README.zh.md ================================================ [Click me switch to English version](README.md) # Readme.md # Tars - Twitter: [@TarsCloud](https://twitter.com/TarsCloud) - [Mailing List](https://groups.google.com/g/tars-foundation-information) - [官网](http://tarscloud.org/) - [新闻](https://tarscloud.org/feed/newsroom) - qq技术交流群群:733605310, 579079160(满), 669339903(满) - 微信公众号: TarsCloud - [更多联系方式请点击](https://tarscloud.org/about/contacts) ## 简介 Tars这个名字取自于电影"星际穿越"中的机器人,它是基于名字服务使用Tars协议的高性能RPC开发框架,配套一体化的运营管理平台,并通过伸缩调度,实现运维半托管服务。 Tars是腾讯从2008年到今天一直在使用的后台逻辑层的统一应用框架TAF(Total Application Framework),目前支持C++,Java,PHP,Nodejs,Go语言。该框架为用户提供了涉及到开发、运维、以及测试的一整套解决方案,帮助一个产品或者服务快速开发、部署、测试、上线。 它集可扩展协议编解码、高性能RPC通信框架、名字路由与发现、发布监控、日志统计、配置管理等于一体,通过它可以快速用微服务的方式构建自己的稳定可靠的分布式应用,并实现完整有效的服务治理。 目前该框架在腾讯内部,各大核心业务都在使用,颇受欢迎,基于该框架部署运行的服务节点规模达到上万个。 Tars详细介绍参见 [目录](https://tarscloud.github.io/TarsDocs/SUMMARY.html)。 ## 安装 1. 如果你是新手安装Tars, 请务必阅读部署的整体的说明 [installation](https://tarscloud.github.io/TarsDocs/installation) 2. 如果你是第一次部署, 建议采用源码部署熟悉系统 [source](https://tarscloud.github.io/TarsDocs/installation/source.html) 3. 如果你比较熟悉, 可以采用docker部署 [docker](https://tarscloud.github.io/TarsDocs/installation/docker.html) ### 支持平台 目前运行的操作系统平台如下: * Linux * Mac(>=2.1.0 support) ### 支持语言 目前支持的开发语言如下: * C++ * Java * Nodejs * PHP * Go ### 版本管理 Tars由多种模块组成, 分散在多个仓库中, 并且基础框架版本和语言版本可以独立发展, 鉴于此, 从2.1.0版本开始, 框架的版本TAG打在TarsFramework仓库上, 不再体现在Tars这个仓库上. 另外各个组件会有自己独立的版本, 当有版本依赖说明时, 各组件会独立说明. ### License Tars的开源协议为BSD-3-Clause,详情参见 [LICENSE](https://github.com/TarsCloud/TarsDocs/blob/master/LICENSE)。 ### 参与贡献 如果你有任何想法,别犹豫,立即提 Issues 或 Pull Requests,欢迎所有人参与到 TARS 的开源建设中。 提PR前请先确认签署了 [CLA](https://tarscloud.github.io/TarsDocs/cla.html) 哦。 ================================================ FILE: tag.sh ================================================ # Copyright (c) 2020 # Linux Foundation Projects # Link: https://www.linuxfoundation.org/projects/ # TARS Foundation Projects # Link: https://github.com/TarsCloud # All rights reserved. #!/bin/bash #update & merge code tools function show() { branch=$1 echo "tars:"; git branch -a | grep "*"; cd framework; echo "framework:"; git branch -a | grep "*"; cd tarscpp; echo "tarscpp:"; git branch -a | grep "*"; cd servant/protocol; echo "protocol:"; git branch -a | grep "*"; cd ../../../.. } function update() { branch=$1 git submodule update --remote --recursive cd framework; git checkout $branch; git pull --rebase; cd tarscpp; git checkout $branch; git pull --rebase; cd servant/protocol; git checkout $branch; git pull --rebase; cd ../../../.. } function merge() { version1=$1 version2=$2 cd framework; git checkout $version2; git pull $version2 --rebase; git checkout $version1; git merge $version2; cd tarscpp; git checkout $version2; git pull $version2 --rebase; git checkout $version1; git merge $version2; cd servant/protocol; git checkout $version2; git pull $version2 --rebase; git checkout $version1; git merge $version2; cd ../../../.. } function branch() { version1=$1 cd framework/tarscpp/servant/protocol; git checkout $version1; cd ../..; git checkout $version1; cd ..; git checkout $version1; cd ..; git checkout $version1; } function commit() { version1=$1 cd framework/tarscpp/servant/protocol; git checkout $version1; git commit -a -m "update merge"; cd ../..; git checkout $version1; git commit -a -m "update protocol"; cd ..; git checkout $version1; git commit -a -m "update tarscpp"; cd ..; git checkout $version1; git commit -a -m "update framework"; } function push() { version1=$1 cd framework; git checkout $version1; git push origin $version1; cd tarscpp; git checkout $version1; git push origin $version1; cd servant/protocol; git checkout $version1; git push origin $version1; cd ../../../..;git checkout $version1; git push origin $version1; } version=$2 case $1 in "show") show ;; "branch") branch $2 show ;; "update") update $2 ;; "commit") commit $2 ;; "push") push $2 ;; "merge-master") merge master release/2.4 ;; "merge-release") merge release/2.4 master ;; "all") show update release/2.4 merge-release commit release/2.4 push release/2.4 update master merge-master commit master push master ;; *) echo "$0 show, show all branch" echo "$0 branch [branch], checkout to branch" echo "$0 update [branch], update branch to new" echo "$0 commit [branch], commit branch" echo "$0 push [branch], push branch" echo "$0 merge-master], checkout master and merge release to master" echo "$0 merge-release], checkout relase and merge master to release" echo "$0 all, do all" ;; esac ================================================ FILE: tars-deploy-framework.sh ================================================ #!/bin/bash if (( $# < 2 )) then echo $# echo "$0 tag push(false/true)" exit 1 fi tag=$1 push=$2 if [ "$push" == "true" ]; then push="true" else push="false" fi # tarsTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) # cd framework && frameworkTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd .. # cd web && webTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd .. tarsTag=$tag cd framework && frameworkTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd .. cd web && webTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd .. echo "starting tars:${tarsTag} framework:$frameworkTag web:$webTag deploy" cd docker/framework ./build-docker.sh $frameworkTag $webTag ${tarsTag} ${push} ================================================ FILE: tars-deploy-tars.sh ================================================ #!/bin/bash if (( $# < 2 )) then echo $# echo "$0 tag push(false/true)" exit 1 fi tag=$1 push=$2 if [ "$push" == "true" ]; then push="true" else push="false" fi # tarsTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) # cd framework && frameworkTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd .. # cd web && webTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd .. tarsTag=$tag cd framework && frameworkTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd .. cd web && webTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd .. echo "starting tars:${tarsTag} framework:$frameworkTag web:$webTag deploy" cd docker/tars ./build-docker.sh $frameworkTag $webTag ${tarsTag} ${push} ================================================ FILE: tars-latest-deploy-framework.sh ================================================ #!/bin/bash if (( $# < 1 )) then echo $# echo "$0 push(false/true)" exit 1 fi push=$1 if [ "$push" == "true" ]; then push="true" else push="false" fi cd docker/framework ./build-docker.sh master master latest ${push} ================================================ FILE: tars-latest-deploy-tars.sh ================================================ #!/bin/bash if (( $# < 1 )) then echo $# echo "$0 push(false/true)" exit 1 fi push=$1 if [ "$push" == "true" ]; then push="true" else push="false" fi cd docker/tars ./build-docker.sh master master latest ${push}