Skip to content

Commit

Permalink
Merge pull request #195 from json-scada/master
Browse files Browse the repository at this point in the history
Install script for Ubuntu 24.04, improvements to other install scripts.
  • Loading branch information
riclolsen authored Jan 12, 2025
2 parents 0f729ef + b8598c2 commit a89bb5d
Show file tree
Hide file tree
Showing 46 changed files with 6,093 additions and 1,278 deletions.
31 changes: 31 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ Execute commands below for scripted installation:
sudo passwd jsonscada
sudo su - jsonscada

# if necessary, add the below line to the end of the file /etc/sudoers.
jsonscada ALL=(ALL) ALL # Change the user name before you issue the commands

# next, clone the json-scada repo

sudo dnf -y install git
Expand All @@ -97,6 +100,34 @@ Execute commands below for scripted installation:
# to compile and install Inkscape+SAGE, run the following command:
sudo sh ./inkscape-plus-sage.sh

## Ubuntu 24.04, scripted installation

Execute commands below for scripted installation:

# firstly create a user named "jsonscada" that can do "sudo". Login as "jsonscada".

sudo adduser jsonscada
sudo usermod -aG wheel jsonscada
sudo usermod -aG docker jsonscada
sudo passwd jsonscada
sudo su - jsonscada

# if necessary, add the below line to the end of the file /etc/sudoers.
jsonscada ALL=(ALL) ALL # Change the user name before you issue the commands

# next, clone the json-scada repo

sudo dnf -y install git
cd /home/jsonscada
git clone https://github.com/riclolsen/json-scada --config core.autocrlf=input
cd json-scada/platform-ubuntu-2404

# on x86-64 or ARM64 platform run
sudo sh ./json-scada-install.sh

# to compile and install Inkscape+SAGE, run the following command:
sudo sh ./inkscape-plus-sage.sh

## Manual Installation

To install JSON-SCADA manually, it is required to install all the requirements first. There is no point reproducing original installation instructions for each upstream project. Here are links and relevant information specific to JSON-SCADA.
Expand Down
14 changes: 8 additions & 6 deletions platform-linux/export_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ MONGOBIN=/usr/bin
JAVAPATH=/usr/bin
TARPATH=/usr/bin
SVGPATH=$JSPATH/svg
mongoConnectionString=mongodb://127.0.0.1/json_scada?tls=false&directConnection=true
database=json_scada

# read JSON config file
mongoConnectionString=$(jq -r '.mongoConnectionString' $JSPATH/conf/json-scada.json)
database=$(jq -r '.mongoDatabaseName' $JSPATH/conf/json-scada.json)


