Skip to content

Commit 95b353f

Browse files
committed
Windows installer working.
1 parent 72e5fbc commit 95b353f

11 files changed

+84
-38
lines changed

conf-templates/nginx_http.conf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@
2121
include nginx_access_control.conf;
2222

2323
location / {
24-
root ../src/htdocs/;
24+
root "c:/json-scada/src/htdocs/";
2525
index index.html index.htm;
2626
}
27-
27+
28+
# OPC-like Realtime/Hist API
29+
location /Invoke/ {
30+
proxy_set_header X-Forwarded-For $remote_addr;
31+
proxy_set_header X-Real-IP $remote_addr;
32+
proxy_set_header Host $http_host;
33+
proxy_pass http://127.0.0.1:8080/Invoke/;
34+
}
35+
2836
# reverse proxy, redirect ajax requests to OSHMI webserver.exe
2937
location /htdocs/shellapi.rjs {
3038
proxy_pass http://jsonscadarealtimewebserver/htdocs/shellapi.rjs;
@@ -58,14 +66,14 @@
5866
location ~ ^/svg/.+(\.svg|\.js)$ {
5967
add_header Cache-Control "no-cache, must-revalidate";
6068
etag on;
61-
root ../src/htdocs/;
69+
root "c:/json-scada/src/htdocs/";
6270
}
6371

6472
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
6573
#
6674
location ~ .php$ {
6775
include ../platform-windows/nginx_php-runtime/conf/fastcgi_params;
68-
root ../src/htdocs/;
76+
root "c:/json-scada/src/htdocs/";
6977
fastcgi_pass phpbackend;
7078
fastcgi_keep_conn on;
7179
fastcgi_index index.php;

conf-templates/nginx_https.conf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@
3333
# include nginx_access_control.conf;
3434

3535
# location / {
36-
# root ../src/htdocs/;
36+
# root "c:/json-scada/src/htdocs/";
3737
# index index.html index.htm;
3838

3939
# # For user authentication (use htpasswd.exe command to manage users):
4040
# # auth_basic "Restricted"; # For Basic Auth
41-
# # auth_basic_user_file ../../conf/.htpasswd; # For Basic Auth
41+
# # auth_basic_user_file "c:/json-scada/conf/.htpasswd"; # For Basic Auth
4242
# }
4343

44+
# # OPC-like Realtime/Hist API
45+
# location /Invoke/ {
46+
# proxy_set_header X-Forwarded-For $remote_addr;
47+
# proxy_set_header X-Real-IP $remote_addr;
48+
# proxy_set_header Host $http_host;
49+
# proxy_pass http://127.0.0.1:8080/Invoke/;
50+
# }
51+
4452

4553
# # reverse proxy, redirect ajax requests to OSHMI webserver.exe
4654
# location /htdocs/shellapi.rjs {
@@ -83,14 +91,14 @@
8391
# location ~ ^/svg/.+(\.svg|\.js)$ {
8492
# add_header Cache-Control "no-cache, must-revalidate";
8593
# etag on;
86-
# root ../src/htdocs/;
94+
# root "c:/json-scada/src/htdocs/";
8795
# }
8896

8997
# # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
9098
# #
9199
# location ~ .php$ {
92100
# include ../platform-windows/nginx_php-runtime/conf/fastcgi_params;
93-
# root ../src/htdocs/;
101+
# root "c:/json-scada/src/htdocs/";
94102
# fastcgi_pass phpbackend;
95103
# fastcgi_keep_conn on;
96104
# fastcgi_index index.php;

platform-windows/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dotnet publish --runtime win-x64 -p:PublishReadyToRun=true -c Release -o ..\..\b
2222
cd \json-scada\src\libplctag\libplctag.NET\src\libplctag
2323
dotnet build --runtime win-x64 -c Release -o ..\..\bin\
2424
cd \json-scada\src\libplctag\PLCTagsClient
25-
dotnet publish --runtime win-x64 -p:PublishReadyToRun=true -c Release -o ..\..\bin\
25+
dotnet publish --runtime win-x64 -p:PublishReadyToRun=true -c Release -o ..\..\..\bin\
2626

2727
set GOBIN=c:\json-scada\bin
2828
cd \json-scada\src\calculations

platform-windows/create_services.bat

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,65 @@ rem Create services, they will work not interactively and independently of a log
99
cd \json-scada\bin
1010

1111
C:\json-scada\platform-windows\postgresql-runtime\bin\pg_ctl.exe register -N JSON_SCADA_postgresql -D "C:\json-scada\platform-windows\postgresql-data"
12+
nssm set JSON_SCADA_postgresql Start SERVICE_AUTO_START
1213

1314
nssm install JSON_SCADA_grafana "C:\json-scada\platform-windows\grafana-runtime\bin\grafana-server.exe"
14-
nssm set AppDirectory JSON_SCADA_grafana "C:\json-scada\platform-windows\grafana-runtime\bin"
15+
nssm set JSON_SCADA_grafana AppDirectory "C:\json-scada\platform-windows\grafana-runtime\bin"
16+
nssm set JSON_SCADA_grafana AppEnvironmentExtra GF_SERVER_DOMAIN=127.0.0.1 GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s:80/grafana/ GF_SERVER_SERVE_FROM_SUB_PATH=true
17+
nssm set JSON_SCADA_grafana Start SERVICE_AUTO_START
1518

1619
nssm install JSON_SCADA_mongodb "C:\json-scada\platform-windows\mongodb-runtime\bin\mongod.exe" --config "c:\json-scada\platform-windows\mongodb-conf\mongod.cfg"
20+
nssm set JSON_SCADA_mongodb Start SERVICE_AUTO_START
1721

18-
nssm install JSON_SCADA_calculations "C:\json-scada\bin\calculations.exe" 1 1 "c:\json-scada\conf\json-scada.json"
22+
nssm install JSON_SCADA_calculations "C:\json-scada\bin\calculations.exe" 1 1 2.0 "c:\json-scada\conf\json-scada.json"
1923
REM STDOUT logging
2024
nssm set JSON_SCADA_calculations AppStdout C:\json-scada\log\calculations.log
25+
nssm set JSON_SCADA_calculations Start SERVICE_AUTO_START
2126
REM See log rotation options https://nssm.cc/usage#io
2227

2328
nssm install JSON_SCADA_cs_data_processor "C:\json-scada\platform-windows\nodejs-runtime\node.exe" "C:\json-scada\src\cs_data_processor\cs_data_processor.js" 1 1 "c:\json-scada\conf\json-scada.json"
2429
nssm set JSON_SCADA_cs_data_processor AppDirectory "C:\json-scada\src\cs_data_processor"
25-
nssm install JSON_SCADA_server_realtime "C:\json-scada\platform-windows\nodejs-runtime\node.exe" "C:\json-scada\src\server_realtime\index.js" 1 1 "c:\json-scada\conf\json-scada.json"
30+
nssm set JSON_SCADA_cd_data_processor Start SERVICE_AUTO_START
31+
nssm install JSON_SCADA_server_realtime "C:\json-scada\platform-windows\nodejs-runtime\node.exe" "C:\json-scada\src\server_realtime\index.js" NOAUTH
2632
nssm set JSON_SCADA_server_realtime AppDirectory "C:\json-scada\src\server_realtime"
33+
nssm set JSON_SCADA_server_realtime Start SERVICE_AUTO_START
2734

2835
nssm install JSON_SCADA_alarm_beep "C:\json-scada\platform-windows\nodejs-runtime\node.exe" "C:\json-scada\src\alarm_beep\alarm_beep.js"
2936
nssm set JSON_SCADA_alarm_beep AppDirectory "C:\json-scada\src\alarm_beep"
37+
nssm set JSON_SCADA_alarm_beep Start SERVICE_AUTO_START
3038

3139
nssm install JSON_SCADA_process_rtdata "C:\json-scada\sql\process_pg_rtdata.bat"
3240
nssm set JSON_SCADA_process_rtdata AppDirectory "C:\json-scada\sql"
41+
nssm set JSON_SCADA_process_rtdata Start SERVICE_AUTO_START
3342
nssm install JSON_SCADA_process_hist "C:\json-scada\sql\process_pg_hist.bat"
3443
nssm set JSON_SCADA_process_hist AppDirectory "C:\json-scada\sql"
44+
nssm set JSON_SCADA_process_hist Start SERVICE_AUTO_START
45+
46+
nssm install JSON_SCADA_php "c:\json-scada\platform-windows\nginx_php-runtime\php\php-cgi.exe" -b 127.0.0.1:9000 -c c:\json-scada\conf\php.ini
47+
nssm set JSON_SCADA_php Start SERVICE_AUTO_START
48+
49+
nssm install JSON_SCADA_nginx "c:\json-scada\platform-windows\nginx_php-runtime\nginx.exe" -c c:\json-scada\conf\nginx.conf
50+
nssm set JSON_SCADA_php Start SERVICE_AUTO_START
51+
52+
REM SELECT THE DESIRED PROTOCOL DRIVERS (service startup options: SERVICE_AUTO_START, SERVICE_DELAYED_START, SERVICE_DEMAND_START, SERVICE_DISABLED)
3553

3654
nssm install JSON_SCADA_iec104client "C:\json-scada\bin\iec104client.exe" 1 1
55+
nssm set JSON_SCADA_iec104client Start SERVICE_DELAYED_START
56+
3757
nssm install JSON_SCADA_iec104server "C:\json-scada\bin\iec104server.exe" 1 1
58+
nssm set JSON_SCADA_iec104server Start SERVICE_DEMAND_START
3859

39-
REM nssm install JSON_SCADA_iec101client "C:\json-scada\bin\iec101client.exe" 1 1
40-
REM nssm install JSON_SCADA_iec101server "C:\json-scada\bin\iec101server.exe" 1 1
41-
REM nssm install JSON_SCADA_dnp3client "C:\json-scada\bin\iec104client.exe" 1 1
42-
REM nssm install JSON_SCADA_i104m "C:\json-scada\bin\i104m.exe" 1 1
60+
nssm install JSON_SCADA_iec101client "C:\json-scada\bin\iec101client.exe" 1 1
61+
nssm set JSON_SCADA_iec101client Start SERVICE_DEMAND_START
4362

44-
nssm install JSON_SCADA_php "c:\json-scada\platform-windows\nginx_php-runtime\php\php-cgi.exe" -b 127.0.0.1:9000 -c c:\json-scada\conf\php.ini
45-
nssm install JSON_SCADA_nginx "c:\json-scada\platform-windows\nginx_php-runtime\nginx.exe" -c c:\json-scada\conf\nginx.conf
63+
nssm install JSON_SCADA_iec101server "C:\json-scada\bin\iec101server.exe" 1 1
64+
nssm set JSON_SCADA_iec101server Start SERVICE_DEMAND_START
65+
66+
nssm install JSON_SCADA_dnp3client "C:\json-scada\bin\Dnp3Client.exe" 1 1
67+
nssm set JSON_SCADA_dnp3client Start SERVICE_DEMAND_START
68+
69+
nssm install JSON_SCADA_i104m "C:\json-scada\bin\i104m.exe" 1 1
70+
nssm set JSON_SCADA_i104m Start SERVICE_DEMAND_START
71+
72+
nssm install JSON_SCADA_plctags "C:\json-scada\bin\PLCTagsClient.exe" 1 1
73+
nssm set JSON_SCADA_plctags Start SERVICE_DEMAND_START

platform-windows/json-scada.nsi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ SetRegView 64
341341
CreateDirectory "$DESKTOP\JSON-SCADA"
342342

343343
; Cria atalhos para os aplicativos
344-
CreateShortCut "$DESKTOP\JSON-SCADA\_Start_Services.lnk" "$INSTDIR\bin\platform-windows\start_services.bat"
345-
CreateShortCut "$DESKTOP\JSON-SCADA\_Stop_Services.lnk" "$INSTDIR\bin\platform-windows\stop_services.bat"
344+
CreateShortCut "$DESKTOP\JSON-SCADA\_Start_Services.lnk" "$INSTDIR\platform-windows\start_services.bat"
345+
CreateShortCut "$DESKTOP\JSON-SCADA\_Stop_Services.lnk" "$INSTDIR\platform-windows\stop_services.bat"
346346

347-
; CreateShortCut "$DESKTOP\JSON-SCADA\Clean Browser Cache.lnk" "$INSTDIR\bin\cache_clean.bat"
347+
; CreateShortCut "$DESKTOP\JSON-SCADA\Clean Browser Cache.lnk" "$INSTDIR\platform-windows\cache_clean.bat"
348348

349349
CreateShortCut "$DESKTOP\JSON-SCADA\Chromium Browser.lnk" "$INSTDIR\$NAVWINCMD" " $NAVDATDIR $NAVPREOPT $NAVPOSOPT"
350350

@@ -515,10 +515,10 @@ Section "Uninstall"
515515
; Fecha processos
516516

517517
; SetOutPath $INSTDIR\bin
518-
ExecWait '"$0" /C "$INSTDIR\platform-windows\nginx_php\stop_nginx_php.bat"'
519518
ExecWait '"$0" /C "$INSTDIR\platform-windows\mongodb-stop.bat"'
520519
ExecWait '"$0" /C "$INSTDIR\platform-windows\postgresql-stop.bat"'
521520
ExecWait '"$0" /C "$INSTDIR\platform-windows\stop_services.bat"'
521+
Sleep 3000
522522
ExecWait '"$0" /C "$INSTDIR\platform-windows\remove_services.bat"'
523523
nsExec::Exec `wmic PROCESS WHERE "COMMANDLINE LIKE '%c:\\json-scada\\bin\\%'" CALL TERMINATE`
524524
nsExec::Exec `wmic PROCESS WHERE "COMMANDLINE LIKE '%c:\\json-scada\\platform-windows\\browser-runtime\\%'" CALL TERMINATE`

platform-windows/remove_services.bat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ nssm remove JSON_SCADA_calculations confirm
1919
nssm remove JSON_SCADA_process_rtdata confirm
2020
nssm remove JSON_SCADA_process_hist confirm
2121

22+
nssm remove JSON_SCADA_nginx confirm
23+
nssm remove JSON_SCADA_php confirm
24+
2225
nssm remove JSON_SCADA_iec104server confirm
2326
nssm remove JSON_SCADA_iec104client confirm
24-
2527
nssm remove JSON_SCADA_iec101server confirm
2628
nssm remove JSON_SCADA_iec101client confirm
2729
nssm remove JSON_SCADA_dnp3client confirm
2830
nssm remove JSON_SCADA_i104m confirm
31+
nssm remove JSON_SCADA_plctags confirm
2932

30-
nssm remove JSON_SCADA_nginx confirm
31-
nssm remove JSON_SCADA_php confirm

platform-windows/start_services.bat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ nssm start JSON_SCADA_calculations
1717
nssm start JSON_SCADA_process_rtdata
1818
nssm start JSON_SCADA_process_hist
1919

20-
nssm start JSON_SCADA_iec104server
21-
nssm start JSON_SCADA_iec104client
22-
2320
nssm start JSON_SCADA_php
2421
nssm start JSON_SCADA_nginx
2522

23+
REM SELECT PROTOCOLS TO START
24+
nssm start JSON_SCADA_iec104client
25+
REM nssm start JSON_SCADA_iec104server
2626
REM nssm start JSON_SCADA_iec101server
2727
REM nssm start JSON_SCADA_iec101client
2828
REM nssm start JSON_SCADA_dnp3client
2929
REM nssm start JSON_SCADA_i104m
30+
REM nssm start JSON_SCADA_plctags

platform-windows/stop_services.bat

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ nssm stop JSON_SCADA_calculations
1717
nssm stop JSON_SCADA_process_rtdata
1818
nssm stop JSON_SCADA_process_hist
1919

20-
nssm stop JSON_SCADA_iec104server
21-
nssm stop JSON_SCADA_iec104client
22-
2320
nssm stop JSON_SCADA_nginx
2421
nssm stop JSON_SCADA_php
2522

26-
REM nssm stop JSON_SCADA_iec101server
27-
REM nssm stop JSON_SCADA_iec101client
28-
REM nssm stop JSON_SCADA_dnp3client
29-
REM nssm stop JSON_SCADA_i104m
23+
nssm stop JSON_SCADA_iec104server
24+
nssm stop JSON_SCADA_iec104client
25+
nssm stop JSON_SCADA_iec101server
26+
nssm stop JSON_SCADA_iec101client
27+
nssm stop JSON_SCADA_dnp3client
28+
nssm stop JSON_SCADA_i104m
29+
nssm stop JSON_SCADA_plctags

sql/create_tables.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ GRANT SELECT ON grafana_realtime TO grafana;
8989

9090
CREATE USER json_scada WITH PASSWORD 'json_scada';
9191
GRANT CONNECT ON DATABASE json_scada TO json_scada;
92-
GRANT all ON realtime_data, hist TO json_scada;
92+
GRANT all ON realtime_data, hist, grafana_hist TO json_scada;

sql/process_pg_hist.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if %ERRORLEVEL% EQU 0 GOTO END
88
rem cd \json-scada\sql
99

1010
FOR /L %%i IN (0,0,0) DO (
11-
FORFILES -m pg_hist_*.sql -c "CMD /c ..\postgresql-runtime\bin\psql.exe -h 127.0.0.1 -d json_scada -U json_scada -w < @FILE && del @FILE & ECHO @FILE" & PING -n 2 127.0.0.1 > nul
11+
FORFILES -m pg_hist_*.sql -c "CMD /c ..\platform-windows\postgresql-runtime\bin\psql.exe -h 127.0.0.1 -d json_scada -U json_scada -w < @FILE && del @FILE & ECHO @FILE" & PING -n 2 127.0.0.1 > nul
1212
)
1313

1414
:END

sql/process_pg_rtdata.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if %ERRORLEVEL% EQU 0 GOTO END
88
rem cd \json-scada\sql
99

1010
FOR /L %%i IN (0,0,0) DO (
11-
FORFILES -m pg_rtdata_*.sql -c "CMD /c ..\postgresql-runtime\bin\psql.exe -h 127.0.0.1 -d json_scada -U json_scada -w < @FILE && del @FILE & ECHO @FILE" & PING -n 3 127.0.0.1 > nul
11+
FORFILES -m pg_rtdata_*.sql -c "CMD /c ..\platform-windows\postgresql-runtime\bin\psql.exe -h 127.0.0.1 -d json_scada -U json_scada -w < @FILE && del @FILE & ECHO @FILE" & PING -n 3 127.0.0.1 > nul
1212
)
1313

1414
:END

0 commit comments

Comments
 (0)