
# Network Configuration to Whitelist IP/Domain
----------------------------------------------
Configure network settings as indicated to ensure that the DvSum Gateway Service communicates effectively with the DvSum web application.

URLs that must be whitelisted for outbound access on port 443:
- https://apis.dvsum.ai
- https://dvsum-app-data-prod.s3.amazonaws.com
- wss://3k7tif2dyi.execute-api.us-west-2.amazonaws.com/prod

Ports that must be open for inbound access from end user computers:
- HTTPS port 443
- HTTPS port 8183

# Windows Server Prerequisites
----------------------------
Windows requirements:

- systemd support
- x86_64 server architecture
- Minimum memory: 8GB (16GB recommended)
- Minimum disk space: 10GB (20GB recommended)

# Install DvSum Service on Windows
--------------------------------

	1. Download the DvSum Gateway Service from the following link:
		*  https://apis.dvsum.ai/admin/account/saws/download-gateway?env=windows&app=dc
	2. Copy the downloaded `zip` file to the Windows server.
	3. Create a new directory (e.g., `DvSum_service`) and copy the `zip` file into it.
	4. Navigate to the new directory and unzip the `zip` file:

		tar -xf C:\path\to\DvSum_1.1.0.zip -C C:\path\to\extract\to 

	5. Update the `configuration.properties` file:
		* Add your API key.
		* Update the port if desired (default is 8183).
	6. (optional) Update the `ssl_config.properties` with relevant details.
	7. Install the DvSum service by executing the batch script:

		bash dvsum_gateway_setup.bat

# DvSum Gateway Setup Script (dvsum_gateway_setup.bat)
-----------------------------------------------------

	### Overview

	This script simplifies the setup and management of the DvSum Gateway on Windows. It automates SSL configuration, service installation,
	and provides flexibility with interactive and non-interactive modes.

	### Key Features

	1 **Streamlined SSL Configuration:**
		1. Generate new certificates (CSR or self-signed).
		2. Add certificates to existing keystores.
		3. Import server certificate and private key into a keystore.
		4. Utilize keystore already containing the required certificates and keys.
	2 **Seamless DvSum Gateway Management:** 
		Install, start, stop, restart, check status, or uninstall the service.
	3 **Flexible Usage:** 
		Choose between interactive (guided) and non-interactive (command-line arguments) modes.

	### Prerequisites

		* Bash batch
		* Root or sudo privileges


## Usage
--------

	### Interactive Mode
	--------------------

	Run the script without arguments for interactive mode:
	bash ./dvsum_gateway_setup.bat

	This will guide you through the SSL configuration and service setup process.

	### Non-Interactive Mode
	------------------------

	Use command-line arguments for non-interactive mode:

	bash ./dvsum_gateway_setup.bat --non-interactive --ssl-option=<option>

	Replace `<option>` with 1, 2, or 3 based on your SSL configuration needs:
	1. To generate a new CSR or self-signed certificate
	2. To add certificates into an existing keystore file
	3. To import a server certificate and private key into a new keystore
	4. To use an existing keystore containing the server certificate and private key

### Service Management
----------------------

	Get Help:
	To see detailed instructions and available options, run:
	bash ./dvsum_gateway_setup.bat --help

	Control DvSum Gateway services using the following commands:

	- Stop services:
	bash ./dvsum_gateway_setup.bat stop

	- Restart services:
	bash ./dvsum_gateway_setup.bat restart

	- Uninstall services:
	bash ./dvsum_gateway_setup.bat uninstall

	- Check service status:
	bash ./dvsum_gateway_setup.bat status

	## Configuration File

	The script uses and generates an `ssl_config.properties` file containing SSL configuration details. 
	In non-interactive mode, ensure this file is properly configured before running the script.

	## SSL Configuration Options

	1. Generate a new certificate:
		- Creates a Certificate Signing Request (CSR) for a CA-signed certificate
		- Or generates a self-signed certificate for testing

	2. Use an existing keystore:
		- Adds your SSL certificate to a keystore you already have
		- Ideal for updating an existing configuration

	3. Create a new keystore with your certificate:
		- Imports your existing SSL certificate and private key into a new keystore
	
	4. Use an existing keystore with certificate and private key:
		- Use a keystore that already contains your certificate and private key


	## Troubleshooting

	- Check the logs at `./logs/SAWS.log` for error messages or important information.
	- Ensure you have the necessary permissions to install and manage services.
	- Verify that your SSL certificates and key files are valid and accessible.
	- Use the `status` command to check if services are running properly.

## Support

If you encounter any issues or have questions, please contact DvSum support at support@dvsum.com.
