Install on windows
Install ITR on a windows server or windows 10 version
This installation assumes installing the ITR for development or other test purposes. It can be used as a starting point for installing a production server.
1. First install all latest windows updates so you windows system is as up to date as possible
2. Install postgresql 10.5 to c:\ disk
- a. Start the installation as default as possible
- b. At some stage enter the password ITR2018! For the superuser
- c. Port 5432 is fine
- d. Default locale
- e. And go !
3. Start server manager
- a. Add roles and features.
- i. Add roles Web Server IIS – Next until IIS web server role settings.
- ii. Performance - dynamic and static compression
- iii. Application Development extensions – CGI & ISAPI (both options)
- iv. .Net extensibility (latest version & .net 3). On windows server 2019 installing .Net 3 is a seperate manual step you need to perform before Step 3.
- v. Click Next
- b. Next - Install now
4. Download and install python 3.6 from www.python.org Windows x86-64 executable installer. Python 3.7 will probably also work, but is not tested at this point in time.
- a. Add python to Path
- b. Install for all users
- c. Click Customize and select everything
- d. Advanced options – install for all users, precompile. Do NOT download debugging
- e. Install location c:\Python\Python36
- f. Disable path lenght limit
5. If you wish to use Python 3.7 then first download and install Build tools for visual studio from https://visualstudio.microsoft.com/downloads/
- a. Select: Workloads → Visual C++ build tools.
- b. Installation steps you can check on the internet. There are many options.
6. Start CMD.exe in administrator mode
- a. pip install --upgrade pip
- b. pip install wfastcgi
7. Start IIS
- a. Click on your server name
- b. Click on FastCGI settings
- c. Click on add application
- Set max instances to 50 or 25 for a small server
- d. Click on Environment variables collection
- e. Click Add
- g. Result
- i. Add the site with the name you want and add a certificate
- j. Add the files to the folder you want ( for example c:\inetpub\itr_site)
- k. In IIS click on the API folder in the site (You will have to do this for the external API as well)
- l. Rightclick – Convert to application. Set the right user for the application (and the associated application pool). The user should have the right to access the database and write to all ITR folders, start GIT (to retrieve the latest source code) and other service activities.
- m. Click Handler mappings
- n. Click Add module mapping
- p. The text is c:\Python\Python36\python.exe|c:\Python\Python36\Lib\site-packages\wfastcgi.py (with a PIPE sign in between)
- q. Add request restrictions
- r. Unckeck Invoke handler at tab Mapping
- s. Check all verbs at tab Verbs
- t. Check Script at tab Access
- u. If the handler already exists check the values and update them
- v. Request a certificate for this site and install it
- w. Add the website after copying it to c:\inetpub\itr_site
- x. Link the site up to the imported certificate and disable http in the bindings
- y. Add a dummy site on the http binding in c:\inetpub\itr_http which will redirect to the https site automatically. For example with the following html :
- <!DOCTYPE html>
- * * * *
8. Install required PIP packages
- a. Open cmd.exe in admin mode
- b. Go to c:\inetpub\itr_site\API
- c. pip install -U setuptools
- d. Type PIPInstall and press enter
9. Install hmailserver on windows.
- a. First make sure the .net framework 3.5 is properly installed ! On windows 2019 servers this version of .net is NOT installed by default.
- b. Install SQL Server Developer edition 2017 (Basic install). Install SSMS only if you want that.
- c. Use defaults.
- d. Set Password to ITR2018!
- e. Run admin after setup
- f. Check Automatically connect on startup
- g. Click connect and enter password set above. You are now in the server.
- h. Create the mail domain name in the mail software (for example testdimensions.eu)
- i. First now we will need to generate a DKIM certificate as described on https://www.hmailserver.com/forum/viewtopic.php?t=29402. Follow these instructions. Save the generated keys on the desktop with the name mail_keys.txt
- j. Test setup by opening powershell and enter send-mailmessage -to "Bart <YOURMAIL>" -from "NoReply <noreply@THEMAILDOMAIN>" -subject "Test mail" -body "Hallo !" -SmtpServer 127.0.0.1
- k. Add the TXT record to the DNS with TTL of 5 minutes for the domain. Example : dkim._domainkey, TTL 5 min, TXT, v=DKIM1; k=rsa; p=MIGfMA0dfgddfgdfg...sdfsdfsdfdsfsdfAQAB
- l. Add the SPF record to the DNS : @, TTL 5 min, TXT, v=spf1 ip4:<IP address of server> a:THEMAILDOMAIN ~all
11. Start IIS go to the application pool the ITR site is running on and change the settings as follows :
Instead of administrator you would probably want to use another account with less permissions. For development servers Administrator is fine.
If you would like to automate the backup of postgresql on windows a good starting point for a script could be :
@echo off for /f "tokens=1-4 delims=/-. " %%i in ("%date%") do ( set dow=%%i set month=%%j set day=%%k set year=%%l ) set datestr=%day% echo datestr is %datestr% set BACKUP_FILE=ITR_Daily_%datestr%.backup echo backup file name is %BACKUP_FILE% SET PGPASSWORD=ITR2018! echo on ..\bin\pg_dumpall -h localhost -p 5432 -U postgres -v -f %BACKUP_FILE%
Save this for example to a backup folder in the postgresql program folder and put this as a windows task. Name this script for example 'backup.cmd'.