diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..62c893550 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install.md b/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install.md index d2fcb7dc1..6da71e9bc 100644 --- a/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install.md +++ b/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install.md @@ -1,6 +1,8 @@ # FreeTAKServer Install On Windows Computer -Below is the installation commands and comments for the installation of FreeTAKServer on a windows computer. Please notcie, the FTS team is not supporting Windows as an official OS for FTS. please contact the original authors +Below is the installation commands and comments for the installation of FreeTAKServer on a Windows computer. +Please notice, the FTS team is not supporting Windows as an official OS for FTS. +Please contact the original authors. ## FreeTAKServer Manager For Windows [FreeTAKServer Manager]( https://github.com/Cale-Torino/FreeTAKServer_Manager) has the ability to Start, Stop, Restart, Install and Uninstall the FreeTAKServer & FreeTAKServer-UI. @@ -32,330 +34,355 @@ the preferred way to install FTS is by using Pip, that would solve all the requi 1. Install python 3.8 from python.org -Download and run the installer - -``` -https://www.python.org/downloads/windows/ -``` - -Choose the installer option. - -[](pythoninstall.jpg) - -Check pip, tcl/tk and IDLE and the Python test suite. - -[](features.jpg) - -Make sure you add Python to environment variables for easy use. - -[](advanced.jpg) - -2. Now check that python and pip are installed and working correctly. *You should be able to open cmd anywhere and do this check*: - -``` -> python -V - -> pip --version -``` - -[](chkpypip.jpg) - -3. Once you have checked that Python and pip are working install the requirements: - -``` -> pip install flask -> pip install flask_login -> pip install flask_migrate -> pip install flask_wtf -> pip install flask_sqlalchemy -> pip install email_validator -> pip install gunicorn - -> pip install coveralls -> pip install coverage -> pip install pytest -> pip install flake8 -> pip install flake8-print -> pip install pep8-naming -> pip install selenium -``` - -4. - -When all the requirements have been satisfied install the FreeTAKServer + [Download and run the installer](https://www.python.org/downloads/windows/). + + Choose the installer option. + + [](pythoninstall.png) + + Check pip, tcl/tk and IDLE and the Python test suite. + + [](features.jpg) + + Make sure you add Python to environment variables for easy use. + + [](advanced.jpg) + +2. Verify python environment + + Check that python and pip are installed and working correctly. + *You should be able to open cmd anywhere and do this check*: + + ```shell + python -V + pip --version + ``` + [](chkpypip.jpg) + +3. Install Python packages + + Having checked that Python and pip are working install the requirements: + + 1. Perform install one by one via pip. + + ```shell + pip install flask + pip install flask_login + pip install flask_migrate + pip install flask_wtf + pip install flask_sqlalchemy + pip install email_validator + pip install waitress + + pip install coveralls + pip install coverage + pip install pytest + pip install flake8 + pip install flake8-print + pip install pep8-naming + pip install selenium + ``` + + 2. (alternate) Perform install from a file. + + From a file Paste these requirements into a .txt file `requirements.txt` for example: + ```text + flask + flask_login + flask_migrate + flask_wtf + flask_sqlalchemy + email_validator + waitress + coveralls + coverage + pytest + flake8 + flake8-print + pep8-naming + selenium + ``` + + Now change into the directory (`cd`) containing said `requirements.txt` file and run the command below: + + ```shell + pip install -r requirements.txt + ``` + + 3. Install FreeTAKServer + When all the requirements have been satisfied install the FreeTAKServer and FreeTAKServerUI. + ```shell + pip install FreeTAKServer + pip install FreeTAKServer-UI + ``` + + * https://pypi.org/project/FreeTAKServer/ + * https://pypi.org/project/FreeTAKServer-UI/ -``` -> python -m pip install FreeTAKServer[ui] -``` +4. Configure the FTS -5. After the installation has finished open the `MainConfig.py` file for editing. + After the installation has finished open the `MainConfig.py` file for editing. -The contents must be changed fo that the Windows paths can communicate with FTS + The contents must be changed fo that the Windows paths can communicate with FTS. -``` -MY PATH EXAMPLE -C:\Software\python\Lib\site-packages\FreeTAKServer\controllers\configuration\MainConfig.py -``` + ```text + MY PATH EXAMPLE + C:\Software\python\Lib\site-packages\FreeTAKServer\controllers\configuration\MainConfig.py + ``` -Edited contents for windows machines: + Edited contents for Windows machines: -```python + ```python + import os -import os -currentPath = os.path.dirname(os.path.abspath(__file__)) -from pathlib import Path + currentPath = os.path.dirname(os.path.abspath(__file__)) + from pathlib import Path -class MainConfig: - """ - this is the main configuration file and is the only one which - should need to be changed - """ - # this is the port to which clients will connect - CoTServicePort = int(8087) + class MainConfig: + """ + this is the main configuration file and is the only one which + should need to be changed + """ + # this is the port to which clients will connect + CoTServicePort = int(8087) - SSLCoTServicePort = int(8089) + SSLCoTServicePort = int(8089) - # this needs to be changed for private data packages to work - DataPackageServiceDefaultIP = str("0.0.0.0") + # this needs to be changed for private data packages to work + DataPackageServiceDefaultIP = str("0.0.0.0") - # User Connection package IP needs to be set to the IP which is used when creating the connection in your tak device - UserConnectionIP = str("0.0.0.0") + # User Connection package IP needs to be set to the IP which is used when creating the connection in your tak device + UserConnectionIP = str("0.0.0.0") - #python_version = 'python3.8' + #python_version = 'python3.8' - #userpath = '/usr/local/lib/' + #userpath = '/usr/local/lib/' - # api port - APIPort = 19023 + # api port + APIPort = 19023 - # Federation port - FederationPort = 9000 + # Federation port + FederationPort = 9000 - # api IP - APIIP = '0.0.0.0' + # api IP + APIIP = '0.0.0.0' - # allowed ip's to access CLI commands - AllowedCLIIPs = ['127.0.0.1'] + # allowed ip's to access CLI commands + AllowedCLIIPs = ['127.0.0.1'] - # IP for CLI to access - CLIIP = '127.0.0.1' + # IP for CLI to access + CLIIP = '127.0.0.1' - # whether or not to save CoT's to the DB - SaveCoTToDB = bool(True) + # whether to save CoT's to the DB + SaveCoTToDB = bool(True) - # this should be set before startup - DBFilePath = str(r'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\FTSDataBase.db') + # this should be set before startup + DBFilePath = str(r'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\FTSDataBase.db') - # the version information of the server (recommended to leave as default) - version = 'FreeTAKServer-1.5.12 RC1' + # the version information of the server (recommended to leave as default) + version = 'FreeTAKServer-1.5.12 RC1' - MainPath = str(Path(fr'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer')) + MainPath = str(Path(fr'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer')) - ExCheckMainPath = str(Path(fr'{MainPath}\\ExCheck')) + ExCheckMainPath = str(Path(fr'{MainPath}\\ExCheck')) - ExCheckFilePath = str(Path(fr'{MainPath}\\ExCheck\\template')) + ExCheckFilePath = str(Path(fr'{MainPath}\\ExCheck\\template')) - ExCheckChecklistFilePath = str(Path(fr'{MainPath}\\ExCheck\\checklist')) + ExCheckChecklistFilePath = str(Path(fr'{MainPath}\\ExCheck\\checklist')) - DataPackageFilePath = str(Path(fr'{MainPath}\\FreeTAKServerDataPackageFolder')) + DataPackageFilePath = str(Path(fr'{MainPath}\\FreeTAKServerDataPackageFolder')) - # format of API message header should be {Authentication: Bearer 'TOKEN'} - from uuid import uuid4 - id = str(uuid4()) + # format of API message header should be {Authentication: Bearer 'TOKEN'} + from uuid import uuid4 + id = str(uuid4()) - nodeID = f"FreeTAKServer-{id}" + nodeID = f"FreeTAKServer-{id}" - # set to None if you don't want a message sent - ConnectionMessage = f'Welcome to FreeTAKServer {version}. The Parrot is not dead. It’s just resting' + # set to None if you don't want a message sent + ConnectionMessage = f'Welcome to FreeTAKServer {version}. The Parrot is not dead. It’s just resting' - keyDir = str(Path(fr'{MainPath}\\certs\\pubserver.key')) + keyDir = str(Path(fr'{MainPath}\\certs\\pubserver.key')) - pemDir = str(Path(fr'{MainPath}\\certs\\pubserver.pem')) # or crt + pemDir = str(Path(fr'{MainPath}\\certs\\pubserver.pem')) # or crt - unencryptedKey = str(Path(fr'{MainPath}\\certs\\pubserver.key.unencrypted')) + unencryptedKey = str(Path(fr'{MainPath}\\certs\\pubserver.key.unencrypted')) - p12Dir = str(Path(fr'{MainPath}\\certs\\pubserver.p12')) + p12Dir = str(Path(fr'{MainPath}\\certs\\pubserver.p12')) - CA = str(Path(fr'{MainPath}\\certs\\ca.pem')) - CAkey = str(Path(fr'{MainPath}\\certs\\ca.key')) + CA = str(Path(fr'{MainPath}\\certs\\ca.pem')) + CAkey = str(Path(fr'{MainPath}\\certs\\ca.key')) - federationCert = str(Path(fr'{MainPath}\\certs\\pubserver.pem')) - federationKey = str(Path(fr'{MainPath}\\certs\\pubserver.key')) - federationKeyPassword = str('defaultpass') + federationCert = str(Path(fr'{MainPath}\\certs\\pubserver.pem')) + federationKey = str(Path(fr'{MainPath}\\certs\\pubserver.key')) + federationKeyPassword = str('defaultpass') - # location to backup client packages - clientPackages = str(Path(fr'{MainPath}\\certs\\ClientPackages')) - - password = str('defaultpass') - - websocketkey = "YourWebsocketKey" - -``` - -6. + # location to back up client packages + clientPackages = str(Path(fr'{MainPath}\\certs\\ClientPackages')) -When finished configuring `MainConfig.py` open the `config.py` file for editing + password = str('defaultpass') -``` -MY PATH EXAMPLE -C:\Software\python\Lib\site-packages\FreeTAKServer-UI\config.py -``` + websocketkey = "YourWebsocketKey" + ``` -Edited contents for windows machines: + When finished configuring `MainConfig.py` open the `config.py` file for editing. + ```text + MY PATH EXAMPLE + C:\Software\python\Lib\site-packages\FreeTAKServer-UI\config.py + ``` -```python + Edited contents for Windows machines: -# -*- encoding: utf-8 -*- -""" -License: MIT -Copyright (c) 2019 - present AppSeed.us -""" + ```python + # -*- encoding: utf-8 -*- + """ + License: MIT + Copyright (c) 2019 - present AppSeed.us + """ -import os -from os import environ + import os + from os import environ -class Config(object): + class Config(object): - basedir = os.path.abspath(os.path.dirname(__file__)) + basedir = os.path.abspath(os.path.dirname(__file__)) - SECRET_KEY = 'key' + SECRET_KEY = 'key' - # This will connect to the FTS db - SQLALCHEMY_DATABASE_URI = 'sqlite:///' + 'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\FTSDataBase.db' + # This will connect to the FTS db + SQLALCHEMY_DATABASE_URI = 'sqlite:///' + 'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\FTSDataBase.db' - # certificates path - certpath = "C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\certs\\" + # certificates path + certpath = "C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\certs\\" - # crt file path - crtfilepath = f"{certpath}pubserver.pem" + # crt file path + crtfilepath = f"{certpath}pubserver.pem" - # key file path - keyfilepath = f"{certpath}pubserver.key.unencrypted" + # key file path + keyfilepath = f"{certpath}pubserver.key.unencrypted" - # this IP will be used to connect with the FTS API - IP = '127.0.0.1' + # this IP will be used to connect with the FTS API + IP = '127.0.0.1' - # Port the UI uses to communicate with the API - PORT = '19023' + # Port the UI uses to communicate with the API + PORT = '19023' - # the public IP your server is exposing - APPIP = '127.0.0.1' + # the public IP your server is exposing + APPIP = '127.0.0.1' - # this port will be used to listen - APPPort = 5000 + # this port will be used to listen + APPPort = 5000 - # the webSocket key used by the UI to communicate with FTS. - WEBSOCKETKEY = 'YourWebsocketKey' + # the webSocket key used by the UI to communicate with FTS. + WEBSOCKETKEY = 'YourWebsocketKey' - # the API key used by the UI to comunicate with FTS. generate a new system user and then set it - APIKEY = 'Bearer token' + # the API key used by the UI to comunicate with FTS. generate a new system user and then set it + APIKEY = 'Bearer token' - # For 'in memory' database, please use: - # SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:' + # For 'in memory' database, please use: + # SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:' - SQLALCHEMY_TRACK_MODIFICATIONS = False + SQLALCHEMY_TRACK_MODIFICATIONS = False - # THEME SUPPORT - # if set then url_for('static', filename='', theme='') - # will add the theme name to the static URL: - # /static//filename - # DEFAULT_THEME = "themes/dark" - DEFAULT_THEME = None + # THEME SUPPORT + # if set then url_for('static', filename='', theme='') + # will add the theme name to the static URL: + # /static//filename + # DEFAULT_THEME = "themes/dark" + DEFAULT_THEME = None -class ProductionConfig(Config): - DEBUG = False + class ProductionConfig(Config): + DEBUG = False - # Security - SESSION_COOKIE_HTTPONLY = True - REMEMBER_COOKIE_HTTPONLY = True - REMEMBER_COOKIE_DURATION = 3600 + # Security + SESSION_COOKIE_HTTPONLY = True + REMEMBER_COOKIE_HTTPONLY = True + REMEMBER_COOKIE_DURATION = 3600 - # PostgreSQL database - SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@{}:{}/{}'.format( + # PostgreSQL database + SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@{}:{}/{}'.format( environ.get('APPSEED_DATABASE_USER', 'appseed'), environ.get('APPSEED_DATABASE_PASSWORD', 'appseed'), environ.get('APPSEED_DATABASE_HOST', 'db'), environ.get('APPSEED_DATABASE_PORT', 5432), environ.get('APPSEED_DATABASE_NAME', 'appseed') - ) + ) -class DebugConfig(Config): - DEBUG = True + class DebugConfig(Config): + DEBUG = True -config_dict = { - 'Production': ProductionConfig, - 'Debug': DebugConfig -} + config_dict = { + 'Production': ProductionConfig, + 'Debug': DebugConfig + } + ``` -``` +5. Start the Server -7. + In order to run the server and the GUI two terminal windows must be opened and the commands below must be run: + + SERVER START COMMAND + ```shell + python -m FreeTAKServer.controllers.services.FTS + ``` + UI START COMMAND + ```shell + cd C:\Software\python\Lib\site-packages\FreeTAKServer-UI + set FLASK_APP=run.py + flask run + ``` -In order to run the server and the GUI two terminal windows must be opened and the commands below must be run: +6. Connect to the Server -``` -SERVER START COMMAND -> python -m FreeTAKServer.controllers.services.FTS - -UI START COMMAND -> cd C:\Software\python\Lib\site-packages\FreeTAKServer-UI -> set FLASK_APP=run.py -> flask run -``` - -8. - -Now your server should be running. `User = admin`, `Password = password` and `GUI link` http://localhost:5000/ + Now your server should be running. `User = admin`, `Password = password` and `GUI link` http://localhost:5000/ ## Notes -If you would like to setup a Batch file (to run the server on a double click) use the commands below: +### Start FTS During System Start + +If you would like to set up a Batch file (to run the server on a double click) +use the commands below: Create a `.bat` file to run the server on double click and on startup: `StartFreeTAKServer.bat` -``` +```bat ::START THE SERVER ECHO ON start cmd /k python -m FreeTAKServer.controllers.services.FTS cd C:\Software\python\Lib\site-packages\FreeTAKServer-UI set FLASK_APP=run.py flask run -pause +pause ``` -Now to run at startup: Go to Run (`WINDOWS + R`) and Type `shell:startup`, and paste a copy of your `StartFreeTAKServer.bat` file there. +To run this script at startup: Go to Run (`WINDOWS + R`) and Type `shell:startup`, +and paste a copy of your `StartFreeTAKServer.bat` file there. -> To check python version `python -V` - -> To quickely check your IP `ipconfig` - -## TODO - - Create C# app to manage FreeTAKServer on windows with Python3 - - ##ERRORS +## ERRORS COT error v1.5.13 [](CotError.png) ## More Info + FreeTAKServer documentation for end users -| Description | Link | -|--------------------|------------------------------------------------------------------------------------------| -| User Docs: | https://freetakteam.github.io/FreeTAKServer-User-Docs/ | -| PyPi Install Docs: | https://freetakteam.github.io/FreeTAKServer-User-Docs/Installation/PyPi/Linux/Install/ | -| Server Download: | https://github.com/FreeTAKTeam/FreeTakServer | -| Server Releases: | https://github.com/FreeTAKTeam/FreeTakServer/releases | +| Description | Link | +|--------------------|----------------------------------------------------------------------------------------| +| User Docs: | https://freetakteam.github.io/FreeTAKServer-User-Docs/ | +| PyPi Install Docs: | https://freetakteam.github.io/FreeTAKServer-User-Docs/Installation/PyPi/Linux/Install/ | +| Server Download: | https://github.com/FreeTAKTeam/FreeTakServer | +| Server Releases: | https://github.com/FreeTAKTeam/FreeTakServer/releases | ## RPiFTS Series -GHOST_DA-B6 has created a set of videos on youtube detailing how to install and set up FTS on raspberry pi SBC's. + +GHOST_DA-B6 has created a set of videos on `youtube` detailing how to install and set up FTS on raspberry pi SBC's. You can view his RPiFTS video series on his [channel](https://www.youtube.com/channel/UC--WpY--HV7PymMWLgfflZA). diff --git a/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install_Tutorial.md b/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install_Tutorial.md index 9ad18836d..f37b11d9b 100644 --- a/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install_Tutorial.md +++ b/docs/docs/Installation/Windows/FreeTAKServer_Windows_Install_Tutorial.md @@ -1,362 +1,372 @@ # FreeTAKServer Install On Windows Computer -Below is the installation commands and comments for the installation of FreeTAKServer on a windows computer: +Below is the installation commands and comments for the installation of FreeTAKServer on a Windows computer: ----------- ## Install Instructions (Tested on Server Version 1.7.5. and UI v1.5.10) -1. +1. Install python from python.org + + [Download and run the installer](https://www.python.org/downloads/windows/). + + Choose the installer option. + + [](pythoninstall.png) + + Check pip, tcl/tk and IDLE and the Python test suite. + + [](features.jpg) + + Make sure you add Python to environment variables for easy use. + + [](advanced.jpg) + +2. Verify python environment + + Check that python and pip are installed and working correctly. *You should be able to open cmd anywhere and do this check*: + + ```shell + python -V + + pip --version + ``` + + [](chkpypip.jpg) + +3. Install Python packages + + Having checked that Python and pip are working install the requirements: + + 1. Perform install one by one via pip. + + ```shell + pip install flask + pip install flask_login + pip install flask_migrate + pip install flask_wtf + pip install flask_sqlalchemy + pip install email_validator + pip install waitress + + pip install coveralls + pip install coverage + pip install pytest + pip install flake8 + pip install flake8-print + pip install pep8-naming + pip install selenium + ``` + + 2. (alternate) Perform install from a file. + + From a file Paste these requirements into a .txt file `requirements.txt` for example: + ```text + flask + flask_login + flask_migrate + flask_wtf + flask_sqlalchemy + email_validator + waitress + coveralls + coverage + pytest + flake8 + flake8-print + pep8-naming + selenium + ``` -Install python from python.org + Now change into the directory (`cd`) containing said `requirements.txt` file and run the command below: -Download and run the installer. + ```shell + pip install -r requirements.txt + ``` + + 3. (alternate) Install packages via conda/mamba. + I recommend `micromamba` as it does not require Python to + be installed a priori. + * [micromamba install](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html) -``` -https://www.python.org/downloads/windows/ -``` - -Choose the installer option. - -[](pythoninstall.jpg) - -Check pip, tcl/tk and IDLE and the Python test suite. - -[](features.jpg) - -Make sure you add Python to environment variables for easy use. - -[](advanced.jpg) - -2. - -Now check that python and pip are installed and working correctly. *You should be able to open cmd anywhere and do this check*: - -``` -> python -V - -> pip --version -``` - -[](chkpypip.jpg) - -3. - -Once you have checked that Python and pip are working install the requirements: - -3.1. -Run install one by one. -``` -> pip install flask -> pip install flask_login -> pip install flask_migrate -> pip install flask_wtf -> pip install flask_sqlalchemy -> pip install email_validator -> pip install gunicorn - -> pip install coveralls -> pip install coverage -> pip install pytest -> pip install flake8 -> pip install flake8-print -> pip install pep8-naming -> pip install selenium -``` - -3.2. -Run install from a file. - -From a file Paste these requirements into a .txt file `requirements.txt` for example: -``` -flask -flask_login -flask_migrate -flask_wtf -flask_sqlalchemy -email_validator -gunicorn -coveralls -coverage -pytest -flake8 -flake8-print -pep8-naming -selenium -``` - -now CD into the directory which containes said `requirements.txt` file and run the command below: - -``` -pip install -r requirements.txt -``` - -4. - -When all the requirements have been satisfied install the FreeTAKServer. - -``` -> python -m pip install FreeTAKServer[ui] -``` - -5. + Create an environment. + ```shell + mamba create --name tak + mamba activate tak + ``` + + Install the packages into the environment. + ```shell + mamba install lxml pathlib tabulate setuptools + mamba install flask flask-login flask-migrate flask-wtf + mamba install sqlalchemy flask-sqlalchemy + mamba install flake8 flake8-print + mamba install email-validator + mamba install pytest coveralls coverage + mamba install pep8-naming selenium + mamba install waitress + ``` + + 4. Install FreeTAKServer + When all the requirements have been satisfied install the FreeTAKServer and FreeTAKServerUI. + ```shell + pip install FreeTAKServer + pip install FreeTAKServer-UI + ``` + + * https://pypi.org/project/FreeTAKServer/ + * https://pypi.org/project/FreeTAKServer-UI/ -After the installation has finished open the `MainConfig.py` file for editing. +4. Configure the FTS -The contents must be changed fo that the Windows paths can communicate with FTS. + After the installation has finished open the `MainConfig.py` file for editing. -``` -MY PATH EXAMPLE -C:\Software\python\Lib\site-packages\FreeTAKServer\controllers\configuration\MainConfig.py -``` + The contents must be changed fo that the Windows paths can communicate with FTS. -Edited contents for windows machines: + ```text + MY PATH EXAMPLE + C:\Software\python\Lib\site-packages\FreeTAKServer\controllers\configuration\MainConfig.py + ``` -```python + Edited contents for Windows machines: -import os + ```python + import os -currentPath = os.path.dirname(os.path.abspath(__file__)) -from pathlib import Path + currentPath = os.path.dirname(os.path.abspath(__file__)) + from pathlib import Path -class MainConfig: - """ - this is the main configuration file and is the only one which - should need to be changed - """ - # this is the port to which clients will connect - CoTServicePort = int(os.environ.get('FTS_COT_PORT', 8087)) + class MainConfig: + """ + this is the main configuration file and is the only one which + should need to be changed + """ + # this is the port to which clients will connect + CoTServicePort = int(os.environ.get('FTS_COT_PORT', 8087)) - SSLCoTServicePort = int(os.environ.get('FTS_SSLCOT_PORT', 8089)) + SSLCoTServicePort = int(os.environ.get('FTS_SSLCOT_PORT', 8089)) - # this needs to be changed for private data packages to work - DataPackageServiceDefaultIP = str(os.environ.get('FTS_DP_ADDRESS', "0.0.0.0")) + # this needs to be changed for private data packages to work + DataPackageServiceDefaultIP = str(os.environ.get('FTS_DP_ADDRESS', "0.0.0.0")) - # User Connection package IP needs to be set to the IP which is used when creating the connection in your tak device - UserConnectionIP = str(os.environ.get('FTS_USER_ADDRESS', "0.0.0.0")) + # User Connection package IP needs to be set to the IP which is used when creating the connection in your tak device + UserConnectionIP = str(os.environ.get('FTS_USER_ADDRESS', "0.0.0.0")) - #Path to the site-packages dir in your python installation - python_install_path = 'C:\\Software\\python\\Lib\\site-packages' + #Path to the site-packages dir in your python installation + python_install_path = 'C:\\Software\\python\\Lib\\site-packages' - # api port - APIPort = os.environ.get('FTS_API_PORT', 19023) + # api port + APIPort = os.environ.get('FTS_API_PORT', 19023) - # Federation port - FederationPort = os.environ.get('FTS_FED_PORT', 9000) + # Federation port + FederationPort = os.environ.get('FTS_FED_PORT', 9000) - # api IP - APIIP = os.environ.get('FTS_API_ADDRESS', '0.0.0.0') + # api IP + APIIP = os.environ.get('FTS_API_ADDRESS', '0.0.0.0') - # allowed ip's to access CLI commands - AllowedCLIIPs = ['127.0.0.1'] + # allowed ip's to access CLI commands + AllowedCLIIPs = ['127.0.0.1'] - # IP for CLI to access - CLIIP = '127.0.0.1' + # IP for CLI to access + CLIIP = '127.0.0.1' - # whether or not to save CoT's to the DB - SaveCoTToDB = bool(os.environ.get('FTS_COT_TO_DB', True)) + # whether to save CoT's to the DB + SaveCoTToDB = bool(os.environ.get('FTS_COT_TO_DB', True)) - # this should be set before startup + # this should be set before startup - DBFilePath = str(os.environ.get('FTS_DATA_PATH', fr'{python_install_path}\\FreeTAKServer\\') + "FTSDataBase.db") + DBFilePath = str(os.environ.get('FTS_DATA_PATH', fr'{python_install_path}\\FreeTAKServer\\') + "FTSDataBase.db") - # the version information of the server (recommended to leave as default) - version = 'FreeTAKServer-1.7.5 Public' + # the version information of the server (recommended to leave as default) + version = 'FreeTAKServer-1.7.5 Public' - MainPath = str(os.environ.get('FTS_DATA_PATH', - Path(fr'{python_install_path}\\FreeTAKServer'))) + MainPath = str(os.environ.get('FTS_DATA_PATH', + Path(fr'{python_install_path}\\FreeTAKServer'))) - ExCheckMainPath = str(Path(fr'{MainPath}\\ExCheck')) + ExCheckMainPath = str(Path(fr'{MainPath}\\ExCheck')) - ExCheckFilePath = str(Path(fr'{MainPath}\\ExCheck\\template')) + ExCheckFilePath = str(Path(fr'{MainPath}\\ExCheck\\template')) - ExCheckChecklistFilePath = str(Path(fr'{MainPath}\\ExCheck\\checklist')) + ExCheckChecklistFilePath = str(Path(fr'{MainPath}\\ExCheck\\checklist')) - DataPackageFilePath = str(Path(fr'{MainPath}\\FreeTAKServerDataPackageFolder')) + DataPackageFilePath = str(Path(fr'{MainPath} \\FreeTAKServerDataPackageFolder')) - # format of API message header should be {Authentication: Bearer 'TOKEN'} - from uuid import uuid4 - id = str(uuid4()) + # format of API message header should be {Authentication: Bearer 'TOKEN'} + from uuid import uuid4 + id = str(uuid4()) - nodeID = os.environ.get('FTS_NODE_ID', f"FreeTAKServer-{id}") + nodeID = os.environ.get('FTS_NODE_ID', f"FreeTAKServer-{id}") - # set to None if you don't want a message sent - ConnectionMessage = f'Welcome to FreeTAKServer {version}. The Parrot is not dead. It’s just resting' + # set to None if you don't want a message sent + ConnectionMessage = f'Welcome to FreeTAKServer {version}. The Parrot is not dead. It’s just resting' - certsPath = os.environ.get('FTS_CERTS_PATH', fr'{MainPath}/certs') + certsPath = os.environ.get('FTS_CERTS_PATH', fr'{MainPath}/certs') - keyDir = str(Path(fr'{certsPath}\\pubserver.key')) + keyDir = str(Path(fr'{certsPath}\\pubserver.key')) - pemDir = str(Path(fr'{certsPath}\\pubserver.pem')) # or crt + pemDir = str(Path(fr'{certsPath}\\pubserver.pem')) # or crt - unencryptedKey = str(Path(fr'{certsPath}\\pubserver.key.unencrypted')) + unencryptedKey = str(Path(fr'{certsPath}\\pubserver.key.unencrypted')) - p12Dir = str(Path(fr'{certsPath}\\pubserver.p12')) + p12Dir = str(Path(fr'{certsPath}\\pubserver.p12')) - CA = str(Path(fr'{certsPath}\\ca.pem')) - CAkey = str(Path(fr'{certsPath}\\ca.key')) + CA = str(Path(fr'{certsPath}\\ca.pem')) + CAkey = str(Path(fr'{certsPath}\\ca.key')) - federationCert = str(Path(fr'{certsPath}\\pubserver.pem')) - federationKey = str(Path(fr'{certsPath}\\pubserver.key')) - federationKeyPassword = str(os.environ.get('FTS_FED_PASSWORD','defaultpass')) + federationCert = str(Path(fr'{certsPath}\\pubserver.pem')) + federationKey = str(Path(fr'{certsPath}\\pubserver.key')) + federationKeyPassword = str(os.environ.get('FTS_FED_PASSWORD','defaultpass')) - # location to backup client packages - clientPackages = str(Path(fr'{MainPath}\\certs\\ClientPackages')) - - password = str(os.environ.get('FTS_PASSWORD', 'defaultpass')) - - websocketkey = os.environ.get('FTS_WEBSOCKET_KEY', "YourWebsocketKey") - - -``` - -6. + # location to backup client packages + clientPackages = str(Path(fr'{MainPath}\\certs\\ClientPackages')) -When finished configuring `MainConfig.py` open the `config.py` file for editing + password = str(os.environ.get('FTS_PASSWORD', 'defaultpass')) -``` -MY PATH EXAMPLE -C:\Software\python\Lib\site-packages\FreeTAKServer-UI\config.py -``` + websocketkey = os.environ.get('FTS_WEBSOCKET_KEY', "YourWebsocketKey") + ``` -Edited contents for windows machines: + When finished configuring `MainConfig.py` open the `config.py` file for editing. + ```text + MY PATH EXAMPLE + C:\Software\python\Lib\site-packages\FreeTAKServer-UI\config.py + ``` -```python + Edited contents for Windows machines: -# -*- encoding: utf-8 -*- -""" -License: MIT -Copyright (c) 2019 - present AppSeed.us -""" + ```python + # -*- encoding: utf-8 -*- + """ + License: MIT + Copyright (c) 2019 - present AppSeed.us + """ -import os -from os import environ + import os + from os import environ -class Config(object): + class Config(object): - basedir = os.path.abspath(os.path.dirname(__file__)) + basedir = os.path.abspath(os.path.dirname(__file__)) - SECRET_KEY = 'key' + SECRET_KEY = 'key' - # This will connect to the FTS db - SQLALCHEMY_DATABASE_URI = 'sqlite:///' + 'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\FTSDataBase.db' + # This will connect to the FTS db + SQLALCHEMY_DATABASE_URI = 'sqlite:///' + 'C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\FTSDataBase.db' - # certificates path - certpath = "C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\certs\\" + # certificates path + certpath = "C:\\Software\\python\\Lib\\site-packages\\FreeTAKServer\\certs\\" - # crt file path - crtfilepath = f"{certpath}pubserver.pem" + # crt file path + crtfilepath = f"{certpath}pubserver.pem" - # key file path - keyfilepath = f"{certpath}pubserver.key.unencrypted" + # key file path + keyfilepath = f"{certpath}pubserver.key.unencrypted" - # this IP will be used to connect with the FTS API - IP = '127.0.0.1' + # this IP will be used to connect with the FTS API + IP = '127.0.0.1' - # Port the UI uses to communicate with the API - PORT = '19023' + # Port the UI uses to communicate with the API + PORT = '19023' - # the public IP your server is exposing - APPIP = '127.0.0.1' + # the public IP your server is exposing + APPIP = '127.0.0.1' - # this port will be used to listen - APPPort = 5000 + # this port will be used to listen + APPPort = 5000 - # the webSocket key used by the UI to communicate with FTS. - WEBSOCKETKEY = 'YourWebsocketKey' + # the webSocket key used by the UI to communicate with FTS. + WEBSOCKETKEY = 'YourWebsocketKey' - # the API key used by the UI to comunicate with FTS. generate a new system user and then set it - APIKEY = 'Bearer token' + # the API key used by the UI to comunicate with FTS. generate a new system user and then set it + APIKEY = 'Bearer token' - # For 'in memory' database, please use: - # SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:' + # For 'in memory' database, please use: + # SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:' - SQLALCHEMY_TRACK_MODIFICATIONS = False + SQLALCHEMY_TRACK_MODIFICATIONS = False - # THEME SUPPORT - # if set then url_for('static', filename='', theme='') - # will add the theme name to the static URL: - # /static//filename - # DEFAULT_THEME = "themes/dark" - DEFAULT_THEME = None + # THEME SUPPORT + # if set then url_for('static', filename='', theme='') + # will add the theme name to the static URL: + # /static//filename + # DEFAULT_THEME = "themes/dark" + DEFAULT_THEME = None -class ProductionConfig(Config): - DEBUG = False + class ProductionConfig(Config): + DEBUG = False - # Security - SESSION_COOKIE_HTTPONLY = True - REMEMBER_COOKIE_HTTPONLY = True - REMEMBER_COOKIE_DURATION = 3600 + # Security + SESSION_COOKIE_HTTPONLY = True + REMEMBER_COOKIE_HTTPONLY = True + REMEMBER_COOKIE_DURATION = 3600 - # PostgreSQL database - SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@{}:{}/{}'.format( + # PostgreSQL database + SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@{}:{}/{}'.format( environ.get('APPSEED_DATABASE_USER', 'appseed'), environ.get('APPSEED_DATABASE_PASSWORD', 'appseed'), environ.get('APPSEED_DATABASE_HOST', 'db'), environ.get('APPSEED_DATABASE_PORT', 5432), environ.get('APPSEED_DATABASE_NAME', 'appseed') - ) - - -class DebugConfig(Config): - DEBUG = True - - -config_dict = { - 'Production': ProductionConfig, - 'Debug': DebugConfig -} + ) -``` - -7. + class DebugConfig(Config): + DEBUG = True -In order to run the server and the GUI two terminal windows must be opened and the commands below must be run: - -``` -SERVER START COMMAND -> python -m FreeTAKServer.controllers.services.FTS -UI START COMMAND -> cd C:\Software\python\Lib\site-packages\FreeTAKServer-UI -> set FLASK_APP=run.py -> flask run -``` + config_dict = { + 'Production': ProductionConfig, + 'Debug': DebugConfig + } -8. + ``` -Now your server should be running. `User = admin`, `Password = password` and `GUI link` http://localhost:5000/ +5. Start the Server -[](FTS_windows.gif) + In order to run the server and the GUI two terminal windows must be opened and the commands below must be run: + + SERVER START COMMAND + ```shell + python -m FreeTAKServer.controllers.services.FTS + ``` + UI START COMMAND + ```shell + cd C:\Software\python\Lib\site-packages\FreeTAKServer-UI + set FLASK_APP=run.py + flask run + ``` -9. +6. Connect to the Server -To uninstall do: + Now your server should be running. `User = admin`, `Password = password` and `GUI link` http://localhost:5000/ -``` + [](FTS_windows.gif) -> pip uninstall FreeTAKServer -> pip uninstall FreeTAKServer-UI +7. Uninstall FTS -``` + To uninstall do: + ```shell + pip uninstall FreeTAKServer + pip uninstall FreeTAKServer-UI + ``` -Then in the `C:\Software\python\Lib\site-packages\FreeTAKServer\` delete the `FTSDataBase.db` file. + Then in the `C:\Software\python\Lib\site-packages\FreeTAKServer\` delete the `FTSDataBase.db` file. -In the `C:\Software\python\Lib\site-packages\` path delete the `FreeTAKServer` & `FreeTAKServer-UI` folders. + In the `C:\Software\python\Lib\site-packages\` path delete the `FreeTAKServer` & `FreeTAKServer-UI` folders. ## Notes -If you would like to setup a Batch file (to run the server on a double click) use the commands below: +### Start FTS During System Start + +If you would like to set up a Batch file (to run the server on a double click) use the commands below: Create a `.bat` file to run the server on double click and on startup: `StartFreeTAKServer.bat` -``` +```bat ::START THE SERVER ECHO ON start cmd /k python -m FreeTAKServer.controllers.services.FTS @@ -366,8 +376,28 @@ set FLASK_APP=run.py flask run pause ``` -Now to run at startup: Go to Run (`WINDOWS + R`) and Type `shell:startup`, and paste a copy of your `StartFreeTAKServer.bat` file there. +To run this script at startup: Go to Run (`WINDOWS + R`) and Type `shell:startup`, and paste a copy of your `StartFreeTAKServer.bat` file there. + +### Helper tasks + +To check python version `python -V` + +To quickly check your IP `ipconfig` -> To check python version `python -V` +### Platform Concerns -> To quickely check your IP `ipconfig` +#### `gunicorn` not available on Windows + +[`gunicorn`](https://gunicorn.org/) +is not supported on Windows and is replaced by +[`waitress`](https://github.com/Pylons/waitress). + +Replace standard `gunicorn` command with `waitress-serve`. +For example: +```shell +gunicorn --listen=*:8000 myapp.wsgi:application +``` +...becomes... +```shell +waitress-serve --listen=*:8000 myapp.wsgi:application +``` diff --git a/docs/docs/Installation/Windows/pythoninstall.jpg b/docs/docs/Installation/Windows/pythoninstall.jpg deleted file mode 100644 index e5c700120..000000000 Binary files a/docs/docs/Installation/Windows/pythoninstall.jpg and /dev/null differ diff --git a/docs/docs/Installation/Windows/pythoninstall.png b/docs/docs/Installation/Windows/pythoninstall.png new file mode 100644 index 000000000..b4c1c992c Binary files /dev/null and b/docs/docs/Installation/Windows/pythoninstall.png differ