SAMO 10 Service Deployment
Overview
This guide provides step-by-step instructions for deploying SAMO 10 platform components as Windows Services. The deployment uses a single batch script that automatically installs ALL SAMO backend component JAR files found in a directory as Windows Services using WinSW (Windows Service Wrapper).
By following this guide, you will:
- Set up the required directory structure
- Configure all necessary environment variables
- Install and start all SAMO backend services automatically
- Verify the installation is working correctly
Prerequisites
Before starting the deployment, ensure you have the following:
1. Software Requirements
- Java Development Kit (JDK): Version 17
- Example location:
C:\Program Files\Java\jdk-17 - Verify installation: Open Command Prompt and run
java -versionyou should see Java 17 listed
- Example location:
2. Database & Elasticsearch
- Configured Database: Oracle or PostgreSQL must be installed and configured
- Database credentials: You'll need the database password for configuration
- Elasticsearch 8: Installed and running, configured for SAMO
3. Required Files
-
WinSW-x64.exe: Windows Service Wrapper executable
- Download from: WinSW GitHub Releases
- Place in your deployment directory
-
SAMO Component JAR Files: All backend component JAR files
- Example files:
samo-security-manager-10.0.0.jarsamo-license-server-10.0.0.jarsamo-user-service-10.0.0.jarsamo-gateway-10.0.0.jar- (and other components as needed)
- Example files:
-
Installation Script: install-all-samo-services.bat
Contact the SAMO support team to obtain the installation script.
4. System Requirements
- Administrator Access: Required to install Windows Services
- Available Ports: Ensure required ports are not in use by other applications
- Disk Space: Sufficient space for logs and data directories
5. Credentials and Secrets
Prepare the following credentials (you'll need these during installation):
- Microsoft IDM Client Secret
- Database password
- Any other service-specific credentials/secrets
Deployment Steps
Step 1: Create Directory Structure
Create the following directory structure on your system:
C:\samo\
├── configuration\ (Configuration packages root)
├── environment\ (Environment properties files)
│ ├── environment1\
│ └── environment2\
├── data\ (Persistent data, certificates)
└── logs\ (Service logs)
C:\deploy\samo-backend\ (Deployment directory)
├── install-all-samo-services.bat
├── WinSW-x64.exe
├── samo-security-manager-10.0.0.jar
├── samo-license-server-10.0.0.jar
├── samo-user-service-10.0.0.jar
└── (other component JAR files)
Step 3: Place Required Files
-
Copy JAR files to
C:\deploy\samo-backend\- All SAMO component JAR files must be in this directory
-
Copy WinSW-x64.exe to
C:\deploy\samo-backend\ -
Copy install-all-samo-services.bat to
C:\deploy\samo-backend\
Your deployment directory should look like:
C:\deploy\samo-backend\
├── install-all-samo-services.bat
├── WinSW-x64.exe
├── samo-security-manager-10.0.0.jar
├── samo-license-server-10.0.0.jar
└── ... (other JARs)
Step 4: Configure the Installation Script
The installation script accepts the following required parameters:
| Parameter | Description | Example |
|---|---|---|
| 1. PACKAGES_ROOT | Root of configuration packages | C:\samo\configuration |
| 2. ENV_PROPERTIES | Semicolon-separated environment properties files | C:\samo\environment\environment.properties;C:\samo\environment\environment2.properties |
| 3. DATA_ROOT | Data root directory | C:\samo\data |
| 4. MICROSOFTIDM_SECRET | Microsoft IDM Client Secret | your_secret_here |
| 5. DB_PASSWORD | Database password | your_db_password |
| 6. SERVICE_PREFIX | Prefix for service names | samo-10- |
| 7. JAVA_HOME (optional) | JDK installation path | C:\Program Files\Java\jdk-17 |
| 8. LOG_DIR (optional) | Log directory | C:\samo\logs |
Step 5: Run the Installation
-
Open Command Prompt as Administrator
- Press
Windows + X - Select "Command Prompt (Admin)" or "Windows PowerShell (Admin)"
- Press
-
Navigate to the deployment directory:
cd C:\deploy\samo-backend
- Run the installation script with your configuration:
Basic installation (using default Java and log paths):
install-all-samo-services.bat C:\samo\configuration "C:\samo\environment\environment.properties;C:\samo\environment\environment2.properties" C:\samo\data YOUR_SECRET_HERE YOUR_DB_PASSWORD samo-10-
Full installation (specifying all parameters):
install-all-samo-services.bat C:\samo\configuration "C:\samo\environment\environment.properties;C:\samo\environment\environment2.properties" C:\samo\data YOUR_SECRET_HERE YOUR_DB_PASSWORD samo-10- "C:\Program Files\Java\jdk-17" C:\samo\logs
- Replace
YOUR_SECRET_HEREwith your actual Microsoft IDM Client Secret - Replace
YOUR_DB_PASSWORDwith your actual database password - Use quotes around paths that contain spaces
- Never commit credentials to version control
- Monitor the installation:
- The script will display progress messages for each component
- Watch for any [ERROR] messages
- Installation is complete when you see success messages for all components
Step 6: Verify Installation
After the script completes, verify that services are installed and running:
- Check all SAMO services:
sc query state= all | find /i "samo-10-"
- Check individual services:
sc query samo-10-samo-security-manager
sc query samo-10-samo-license-server
sc query samo-10-samo-user-service
-
Check service status in Windows Services Manager:
- Press
Windows + R - Type
services.mscand press Enter - Look for services starting with your prefix (e.g.,
samo-10-) - Verify they are in "Running" state
- Press
-
Check service logs:
- Navigate to
C:\samo\logs\ - Each component should have its own subdirectory
- Check for any error messages in the log files
- Navigate to
Step 7: Testing Individual Components (Optional)
If you want to test a single component before installing it as a service:
cd C:\deploy\samo-backend
"C:\Program Files\Java\jdk-17\bin\java.exe" -Xmx1024m ^
-Dsamo_packages_root="C:\samo\configuration" ^
-Dsamo_env_configuration="C:\samo\environment\environment.properties;C:\samo\environment\environment2.properties" ^
-Dsamo_data_root="C:\samo\data" ^
-DdataSource.password="YOUR_DB_PASSWORD" ^
-jar samo-security-manager-10.0.0.jar
- Press
Ctrl+Cto stop the test run - Check output for any errors before proceeding with service installation
What the Script Does
The installation script performs the following actions automatically:
-
Validates Prerequisites:
- Checks that
WinSW-x64.exeis present - Ensures the log directory exists
- Verifies that JAR files are available
- Checks that
-
For Each JAR File:
- Creates a subfolder for the component
- Copies WinSW executable (renamed to match the component)
- Generates a WinSW XML configuration file
- Stops and removes existing service (if present)
- Installs the new service
- Starts the service
-
Configures Logging:
- Sets up rolling log files for each component
- Creates separate log directories per component
Updating Services
To apply new JAR versions: replace JAR files in the directory and rerun the script. Existing services will be stopped, deleted, and recreated automatically.
Always back up your configuration before updating services. The script will automatically handle service restart, but configuration files should be preserved.
Troubleshooting
Common Issues and Solutions
| Issue | Possible Cause | Solution |
|---|---|---|
[ERROR] WinSW not found | Missing WinSW executable | Ensure WinSW-x64.exe is in the deployment directory |
[ERROR] No JAR files found | JARs not in correct location | Place all JAR files in the same directory as the script |
| Service fails to start | Configuration error | Check component logs in C:\samo\logs\[component-name]\ |
| Port already in use | Port conflict with another application | Change port in configuration or stop conflicting service |
| Java not found | Incorrect JAVA_HOME path | Verify JDK installation path and update parameter |
| Access denied | Insufficient permissions | Run Command Prompt as Administrator |
| Database connection failed | Wrong credentials or database not accessible | Verify database password and connectivity |
Checking Service Logs
- Navigate to the log directory:
C:\samo\logs\ - Open the subdirectory for the problematic component
- Open the latest log file
- Look for ERROR or WARN messages
- Address any configuration issues found
Manual Service Management
Use the Windows Services Manager (services.msc) to manually start, stop, or restart services if needed.
Customization
Adjusting Memory Settings
To change the memory allocation for services:
- Edit the generated XML file in
C:\deploy\samo-backend\[component-folder]\ - Modify the
-Xmxparameter in the<arguments>section - Restart the service
Example: Change from -Xmx1024m to -Xmx2048m
Adding Additional Java Arguments
To add custom Java properties:
- Edit the XML configuration file for the component
- Add properties in the
<arguments>section - Example:
-DHTTPS_ENABLED=true -DHTTPS_PORT=8443 - Restart the service
Security Best Practices
-
Protect Credentials:
- Never commit secrets to version control
- Store credentials securely
- Use environment-specific configuration files
-
Restrict Directory Access:
- Set appropriate ACLs on
C:\samo\directories - Limit access to Administrators only:
icacls C:\samo /grant Administrators:F /ticacls C:\samo /remove Users /t - Set appropriate ACLs on
-
Regular Updates:
- Keep Java runtime updated
- Apply SAMO component updates promptly
- Review security advisories
-
Monitor Logs:
- Regularly check service logs for errors or security issues
- Implement log rotation to manage disk space
- Consider centralized logging for production environments
Post-Deployment Checklist
After completing the deployment, verify the following:
- All services are installed and running
- Service logs show no critical errors
- Database connections are successful
- Application endpoints are accessible
- Configuration files are properly secured
- Firewall rules allow necessary traffic
- Backup procedures are in place
- Monitoring is configured (if applicable)
Next Steps
After successful deployment:
- Configure application-specific settings
- Set up user accounts and permissions
- Configure SSL/TLS certificates (if required)
- Perform integration testing
- Document any environment-specific customizations
Need Help? If you encounter issues not covered in this guide, consult the SAMO support team or refer to the detailed documentation in other sections.