diff --git a/.gitignore b/.gitignore index 0061e51b..3c8fb092 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ Makefile /www/fav_*.png generated /errors.log +*.deb +/install_manifest.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d421ca5..632859a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,18 @@ add_subdirectory (src/brokers/poloniex) add_subdirectory (src/brokers/simplefx) add_subdirectory (src/brokers/trainer) - -install(DIRECTORY conf DESTINATION ".") -install(DIRECTORY www DESTINATION ".") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/opt/mmbot" CACHE PATH "Default path to install" FORCE) +endif() + +install(PROGRAMS bin/mmbot DESTINATION bin) +install(DIRECTORY bin/brokers DESTINATION bin USE_SOURCE_PERMISSIONS) +install(FILES conf/mmbot.conf conf/brokers.conf DESTINATION "conf") +install(FILES conf/mmbot.pkg.conf DESTINATION "conf" RENAME "local.conf") +install(FILES www/index.html www/manifest.json www/sw.js DESTINATION "www") +install(DIRECTORY www/admin DESTINATION "www") +install(DIRECTORY www/res DESTINATION "www") install(DIRECTORY DESTINATION "data") +install(DIRECTORY DESTINATION "secure_data") +install(DIRECTORY DESTINATION "run") install(DIRECTORY DESTINATION "log") diff --git a/conf/mmbot.conf b/conf/mmbot.conf index 36fad425..4bf2a92a 100644 --- a/conf/mmbot.conf +++ b/conf/mmbot.conf @@ -108,3 +108,4 @@ sliding_zero_reverse=0.9 @include brokers.conf + diff --git a/conf/mmbot.pkg.conf b/conf/mmbot.pkg.conf new file mode 100644 index 00000000..05784241 --- /dev/null +++ b/conf/mmbot.pkg.conf @@ -0,0 +1,6 @@ +@include mmbot.conf + +[service] +listen=localhost:11223 + + diff --git a/deb_build b/deb_build new file mode 100755 index 00000000..90f6b8b3 --- /dev/null +++ b/deb_build @@ -0,0 +1,3 @@ +#!/bin/bash +dpkg-buildpackage -b --no-sign -nc +mv ../*.deb ./ \ No newline at end of file diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 00000000..3d501145 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,8 @@ +/mmbot/ +/.debhelper +/debian/ +files +*.debhelper +*.substvars +substvars +/debhelper-build-stamp diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..a9f01bae --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +mmbot (2:20.9) unstable; urgency=medium + + * Final release debian package + + -- Ondra Novak Wed, 23 Sep 2020 20:03:00 +0200 + +mmbot (1.0.0) unstable; urgency=medium + + * Initial Release. + + -- Ondra Novak Wed, 23 Sep 2020 11:22:33 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..9d607966 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git a/debian/conffiles b/debian/conffiles new file mode 100644 index 00000000..f3f873a9 --- /dev/null +++ b/debian/conffiles @@ -0,0 +1,3 @@ +/opt/mmbot/conf/brokers.conf +/opt/mmbot/conf/mmbot.conf +/opt/mmbot/conf/local.conf diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..7d66583f --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: mmbot +Section: unbound +Priority: optional +Maintainer: Ondrej Novak +Standards-Version: 4.4.1 +Homepage: https://github.com/ondra-novak/mmbot + +Package: mmbot +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: mmbot - market making trading bot + After installation, open a browser at: + http://localhost:11223/ + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..ce3b18b6 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: mmbot +Upstream-Contact: nov.ondrej@gmail.com +Source: https://github.com/ondra-novak/mmbot + +Files: * +Copyright: 2020 Ondrej Novak +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/debian/mmbot.install b/debian/mmbot.install new file mode 100644 index 00000000..e2325c6b --- /dev/null +++ b/debian/mmbot.install @@ -0,0 +1,2 @@ +debian/conffiles DEBIAN + diff --git a/debian/mmbot.postinst b/debian/mmbot.postinst new file mode 100644 index 00000000..86755eb2 --- /dev/null +++ b/debian/mmbot.postinst @@ -0,0 +1,27 @@ +#!/bin/sh + +set -e + + +case "$1" in + configure) + adduser --system --no-create-home mmbot + chown -R mmbot /opt/mmbot + echo "Configuration interface is available at url: http://localhost:11223/ (if not changed)" + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/mmbot.service b/debian/mmbot.service new file mode 100644 index 00000000..8f413a2e --- /dev/null +++ b/debian/mmbot.service @@ -0,0 +1,16 @@ +[Unit] +Description=MMBot +After=network-online.target + +[Service] +Type=simple +User=mmbot +ExecStart=/opt/mmbot/bin/mmbot -f /opt/mmbot/conf/local.conf run +ExecStop=/opt/mmbot/bin/mmbot -f /opt/mmbot/conf/local.conf stop +RemainAfterExit=no +Restart=on-abnormal +RestartSec=1s + + +[Install] +WantedBy=multi-user.target diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..d8c72080 --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f + + +%: + dh $@ + +override_dh_auto_configure: + echo disabled +override_dh_auto_build: + ./build nodialog +override_dh_strip: + echo no_strip + \ No newline at end of file diff --git a/src/brokers/binance/CMakeLists.txt b/src/brokers/binance/CMakeLists.txt index 745e44f1..2ced9898 100644 --- a/src/brokers/binance/CMakeLists.txt +++ b/src/brokers/binance/CMakeLists.txt @@ -6,4 +6,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (binance main.cpp proxy.cpp ) target_link_libraries (binance LINK_PUBLIC brokers_common simpleServer imtjson ) -install(TARGETS binance DESTINATION "bin/brokers") diff --git a/src/brokers/bitfinex/CMakeLists.txt b/src/brokers/bitfinex/CMakeLists.txt index 391c1d44..62d12de9 100644 --- a/src/brokers/bitfinex/CMakeLists.txt +++ b/src/brokers/bitfinex/CMakeLists.txt @@ -9,4 +9,3 @@ add_executable (bitfinex main.cpp structs.cpp ) target_link_libraries (bitfinex LINK_PUBLIC brokers_common simpleServer imtjson ) -install(TARGETS bitfinex DESTINATION "bin/brokers") diff --git a/src/brokers/bitmex/CMakeLists.txt b/src/brokers/bitmex/CMakeLists.txt index 659e5b71..7f72495e 100644 --- a/src/brokers/bitmex/CMakeLists.txt +++ b/src/brokers/bitmex/CMakeLists.txt @@ -6,4 +6,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (bitmex main.cpp proxy.cpp ) target_link_libraries (bitmex LINK_PUBLIC brokers_common simpleServer imtjson) -install(TARGETS bitmex DESTINATION "bin/brokers") diff --git a/src/brokers/coinbase/CMakeLists.txt b/src/brokers/coinbase/CMakeLists.txt index c8b11433..8b3093f7 100644 --- a/src/brokers/coinbase/CMakeLists.txt +++ b/src/brokers/coinbase/CMakeLists.txt @@ -7,4 +7,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (coinbase main.cpp ) target_link_libraries (coinbase LINK_PUBLIC brokers_common simpleServer imtjson) -install(TARGETS coinbase DESTINATION "bin/brokers") diff --git a/src/brokers/coingi/CMakeLists.txt b/src/brokers/coingi/CMakeLists.txt index b596e051..954a8b73 100644 --- a/src/brokers/coingi/CMakeLists.txt +++ b/src/brokers/coingi/CMakeLists.txt @@ -7,4 +7,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (coingi main.cpp ) target_link_libraries (coingi LINK_PUBLIC brokers_common simpleServer imtjson) -install(TARGETS coingi DESTINATION "bin/brokers") diff --git a/src/brokers/coinmate/CMakeLists.txt b/src/brokers/coinmate/CMakeLists.txt index 08ced8ff..eb8bcf90 100644 --- a/src/brokers/coinmate/CMakeLists.txt +++ b/src/brokers/coinmate/CMakeLists.txt @@ -7,4 +7,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (coinmate main.cpp proxy.cpp ) target_link_libraries (coinmate LINK_PUBLIC brokers_common simpleServer imtjson) -install(TARGETS coinmate DESTINATION "bin/brokers") diff --git a/src/brokers/deribit/CMakeLists.txt b/src/brokers/deribit/CMakeLists.txt index c1cbf6a4..7e6f4bbd 100644 --- a/src/brokers/deribit/CMakeLists.txt +++ b/src/brokers/deribit/CMakeLists.txt @@ -6,4 +6,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (deribit main.cpp proxy.cpp ) target_link_libraries (deribit LINK_PUBLIC brokers_common simpleServer imtjson ) -install(TARGETS deribit DESTINATION "bin/brokers") diff --git a/src/brokers/ftx/CMakeLists.txt b/src/brokers/ftx/CMakeLists.txt index aa4e301d..95e90cc8 100644 --- a/src/brokers/ftx/CMakeLists.txt +++ b/src/brokers/ftx/CMakeLists.txt @@ -8,4 +8,3 @@ add_executable (ftx main.cpp interface.cpp ) target_link_libraries (ftx LINK_PUBLIC brokers_common simpleServer imtjson ) -install(TARGETS ftx DESTINATION "bin/brokers") diff --git a/src/brokers/kraken/CMakeLists.txt b/src/brokers/kraken/CMakeLists.txt index 570253e2..4ce4049d 100644 --- a/src/brokers/kraken/CMakeLists.txt +++ b/src/brokers/kraken/CMakeLists.txt @@ -9,4 +9,3 @@ add_executable (kraken main.cpp ) target_link_libraries (kraken LINK_PUBLIC brokers_common simpleServer imtjson ) -install(TARGETS kraken DESTINATION "bin/brokers") diff --git a/src/brokers/poloniex/CMakeLists.txt b/src/brokers/poloniex/CMakeLists.txt index 1e0c46db..be9da95e 100644 --- a/src/brokers/poloniex/CMakeLists.txt +++ b/src/brokers/poloniex/CMakeLists.txt @@ -6,4 +6,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (poloniex main.cpp proxy.cpp ) target_link_libraries (poloniex LINK_PUBLIC brokers_common simpleServer imtjson ) -install(TARGETS poloniex DESTINATION "bin/brokers") diff --git a/src/brokers/simplefx/CMakeLists.txt b/src/brokers/simplefx/CMakeLists.txt index a7737852..15c961aa 100644 --- a/src/brokers/simplefx/CMakeLists.txt +++ b/src/brokers/simplefx/CMakeLists.txt @@ -13,4 +13,3 @@ add_executable (simplefx ) target_link_libraries (simplefx LINK_PUBLIC brokers_common simpleServer imtjson) -install(TARGETS simplefx DESTINATION "bin/simplefx") diff --git a/src/brokers/trainer/CMakeLists.txt b/src/brokers/trainer/CMakeLists.txt index 2ff5cb19..be331be2 100644 --- a/src/brokers/trainer/CMakeLists.txt +++ b/src/brokers/trainer/CMakeLists.txt @@ -8,4 +8,3 @@ add_custom_command(OUTPUT generated/index.html.cpp COMMAND ./txt2cpp.sh index.ht add_executable (trainer main.cpp ../bitfinex/structs.cpp generated/index.html.cpp) target_link_libraries (trainer LINK_PUBLIC brokers_common imtjson simpleServer) -install(TARGETS trainer DESTINATION "bin/trainer") diff --git a/src/imtjson b/src/imtjson index b1354782..88e1b9dc 160000 --- a/src/imtjson +++ b/src/imtjson @@ -1 +1 @@ -Subproject commit b1354782d7ff6a73a9168bb74371ba8f470961d6 +Subproject commit 88e1b9dc3a8b3fbc9b5179f8855055b3a45aaf3a diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 729f1acb..3dbf8072 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -30,4 +30,3 @@ add_executable (mmbot swap_broker.cpp ) target_link_libraries (mmbot LINK_PUBLIC simpleServer imtjson ) -install(TARGETS mmbot DESTINATION "bin") diff --git a/src/report_broker/CMakeLists.txt b/src/report_broker/CMakeLists.txt index 2bf2d0ca..efd12272 100644 --- a/src/report_broker/CMakeLists.txt +++ b/src/report_broker/CMakeLists.txt @@ -6,4 +6,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (report_broker main.cpp ) target_link_libraries (report_broker LINK_PUBLIC brokers_common imtjson simpleServer) -install(TARGETS report_broker DESTINATION "bin/ext_report") diff --git a/src/server b/src/server index 8ce99465..3ed18784 160000 --- a/src/server +++ b/src/server @@ -1 +1 @@ -Subproject commit 8ce99465ae547372dbf6c3cde0dc8ae065838d12 +Subproject commit 3ed1878446ab3af1e6692afd4880b61d5895ceb3 diff --git a/src/storage_broker/CMakeLists.txt b/src/storage_broker/CMakeLists.txt index 552a0364..dec8af6e 100644 --- a/src/storage_broker/CMakeLists.txt +++ b/src/storage_broker/CMakeLists.txt @@ -6,4 +6,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/brokers/) add_executable (storage_broker main.cpp ) target_link_libraries (storage_broker LINK_PUBLIC brokers_common imtjson simpleServer) -install(TARGETS storage_broker DESTINATION "bin/storage_broker")