diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d9bfc9f..fafaca7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,15 +13,16 @@ jobs: runs-on: ${{ matrix.os }} strategy: - fail-fast: false - matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-22.04, macos-latest] steps: - name: Checkout uses: actions/checkout@v2 - name: Update + if: startswith(matrix.os, 'ubuntu') run: | sudo apt-get update @@ -31,6 +32,9 @@ jobs: key: ${{ github.job }} - name: Preparing platform + env: + TERM: linux run: | cd scripts - ./prepare.sh + ./set_vars.sh + ./install_platform.sh diff --git a/.gitignore b/.gitignore index 467ad64b..bfbe4399 100644 --- a/.gitignore +++ b/.gitignore @@ -6,10 +6,13 @@ ims.ostis.kb_copy geometry.drawings web-scn-editor prepared_kb +bin +build *.*~ .idea __pycache__ +.vscode # texstudio *.aux diff --git a/README.md b/README.md index c7393f1d..7cf9d37d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To learn more about the platform, check out our [documentation](https://github.c - Quick start using Docker Compose
- + Additional steps for Windows users Make sure you are using UNIX line endings inside the repository and `longpaths` are enabled, otherwise you may face problems during build or installation process. Use the commands below to reconfigure Git on your machine: @@ -32,12 +32,10 @@ To learn more about the platform, check out our [documentation](https://github.c Requirements: you will need [Docker](https://docs.docker.com/get-docker/) installed and running on your machine. ```sh - git clone https://github.com/ostis-ai/ostis-web-platform + git clone https://github.com/ostis-ai/ostis-web-platform --recursive cd ostis-web-platform # download images from Docker Hub docker compose pull - # download KB and LaTeX docs plugin - git submodule update --init --recursive # build knowledge base docker compose run machine build # launch web platform stack @@ -57,11 +55,9 @@ To learn more about the platform, check out our [documentation](https://github.c ### Build process ```sh - git clone https://github.com/ostis-ai/ostis-web-platform - git submodule update --init --recursive - cd scripts - ./prepare.sh no_build_sc_machine no_build_sc_web # download all submodules without compilation. - cd .. + git clone https://github.com/ostis-ai/ostis-web-platform --recursive + cd ostis-web-platform + ./scripts/install_submodules.sh # download all submodules without compilation. docker compose build ``` @@ -69,11 +65,12 @@ To learn more about the platform, check out our [documentation](https://github.c - Natively - Note: Currently, only Ubuntu is supported by this installation method. If you're going to use it, it might take a while to download dependencies and compile the components. Use it only if you know what you're doing! + Note: Currently, only Linux (Ubuntu-20.04, Ubuntu-22.04) and macOS are supported by this installation method. If you're going to use it, it might take a while to download dependencies and compile the components. Use it only if you know what you're doing! ```sh - cd ostis-web-platform/scripts/ - ./prepare.sh + git clone https://github.com/ostis-ai/ostis-web-platform --recursive + cd ostis-web-platform + ./scripts/install_platform.sh ``` ## Usage @@ -91,16 +88,11 @@ To learn more about the platform, check out our [documentation](https://github.c - Native installation ```sh - # Build knowledge base - cd ostis-web-platform/scripts/ - ./build_kb.sh # Launch knowledge processing machine - cd ostis-web-platform/scripts/ - ./run_sc_server.sh + ./scripts/run_sc_server.sh # *in another terminal* # Launch semantic web interface at localhost:8000 - cd ostis-web-platform/scripts/ - ./run_scweb.sh + ./scripts/run_sc_web.sh ``` ## Documentation @@ -117,21 +109,19 @@ the help of LaTeX tools in SCn-code representation. To build documentation manua ```sh # feel free to skip this step if the platform is already installed natively -cd ostis-web-platform/scripts -./prepare.sh no_build_sc_machine no_build_sc_web +./scripts/install_submodules.sh ``` - ### Build steps (using LaTeX) ```sh - cd ostis-web-platform/docs + cd docs TEXINPUTS=./scn: latexmk -pdf -bibtex main.tex ``` - ### Build steps (using Docker) ```sh - cd ostis-web-platform docker run -v ${PWD}:/workdir --rm -it ostis/scn-latex-plugin:latest "docs/main.tex" ``` diff --git a/docker-compose.yml b/docker-compose.yml index eb15975f..50d7d30f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: web: - image: ostis/sc-web:0.7.0-Rebirth + image: ostis/sc-web:0.8.0-Fusion build: context: ./sc-web restart: unless-stopped @@ -15,7 +15,7 @@ services: condition: service_healthy machine: - image: ostis/sc-machine:0.7.0-Rebirth + image: ostis/sc-machine:0.8.0-Fusion build: context: ./sc-machine restart: unless-stopped @@ -36,6 +36,8 @@ services: # Use the commented env variable if you need to rebuild KB every startup. #- "REBUILD_KB=1" - "KB_PATH=/kb/repo.path" + - "BINARY_PATH=/sc-machine/bin" + - "CONFIG_PATH=/kb/ostis-web-platform.ini" command: - "serve" diff --git a/docs/changelog.md b/docs/changelog.md index 10416659..55480e5c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,7 +4,39 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.8.0-Fusion] - 24.09.2023 +### Added +- Generalize all scripts +- Configure events and agents threads + +### Changed +- Link scripts with sc-machine and sc-web scripts +- Unify config file for sc-server and sc-builder + +### Deprecated +- Deprecate `run_scweb.sh`, add `run_sc_web.sh` instead +- Deprecate and divide `prepare.sh` into `install_submodules.sh`, `install_dependencies.sh`, `build_sc_machine.sh` and `build_sc_web.sh` + +### Removed +- Remove windows scripts +- Remove drawings and scp scripts +- Remove dump scripts +- Remove sctp-server scripts + +## [0.7.0-Rebirth] - 13.10.2022 +### Breaking actions +- Remove sctp-server scripts from projects that use ostis-web-platform +- Use py-sc-client and ts-sc-client for sc-server instead of sctp-clients for sctp-server + +### Added +- Add latex documentation from OSTIS Standard +- Add CI + +### Changed +- Unify config file for sc-server and sc-builder + +### Removed +- Remove sctp-server scripts ## [0.7.0-Rebirth] - 13.10.2022 diff --git a/ims.ostis.kb b/ims.ostis.kb index e9418bfb..03e9430b 160000 --- a/ims.ostis.kb +++ b/ims.ostis.kb @@ -1 +1 @@ -Subproject commit e9418bfb63bb7f96a1fc386288216593816bf933 +Subproject commit 03e9430b65061f2037406af7ef17af118b6f7c5b diff --git a/ostis-web-platform.ini b/ostis-web-platform.ini index a882fde0..8cd2c15e 100644 --- a/ostis-web-platform.ini +++ b/ostis-web-platform.ini @@ -1,6 +1,7 @@ [sc-memory] max_loaded_segments = 1000 max_threads = 32 +max_events_and_agents_threads = 32 save_period = 3600 update_period = 1800 @@ -12,6 +13,14 @@ log_type = File log_file = sc-machine/sc-memory.log log_level = Info +init_memory_generated_upload = false +init_memory_generated_structure = basic_ontology_structure + +max_strings_channels = 1000 +max_strings_channel_size = 100000 +max_searchable_string_size = 1000 +term_separators = " _" + [sc-server] host = 127.0.0.1 port = 8090 @@ -24,3 +33,5 @@ log_level = Info [sc-builder] log_file = sc-machine/scripts/sc_builder.log + +input_path = repo.path diff --git a/scripts/build_kb.sh b/scripts/build_kb.sh index 0a82e731..330fa50d 100755 --- a/scripts/build_kb.sh +++ b/scripts/build_kb.sh @@ -1 +1,9 @@ -python3 ../sc-machine/scripts/build_kb.py ../repo.path -c ../ostis-web-platform.ini +#!/usr/bin/env bash +set -eo pipefail + +if [ -z "${SC_MACHINE_PATH}" ]; +then + source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh +fi + +"${SC_MACHINE_PATH}/scripts/build_kb.sh" "$@" diff --git a/scripts/build_sc_machine.sh b/scripts/build_sc_machine.sh new file mode 100755 index 00000000..c1f4899c --- /dev/null +++ b/scripts/build_sc_machine.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -eo pipefail + +if [ -z "${SC_MACHINE_PATH}" ]; +then + source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh +fi + +"${SC_MACHINE_PATH}/scripts/build_sc_machine.sh" "$@" diff --git a/scripts/build_sc_web.sh b/scripts/build_sc_web.sh new file mode 100755 index 00000000..9bcd3084 --- /dev/null +++ b/scripts/build_sc_web.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -eo pipefail + +if [ -z "${SC_WEB_PATH}" ]; +then + source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh +fi + +"${SC_WEB_PATH}/scripts/build_sc_web.sh" "$@" diff --git a/scripts/clean.sh b/scripts/clean.sh deleted file mode 100755 index 7522d108..00000000 --- a/scripts/clean.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -rm -rf ../sc-machine -rm -rf ../sc-web -rm -rf ../kb.bin -rm -rf ../geometry.drawings diff --git a/scripts/dump_saver.sh b/scripts/dump_saver.sh deleted file mode 100755 index b371add2..00000000 --- a/scripts/dump_saver.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -echo "script for saving dumps starts..." -isEnd=false -isStart=false -if [ -z $1 ]; then - file="../config/sc-web.ini" -else - file=$1 -fi -echo "initial file path: "$file -while IFS= read -r line -do - if $isEnd; then - if [[ $line == "SavePeriod = "* ]];then - savePeriod=${line##* } - isEnd=false - else - savePeriod=3600 - fi - fi - if [[ $line == "DumpPath = "* ]];then - dumpsPath=${line##* } - else - dumpsPath=$path"/dumps" - fi - if $isStart; then - path=${line##* } - isEnd=true - isStart=false - fi - if [[ "$line" == "[Repo]" ]] - then - isStart=true - fi -done < $file -echo "segments.scdb path: "$path -echo "dumps path: "$dumpsPath -echo "save period: $savePeriod miliseconds" -currentName="segments.scdb" -LTIME=$(date +%s) -echo "waiting for a new dump" -while true -do - ATIME=$(date +%s) - dumpdate=$(date +"%T-%m-%d-%y") - runtime=$((($ATIME-$LTIME)*60)) - if [[ "$runtime" == "$savePeriod" ]] - then - if [ -d $dumpsPath ]; then - cp $path/$currentName $dumpsPath/$dumpdate.scdb - else - mkdir $dumpsPath - cp $path/$currentName $dumpsPath/$dumpdate.scdb - fi - LTIME=$ATIME - echo "dump saved" - echo "waiting for a new dump" - fi -done diff --git a/scripts/fix_libhiredis.sh b/scripts/fix_libhiredis.sh deleted file mode 100755 index d71a89ff..00000000 --- a/scripts/fix_libhiredis.sh +++ /dev/null @@ -1 +0,0 @@ -sed -i -e 's/REDIS REQUIRED libhiredis/REDIS REQUIRED hiredis/g' ../sc-machine/CMakeLists.txt diff --git a/scripts/formats.sh b/scripts/formats.sh new file mode 100644 index 00000000..28632c5f --- /dev/null +++ b/scripts/formats.sh @@ -0,0 +1,4 @@ +stage() +{ + ([ -n "$(tput setaf 1 2<&-)" ] && { tput setaf 4 && tput bold && echo "$1" && tput sgr0; }) || echo "$1" +} diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh new file mode 100755 index 00000000..8be79a0d --- /dev/null +++ b/scripts/install_dependencies.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -eo pipefail + +CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) +source "${CURRENT_DIR}/formats.sh" + +if [[ -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" ]]; +then + source "${CURRENT_DIR}/set_vars.sh" +fi + +function usage() { + cat < pubkey.gpg -sudo apt-key add pubkey.gpg -sudo apt-get update && sudo apt-get install yarn -rm pubkey.gpg \ No newline at end of file diff --git a/scripts/install_platform.sh b/scripts/install_platform.sh new file mode 100755 index 00000000..4594602c --- /dev/null +++ b/scripts/install_platform.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -eo pipefail + +CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) +source "${CURRENT_DIR}/formats.sh" + +if [[ -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" ]]; +then + source "${CURRENT_DIR}/set_vars.sh" +fi + +stage "Install ostis-web-platform" + +"${PLATFORM_PATH}/scripts/install_submodules.sh" +"${PLATFORM_PATH}/scripts/install_dependencies.sh" --dev +"${PLATFORM_PATH}/scripts/build_sc_machine.sh" +"${PLATFORM_PATH}/scripts/build_sc_web.sh" +"${PLATFORM_PATH}/scripts/build_kb.sh" + +stage "OSTIS-web-platform installed successfully" diff --git a/scripts/install_scn.sh b/scripts/install_scn.sh deleted file mode 100755 index aa4fd515..00000000 --- a/scripts/install_scn.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -#rst="\e[0m" # Text reset - -clone_project() -{ - if [ ! -d "../$2" ]; then - echo -en $green"Clone $2$rst\n" - git clone $1 ../$2 - cd ../$2 - git checkout $3 - cd - - else - echo -en "You can update "$green"$2"$rst" manualy$rst\n" - fi -} - -clone_project https://bitbucket.org/iit-ims-team/web-scn-editor web-scn-editor - -cd ../web-scn-editor -npm install -grunt build -grunt exec:renewComponentsHtml diff --git a/scripts/install_scp_component.sh b/scripts/install_scp_component.sh deleted file mode 100755 index 3a67f22c..00000000 --- a/scripts/install_scp_component.sh +++ /dev/null @@ -1,11 +0,0 @@ -cd ../sc-web/components -git clone https://github.com/belya/scp-debugger-interface scp -mkdir ../client/static/common/cytoscape -mv scp/cytoscape.js ../client/static/common/cytoscape/cytoscape.js -cd ../client/templates -echo '' >> common.html -echo '' >> components.html -cd ../../scripts -python build_components.py -i -a -cd ../../kb -echo 'ui_external_languages -> scp_debugger_view;; scp_debugger_view => nrel_main_idtf: [Отладчик SCP] (* <- lang_ru;;*);; format_scp_debugger => nrel_main_idtf: [Формат SCP отладчика] (* <- lang_ru;; *);;' > scp_debugger_view.scs \ No newline at end of file diff --git a/scripts/install_submodules.sh b/scripts/install_submodules.sh new file mode 100755 index 00000000..f24f2015 --- /dev/null +++ b/scripts/install_submodules.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +set -eo pipefail + +CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) +source "${CURRENT_DIR}/formats.sh" + +if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" || -z "${SC_MACHINE_REPO}" || -z "${SC_WEB_REPO}" \ + || -z "${SC_MACHINE_BRANCH}" || -z "${SC_WEB_BRANCH}" || -z "${SC_MACHINE_COMMIT}" || -z "${SC_WEB_COMMIT}" ]]; +then + source "${CURRENT_DIR}/set_vars.sh" +fi + + +usage() { + cat </dev/null 2>&1 && pwd) +source "${CURRENT_DIR}/formats.sh" + +if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_PATH}" || -z "${SC_WEB_PATH}" ]]; +then + source "${CURRENT_DIR}/set_vars.sh" +fi +======= st=1 +>>>>>>> main build_kb=1 build_sc_machine=1 build_sc_web=1 +<<<<<<< HEAD +======= set -eo pipefail +>>>>>>> main while [ "$1" != "" ]; do case $1 in @@ -23,6 +42,16 @@ while [ "$1" != "" ]; do shift done +<<<<<<< HEAD +clone_project() +{ + if [ ! -d "$2" ]; then + printf "Clone submodule %s (%s) into %s\n" "$1" "$3" "$2" + git clone "$1" --branch "$3" --single-branch "$2" --recursive + else + printf "You can update %s manually.\n" "$2" + fi +======= stage() { echo -en "[$1]\n" @@ -40,12 +69,18 @@ clone_project() else echo -e "You can update $2 manualy\n" fi +>>>>>>> main } stage "Clone projects" +<<<<<<< HEAD +clone_project "${SC_MACHINE_REPO}" "${SC_MACHINE_PATH}" "${SC_MACHINE_BRANCH}" +clone_project "${SC_WEB_REPO}" "${SC_WEB_PATH}" "${SC_WEB_BRANCH}" +======= clone_project https://github.com/ostis-ai/sc-machine.git sc-machine 0.7.0-Rebirth clone_project https://github.com/ostis-ai/sc-web.git sc-web 0.7.0-Rebirth +>>>>>>> main git submodule update --init --recursive @@ -53,6 +88,25 @@ stage "Prepare projects" prepare() { +<<<<<<< HEAD + echo -en "$1\n" +} + +if (( build_sc_machine == 1 )); +then + prepare "SC-machine" + + cd "${SC_MACHINE_PATH}" + git submodule update --init --recursive + "${SC_MACHINE_PATH}/scripts/install_deps_ubuntu.sh" --dev + + "${SC_MACHINE_PATH}/scripts/make_all.sh" +fi + + +if (( build_sc_web == 1 )); then + prepare "SC-web" +======= echo -en "$1\n" } @@ -79,8 +133,18 @@ fi if (( $build_sc_web == 1 )); then prepare "sc-web" pip3 install --default-timeout=100 future +>>>>>>> main + + "${SC_WEB_PATH}/scripts/install_deps_ubuntu.sh" +<<<<<<< HEAD + "${SC_WEB_PATH}/scripts/build_sc_web.sh" +fi +if (( build_kb == 1 )); then + stage "Build knowledge base" + "${PLATFORM_PATH}/scripts/build_kb.sh" +======= cd ../sc-web/scripts ./install_deps_ubuntu.sh --dev @@ -97,4 +161,5 @@ if (( $build_kb == 1 )); then stage "Build knowledge base" cd ../scripts ./build_kb.sh +>>>>>>> main fi diff --git a/scripts/run_sc_server.sh b/scripts/run_sc_server.sh index 9255ac2d..17c8024b 100755 --- a/scripts/run_sc_server.sh +++ b/scripts/run_sc_server.sh @@ -1,3 +1,9 @@ -#!/bin/bash -export LD_LIBRARY_PATH=../sc-machine/bin -../sc-machine/bin/sc-server -c ../ostis-web-platform.ini +#!/usr/bin/env bash +set -eo pipefail + +if [ -z "${SC_MACHINE_PATH}" ]; +then + source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh +fi + +"${SC_MACHINE_PATH}/scripts/run_sc_server.sh" "$@" diff --git a/scripts/run_sc_web.sh b/scripts/run_sc_web.sh new file mode 100755 index 00000000..06c8f21b --- /dev/null +++ b/scripts/run_sc_web.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -eo pipefail + +if [ -z "${SC_WEB_PATH}" ]; +then + source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh +fi + +"${SC_WEB_PATH}/scripts/run_sc_web.sh" "$@" diff --git a/scripts/run_scweb.sh b/scripts/run_scweb.sh index 70ae1ad0..20d41b20 100755 --- a/scripts/run_scweb.sh +++ b/scripts/run_scweb.sh @@ -1,2 +1,14 @@ -#!/bin/bash -../sc-web/scripts/run_scweb.sh +#!/usr/bin/env bash +set -eo pipefail + +YELLOW='\033[01;33m' +NC='\033[0m' # No Color +echo -e "${YELLOW}[WARNING] This script was deprecated in ostis-web-platform 0.8.0. +Please, use scripts/run_sc_web.sh instead. It will be removed in ostis-web-platform 0.9.0.${NC}" + +if [ -z "${SC_WEB_PATH}" ]; +then + source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh +fi + +"${SC_WEB_PATH}/scripts/run_sc_web.sh" "$@" diff --git a/scripts/schedule_backup.sh b/scripts/schedule_backup.sh deleted file mode 100755 index d295f3fd..00000000 --- a/scripts/schedule_backup.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -task="*/$1 * * * * cd $PWD && ./kb.bin_backup.sh" -(crontab -l; echo "$task") | crontab - diff --git a/scripts/set_vars.sh b/scripts/set_vars.sh new file mode 100755 index 00000000..44a08470 --- /dev/null +++ b/scripts/set_vars.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -eo pipefail + +ROOT_PATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd) + +export APP_ROOT_PATH="${APP_ROOT_PATH:-${ROOT_PATH}}" +export PLATFORM_PATH="${PLATFORM_PATH:-${APP_ROOT_PATH}}" +export PROBLEM_SOLVER_PATH="${PROBLEM_SOLVER_PATH:-${PLATFORM_PATH}/sc-machine}" +export CONFIG_PATH="${CONFIG_PATH:-${PLATFORM_PATH}/ostis-web-platform.ini}" +export REPO_PATH="${REPO_PATH:-${PLATFORM_PATH}/repo.path}" + +export SC_MACHINE_REPO="${SC_MACHINE_REPO:-https://github.com/ostis-ai/sc-machine.git}" +export SC_MACHINE_BRANCH="${SC_MACHINE_BRANCH:-0.8.0-Fusion}" +export SC_MACHINE_COMMIT="${SC_MACHINE_COMMIT:-""}" +export SC_MACHINE_PATH="${SC_MACHINE_PATH:-${PLATFORM_PATH}/sc-machine}" + +export SC_WEB_REPO="${SC_WEB_REPO:-https://github.com/ostis-ai/sc-web.git}" +export SC_WEB_BRANCH="${SC_WEB_BRANCH:-0.8.0-Fusion}" +export SC_WEB_COMMIT="${SC_WEB_COMMIT:-""}" +export SC_WEB_PATH="${SC_WEB_PATH:-${PLATFORM_PATH}/sc-web}" + +if [ -d "${SC_MACHINE_PATH}" ]; +then + source "${SC_MACHINE_PATH}/scripts/set_vars.sh" +fi + +if [ -d "${SC_WEB_PATH}" ]; +then + source "${SC_WEB_PATH}/scripts/set_vars.sh" +fi diff --git a/scripts/windows/3rd-party/numpy-1.9.3+vanilla-cp27-none-win_amd64.whl b/scripts/windows/3rd-party/numpy-1.9.3+vanilla-cp27-none-win_amd64.whl deleted file mode 100644 index eddb9048..00000000 Binary files a/scripts/windows/3rd-party/numpy-1.9.3+vanilla-cp27-none-win_amd64.whl and /dev/null differ diff --git a/scripts/windows/bootstrap-ostis-win64.cmd b/scripts/windows/bootstrap-ostis-win64.cmd deleted file mode 100644 index 1da25b92..00000000 --- a/scripts/windows/bootstrap-ostis-win64.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -cd /d %~dp0 -cmd /c powershell -ExecutionPolicy Bypass .\bootstrap-stage1.ps1 diff --git a/scripts/windows/bootstrap-stage1.ps1 b/scripts/windows/bootstrap-stage1.ps1 deleted file mode 100644 index 0ad8bb94..00000000 --- a/scripts/windows/bootstrap-stage1.ps1 +++ /dev/null @@ -1,114 +0,0 @@ -. .\utils.ps1 - -# a PATH variable is changed during package installation, so we need to preserve it -$oldpath = $env:Path - -# is restart needed before advancing to a second stage -$restart = $false - -Try{ - # see if there is chocolatey installed on the machine - choco -} -Catch{ - # download chocolatey package manager - iex ((New-Object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) -} - -# install prerequisite software (except VS and Qt) -cinst packages.config -yr --allowemptychecksum - -# Detect available toolchains -$ms = "HKLM:\SOFTWARE\Wow6432Node\Microsoft" -if (Test-RegValue $ms\VisualStudio\12.0 InstallDir){ - $Toolchain = "VS12" - $qt_compiler = "msvc2013" -} -elseif (Test-RegValue $ms\VisualStudio\14.0 InstallDir){ - $Toolchain = "VS14" # Full Visual Studio 2015 - $qt_compiler = "msvc2015" -} -elseif (Test-RegValue $ms\VisualCppBuildTools\14.0 Installed){ - $Toolchain = "BT14" # Visual C++ 2015 Build Tools - $qt_compiler = "msvc2015" -} -else { - Write-Host "No suitable toolchain found" - Write-Host "The script will automatically install .NET 4.5.2 and Visual C++ 2015 Build Tools" - Read-Host "Press Enter to continue, Ctrl-C to abort" - - cinst dotnet4.5.2 -yr --allowemptychecksum - - (New-Object net.webclient).DownloadFile("http://go.microsoft.com/fwlink/?LinkId=691126", "vcpp15bt.exe") - Start-Process .\vcpp15bt.exe /Passive -Wait - Start-Sleep -Milliseconds 500 - del vcpp15bt.exe - $Toolchain = "BT14" - $qt_compiler = "msvc2015" - $restart = $true # both pieces of software require system reboot -} - -# Qt5 installation -while ($q = Read-Host -Prompt "Do you have Qt5 installed? [y/n]") { - if ($q -eq 'y'){ - $qtdir = Read-Host -Prompt "Qt5 install directory" - break - } - elseif ($q -eq 'n'){ - Write-Host "The script will automatically install Qt5 in C:\Qt" - (New-Object net.webclient).DownloadFile("http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe", "qt-online.exe") - Start-Process ".\qt-online.exe" "--script", "qt5-unattend.qs", "Compiler=$qt_compiler" -Wait - Start-Sleep -Milliseconds 500 - del qt-online.exe - $qtdir = "C:\Qt" - break - } - else{ - Write-Host "Please type y or n" - } -} - -# reinstall and restart redis service - -if ((Get-Service | %{$_.Name}) -contains "Redis") { - redis-server --service-stop - redis-server --service-uninstall -} -redis-server --service-install --maxheap 100m --dir $pwd -redis-server --service-start - -# update path variable so we can see a newly installed python interpreter -$p = $oldpath + ';' + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ';' + [System.Environment]::GetEnvironmentVariable("Path","User") -$env:Path = ($p -Split ';' | select -Unique) -join ";" - -# install python modules for web interface -python -m pip install tornado sqlalchemy redis==2.9 configparser - -# install custom-built numpy module -python -m pip install .\3rd-party\numpy-1.9.3+vanilla-cp27-none-win_amd64.whl - -Write-Host "Setting up firewall rules" -# firewall rules for ports 8000 (web ui) and 55770 (sc-storage server) -if (!(Test-FirewallRule -Name "scweb")){ - Add-FirewallPortRule -Name "scweb" -Port 8000 -} - -if ($restart){ - write-host "Your computer needs to be restarted to finish installing prerequisite software" - write-host "Installation will continue after a reboot" - read-host "Save your work and press Enter to reboot" - - # schedule the second stage to run after reboot and initiate reboot - if (!(Test-Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce)){ - New-Item HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce - } - New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce -Name OstisBootstrap -PropertyType String -Value ` - "cmd /c ""cd /d $pwd & powershell -ExecutionPolicy Bypass .\bootstrap-stage2.ps1 -Toolchain $Toolchain -Qtdir $qtdir""" | out-null - restart-computer -force -} -else{ - # software installation finished, we can drop admin privileges now - # /env switch for 'runas' preserves the PATH environment variable - $user = & whoami - runas /env /user:$user "powershell .\bootstrap-stage2.ps1 -Toolchain $Toolchain -Qtdir $qtdir" -} diff --git a/scripts/windows/bootstrap-stage2.ps1 b/scripts/windows/bootstrap-stage2.ps1 deleted file mode 100644 index 509853b8..00000000 --- a/scripts/windows/bootstrap-stage2.ps1 +++ /dev/null @@ -1,98 +0,0 @@ -param([ValidateSet('VS12', 'VS14', 'BT14')]$Toolchain, [string]$Qtdir) - -. .\utils.ps1 - -# change to working directory -pushd ..\.. - -# clone latest sources from github -if(!(Test-Path .\sc-machine)){ - git clone -b scp_stable https://github.com/shunkevichdv/sc-machine -} - -if(!(Test-Path .\sc-web)){ - git clone https://github.com/Ivan-Zhukau/sc-web -} - -if(!(Test-Path .\ims.ostis.kb)){ - git clone https://github.com/shunkevichdv/ims.ostis.kb -} - -if(!(Test-Path .\kb.bin)){ - mkdir kb.bin | out-null -} - -# pull a minimum required subset of ims.ostis KB { - -# recreate a target location anew -del -Recurse -Force -ErrorAction SilentlyContinue ims.ostis.kb_copy -mkdir ims.ostis.kb_copy | out-null - -copy -Recurse ims.ostis.kb\ims\ostis_tech\semantic_network_represent\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ims\ostis_tech\unificated_models\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ims\ostis_tech\semantic_networks_processing\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ims\ostis_tech\lib_ostis\sectn_lib_of_reusable_comp_ui\ui_menu\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ims\ostis_tech\lib_ostis\sectn_lib_reusable_comp_kpm\reusable_sc_agents\lib_c_agents\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ims\ostis_tech\lib_ostis\sectn_lib_reusable_comp_kpm\reusable_sc_agents\lib_scp_agents\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ims\ostis_tech\lib_ostis\sectn_lib_reusable_comp_kpm\programs_for_sc_text_processing\scp_program\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\to_check\ ims.ostis.kb_copy\ -copy -Recurse ims.ostis.kb\ui\ ims.ostis.kb_copy\ -del -Recurse ims.ostis.kb_copy\ui\menu -# } - -# prepare GUI -pushd sc-web\scripts -.\client.bat -npm install -g grunt-cli -popd - -pushd sc-web -npm install -grunt build -popd - -copy config\server.conf sc-web\server - -pushd sc-machine - -switch($Toolchain){ - "VS12" { - $env:CMAKE_PREFIX_PATH = @(dir -Recurse -Path $Qtdir -Filter msvc2013_64 | ?{ $_.PSIsContainer })[0].FullName - # pull in environment for vs2013 - pushd $env:VS120COMNTOOLS\..\..\VC - Invoke-CmdScript vcvarsall.bat amd64 - popd - # generate makefiles for x64 vs2013 - & "${env:ProgramFiles}\CMake\bin\cmake" -G 'Visual Studio 12 2013 Win64' . - } - "VS14" { - $env:CMAKE_PREFIX_PATH = @(dir -Recurse -Path $Qtdir -Filter msvc2015_64 | ?{ $_.PSIsContainer })[0].FullName - # pull in environment for VS2015 - pushd $env:VS140COMNTOOLS\..\..\VC - Invoke-CmdScript vcvarsall.bat amd64 - popd - # generate makefiles for x64 vs2015 - & "${env:ProgramFiles}\CMake\bin\cmake" -G 'Visual Studio 14 2015 Win64' . - } - "BT14"{ - $env:CMAKE_PREFIX_PATH = @(dir -Recurse -Path $Qtdir -Filter msvc2015_64 | ?{ $_.PSIsContainer })[0].FullName - # pull in environment for vc++ 2015 build tools - pushd "${env:ProgramFiles(x86)}\Microsoft Visual C++ Build Tools" - Invoke-CmdScript vcbuildtools.bat amd64 - popd - # generate makefiles for x64 vs2015 - & "${env:ProgramFiles}\CMake\bin\cmake" -G 'Visual Studio 14 2015 Win64' . - } -} - -# build generated solution -msbuild /m sc-machine.sln /property:Configuration=Release - -# copy required qt5 runtime libs -copy $env:CMAKE_PREFIX_PATH\bin\Qt5Core.dll bin\ -copy $env:CMAKE_PREFIX_PATH\bin\Qt5Network.dll bin\ -popd - -write-host -write-host -nonewline -foregroundcolor green "Base system installation is now complete. Press Enter to leave the installer. " -read-host diff --git a/scripts/windows/build_kb.cmd b/scripts/windows/build_kb.cmd deleted file mode 100644 index 170d56a7..00000000 --- a/scripts/windows/build_kb.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off - -pushd ..\.. -sc-machine\bin\sc-builder -f -c -i repo.path -o kb.bin -s config\sc-web.ini -e sc-machine\bin\extensions -popd \ No newline at end of file diff --git a/scripts/windows/packages.config b/scripts/windows/packages.config deleted file mode 100644 index c272e062..00000000 --- a/scripts/windows/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/scripts/windows/qt5-unattend.qs b/scripts/windows/qt5-unattend.qs deleted file mode 100644 index 017cdc9d..00000000 --- a/scripts/windows/qt5-unattend.qs +++ /dev/null @@ -1,53 +0,0 @@ -function Controller() { - installer.autoRejectMessageBoxes(); - installer.installationFinished.connect(function() { - gui.clickButton(buttons.NextButton); - }) -} - -Controller.prototype.WelcomePageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.CredentialsPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.IntroductionPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.TargetDirectoryPageCallback = function() -{ - gui.currentPageWidget().TargetDirectoryLineEdit.setText("C:/Qt"); - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.ComponentSelectionPageCallback = function() { - var widget = gui.currentPageWidget(); - widget.deselectAll(); - widget.selectComponent("qt.57.win64_" + installer.value("Compiler") + "_64"); - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.LicenseAgreementPageCallback = function() { - gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true); - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.StartMenuDirectoryPageCallback = function() { - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.ReadyForInstallationPageCallback = function() -{ - gui.clickButton(buttons.NextButton); -} - -Controller.prototype.FinishedPageCallback = function() { -var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm -if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) { - checkBoxForm.launchQtCreatorCheckBox.checked = false; -} - gui.clickButton(buttons.FinishButton); -} \ No newline at end of file diff --git a/scripts/windows/run_scweb.cmd b/scripts/windows/run_scweb.cmd deleted file mode 100644 index bb06f9aa..00000000 --- a/scripts/windows/run_scweb.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off - -pushd ..\..\sc-web\server\ -python app.py -popd \ No newline at end of file diff --git a/scripts/windows/utils.ps1 b/scripts/windows/utils.ps1 deleted file mode 100644 index d300e171..00000000 --- a/scripts/windows/utils.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -# Tests if a registry value $Name exists for a given key at $Path -function Test-RegValue{ - param ( - [Parameter(Position=0, Mandatory=$true)][String]$Path, - [Parameter(Position=1, Mandatory=$true)][String]$Name - ) - - process{ - if(Test-Path $Path){ - $key = (gi $Path) - return $key.GetValueNames() -contains "$Name" - } - else{ - return $false; - } - } -} - -# Invokes a Cmd.exe shell script and updates the environment. -function Invoke-CmdScript { - param( - [String] $scriptName - ) - $cmdLine = """$scriptName"" $args & set" - & $Env:SystemRoot\system32\cmd.exe /c $cmdLine | - select-string '^([^=]*)=(.*)$' | foreach-object { - $varName = $_.Matches[0].Groups[1].Value - $varValue = $_.Matches[0].Groups[2].Value - set-item Env:$varName $varValue - } -} - -function Test-FirewallRule{ - param( - [Parameter(Position=0, Mandatory=$true)][String]$Name - ) - process{ - netsh advfirewall firewall show rule name="$Name" | out-null - } -} - -function Add-FirewallPortRule{ - param( - [Parameter(Position=0, Mandatory=$true)][String]$Name, - [Parameter(Position=1, Mandatory=$true)][int]$Port - ) - process{ - netsh advfirewall firewall add rule name="$Name" dir=in action=allow protocol=TCP localport=$Port - } -} \ No newline at end of file