mkdir -c $TMPPATH
rm -rf $TMPPATH/*.*
Expand All @@ -28,9 +28,11 @@ mongoexport.exe --uri "$mongoConnectionString" --db $database --collection roles
# mongoexport.exe --uri "$mongoConnectionString" --db $database --collection soeData --out $TMPPATH\soeData.json
# mongoexport.exe --uri "$mongoConnectionString" --db $database --collection userActions --out $TMPPATH\userActions.json

copy %SVGPATH%\*.svg %TMPPATH%\
copy %SVGPATH%\screen_list.js %TMPPATH%\
copy %SVGPATH%/*.svg %TMPPATH%/
copy %SVGPATH%/screen_list.js %TMPPATH%/
# optional
# copy %JSPATH%\conf\*.* %TMPPATH%\
# copy %JSPATH%\conf/*.* %TMPPATH%/

# zip files
cd %TMPPATH%
tar -a -c -f %TMPPATH%/jsproject.zip -C %TMPPATH% *.json *.js *.svg
5 changes: 3 additions & 2 deletions platform-linux/import_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ MONGOBIN=/usr/bin
JAVAPATH=/usr/bin
TARPATH=/usr/bin
SVGPATH=$JSPATH/svg
mongoConnectionString=mongodb://127.0.0.1/json_scada?tls=false&directConnection=true
database=json_scada
# read JSON config file
mongoConnectionString=$(jq -r '.mongoConnectionString' $JSPATH/conf/json-scada.json)
database=$(jq -r '.mongoDatabaseName' $JSPATH/conf/json-scada.json)
FLAGS=--mode=upsert

# read JSON config file
Expand Down
5 changes: 5 additions & 0 deletions platform-nix-idx/mongod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ processManagement:
net:
bindIp: 127.0.0.1
port: 27017
# Where and how to store data. Add more memory if you have more than 4GB of RAM.
storage:
dbPath: "/home/user/mongodb/var/lib/mongo"
wiredTiger:
engineConfig:
cacheSizeGB: 1

systemLog:
destination: file
path: "/home/user/mongodb/var/log/mongodb/mongod.log"
Expand Down
66 changes: 41 additions & 25 deletions platform-nix-idx/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,44 @@ stdout_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
stdout_capture_maxbytes=10MB ; number of bytes in 'capturemode' (default 0)

[program:mongowr]
; args: instance# loglevel
command=/usr/bin/node /home/user/json-scada/src/mongowr/index.js
autostart=false
numprocs=1 ; number of processes copies to start (def 1)
directory=/home/user/json-scada/src/mongowr/ ; directory to cwd to before exec (def no cwd)
user=user ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/home/user/json-scada/log/mongowr.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
stdout_capture_maxbytes=10MB ; number of bytes in 'capturemode' (default 0)

[program:mongofw]
; args: instance# loglevel
command=/usr/bin/node /home/user/json-scada/src/mongofw/index.js
autostart=false
numprocs=1 ; number of processes copies to start (def 1)
directory=/home/user/json-scada/src/mongofw/ ; directory to cwd to before exec (def no cwd)
user=user ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/home/user/json-scada/log/mongofw.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
stdout_capture_maxbytes=10MB ; number of bytes in 'capturemode' (default 0)
;[program:mongowr]
;; args: instance# loglevel
;command=/usr/bin/node /home/user/json-scada/src/mongowr/index.js
;autostart=false
;numprocs=1 ; number of processes copies to start (def 1)
;directory=/home/user/json-scada/src/mongowr/ ; directory to cwd to before exec (def no cwd)
;user=user ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
;stdout_logfile=/home/user/json-scada/log/mongowr.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
;stdout_capture_maxbytes=10MB ; number of bytes in 'capturemode' (default 0)

;[program:mongofw]
;; args: instance# loglevel
;command=/usr/bin/node /home/user/json-scada/src/mongofw/index.js
;autostart=false
;numprocs=1 ; number of processes copies to start (def 1)
;directory=/home/user/json-scada/src/mongofw/ ; directory to cwd to before exec (def no cwd)
;user=user ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
;stdout_logfile=/home/user/json-scada/log/mongofw.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=10MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
;stdout_capture_maxbytes=10MB ; number of bytes in 'capturemode' (default 0)

;[program:metabase]
;command=/usr/bin/java -jar /home/user/json-scada/metabase/metabase.jar
;;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1 ; number of processes copies to start (def 1)
;environment=MB_JETTY_PORT="3001",MB_DB_TYPE="postgres",MB_DB_DBNAME="metabaseappdb",MB_DB_PORT="5432",MB_DB_USER="postgres",MB_DB_PASS="",MB_DB_HOST="localhost",MB_CHECK_FOR_UPDATES="false"
;directory=/home/user/json-scada/metabase/ ; directory to cwd to before exec (def no cwd)
;user=user ; setuid to this UNIX account to run the program
;stdout_logfile=/home/user/json-scada/log/metabase.log ; stdout log path, NONE for none;
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=0 ; # of stdout logfile backups (0 means none, default 10)
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stderr_logfile=/home/user/json-scada/log/metabase.err ; stderr log path, NONE for none;
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=0 ; # of stderr logfile backups (0 means none, default 10)
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
31 changes: 16 additions & 15 deletions platform-rhel9/json-scada-install-aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ sudo dnf remove -y python3-circuitbreaker

sudo update-crypto-policies --set LEGACY

wget --inet4-only https://go.dev/dl/go1.22.3.linux-arm64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.3.linux-arm64.tar.gz
wget --inet4-only https://go.dev/dl/go1.23.4.linux-arm64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.4.linux-arm64.tar.gz
sudo -u $JS_USERNAME sh -c 'export PATH=$PATH:/usr/local/go/bin'
sudo -u $JS_USERNAME sh -c 'echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.bashrc'
source ~/.bashrc

# for mongodb
# https://www.mongodb.com/docs/manual/tutorial/transparent-huge-pages/
Expand Down Expand Up @@ -105,18 +106,18 @@ EOL
sudo dnf -y update
sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-$(arch)/pgdg-redhat-repo-latest.noarch.rpm
sudo cp /etc/yum.repos.d/pgdg-redhat-all.repo.rpmnew /etc/yum.repos.d/pgdg-redhat-all.repo
sudo dnf -y --enablerepo=pgdg16 update
sudo dnf -y --enablerepo=pgdg17 update
curl -s https://packagecloud.io/install/repositories/timescale/timescaledb/script.rpm.sh | sudo bash
sudo dnf -y install timescaledb_16 postgresql16 postgresql16-contrib
sudo dnf -y install timescaledb-toolkit-postgresql-16
# sudo timescaledb-tune -yes --pg-config=/usr/pgsql-16/bin/pg_config
sudo dnf -y install timescaledb_17 postgresql17 postgresql17-contrib
sudo dnf -y install timescaledb-toolkit-postgresql-17
# sudo timescaledb-tune -yes --pg-config=/usr/pgsql-17/bin/pg_config
# config postgresql local connections with trust method
sudo cp pg_hba.conf /var/lib/pgsql/16/data/
sudo chown postgres:postgres /var/lib/pgsql/16/data/pg_hba.conf
sudo cp postgresql.conf /var/lib/pgsql/16/data/
sudo chown postgres:postgres /var/lib/pgsql/16/data/postgresql.conf
sudo systemctl enable postgresql-16
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
sudo cp pg_hba.conf /var/lib/pgsql/17/data/
sudo chown postgres:postgres /var/lib/pgsql/17/data/pg_hba.conf
sudo cp postgresql.conf /var/lib/pgsql/17/data/
sudo chown postgres:postgres /var/lib/pgsql/17/data/postgresql.conf
sudo systemctl enable postgresql-17
sudo /usr/pgsql-17/bin/postgresql-17-setup initdb

sudo cp json_scada_*.conf /etc/nginx/conf.d/
sudo cp nginx.conf /etc/nginx/
Expand All @@ -143,14 +144,14 @@ sudo cp grafana.ini /etc/grafana
sudo systemctl enable grafana-server

sudo -u $JS_USERNAME sh -c 'mkdir ../metabase'
sudo -u $JS_USERNAME sh -c 'wget --inet4-only https://downloads.metabase.com/v0.49.10/metabase.jar -O ../metabase/metabase.jar'
sudo -u $JS_USERNAME sh -c 'wget --inet4-only https://downloads.metabase.com/v0.52.5/metabase.jar -O ../metabase/metabase.jar'

sudo -u $JS_USERNAME sh -c 'curl -fsSL https://rpm.nodesource.com/setup_20.x -o nodesource_setup.sh'
sudo -u $JS_USERNAME sh -c 'curl -fsSL https://rpm.nodesource.com/setup_22.x -o nodesource_setup.sh'
sudo bash nodesource_setup.sh
sudo dnf -y install nodejs

sudo systemctl daemon-reload
sudo systemctl start postgresql-16
sudo systemctl start postgresql-17
sudo systemctl start mongod

psql -U postgres -w -h localhost -f ../sql/create_tables.sql template1
Expand Down
9 changes: 5 additions & 4 deletions platform-rhel9/json-scada-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ sudo dnf -y install ./potrace-devel-1.16-7.el9.$(arch).rpm

sudo update-crypto-policies --set LEGACY

wget --inet4-only https://go.dev/dl/go1.22.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz
wget --inet4-only https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
sudo -u $JS_USERNAME sh -c 'export PATH=$PATH:/usr/local/go/bin'
sudo -u $JS_USERNAME sh -c 'echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.bashrc'
source ~/.bashrc

# for mongodb
# https://www.mongodb.com/docs/manual/tutorial/transparent-huge-pages/
Expand Down Expand Up @@ -148,9 +149,9 @@ sudo cp grafana.ini /etc/grafana
sudo systemctl enable grafana-server

sudo -u $JS_USERNAME sh -c 'mkdir ../metabase'
sudo -u $JS_USERNAME sh -c 'wget --inet4-only https://downloads.metabase.com/v0.49.10/metabase.jar -O ../metabase/metabase.jar'
sudo -u $JS_USERNAME sh -c 'wget --inet4-only https://downloads.metabase.com/v0.52.5/metabase.jar -O ../metabase/metabase.jar'

sudo -u $JS_USERNAME sh -c 'curl -fsSL https://rpm.nodesource.com/setup_20.x -o nodesource_setup.sh'
sudo -u $JS_USERNAME sh -c 'curl -fsSL https://rpm.nodesource.com/setup_22.x -o nodesource_setup.sh'
sudo bash nodesource_setup.sh
sudo dnf -y install nodejs

Expand Down
5 changes: 4 additions & 1 deletion platform-rhel9/mongod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
systemLog:
destination: syslog

# Where and how to store data.
# Where and how to store data. Add more memory if you have more than 4GB of RAM.
storage:
dbPath: /var/lib/mongo
wiredTiger:
engineConfig:
cacheSizeGB: 1

# how the process runs
processManagement:
Expand Down
Loading

0 comments on commit a89bb5d

Please sign in to comment.