Browse Source

Merge branch 'master' of https://git.bbh.org.in/chess/elxr

pull/15/head
pb 1 year ago
parent
commit
ddd854a332

+ 119
- 23
i.lin.sh View File

sudo apt update


# Install prerequisites for dev environment
# PB : TODO -- Prompt if not passed in.
REPOSERVER=http://git.bbh
DEFAULTREPOOWNER=chess
REPOOWNER=$DEFAULTREPOOWNER
INSTANCENAME=elixir
INSTANCETYPE=dev
GITUSER=pb
GITEMAIL=pradeep@bbh.org.in


sudo apt install python2
sudo apt install build-essential
sudo apt install -y make
sudo apt install nodejs
sudo apt install npm
sudo apt install git
--
git clone http://git.bbh.org.in/chess/elxr.git
cd elxr
elxr use elixir
cd ..
elxr i


# Install mysql
sudo apt install mysql-server -y
systemctl is-active mysql
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mysql#minA1';"
sudo mysql_secure_installation
sudo mysql -e "FLUSH PRIVILEGES;" -u root -pmysql#minA1
systemctl status mysql.service
#OPTIONS
SKIPPREREQS=true
SKIPDEVPREREQS=true


# Init DB schema and Load Data
mysql -u root -pmysql#minA1 < cihsr-data/cihsr-dev-schema.sql
if [ "$SKIPPREREQS" = "true" ]; then
echo "skipping prereqs for firstrun"
else


sudo groupadd chessprod


echo "$USER"
sudo usermod -a -G chessprod $USER


sudo apt update


# Install prerequisites for dev environment
sudo apt install git
git config --global user.name "$GITUSER"
git config --global credential.helper store
#git config --global credential.helper 'store --file ~/.git-credentials'
#echo "Enter git username: "
#read gitUser
#git config --global user.name '${gitUser}'
#echo "username=$gitUser" >> ~/.git-credentials
#echo "Enter git password: "
#read gitPassword
#git config --global user.password '${gitPassword}'
#echo "password=$gitPassword" >> ~/.git-credentials
#chmod 0600 ~/.git-credentials

sudo apt install python2
sudo apt install build-essential
sudo apt install -y make

#INSTALLING NODE JS
cd ~
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
sleep 2
touch ~/.bashrc
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
sleep 2
nvm list-remote
sleep 2
nvm install v16.19.1
sleep 2
node --version
npm --version

# OLD version...
#sudo apt install nodejs
#sudo apt install npm
# For production we create a npm global per user.
# npm prefix is not compatible with nvm!!!
# mkdir -p ~/.user_global_node_modules/
# npm config set prefix '~/.user_global_node_modules'
# sudo mkdir /usr/local/lib/node_modules/
# sudo chown -R root:chessprod /usr/local/lib/node_modules/
# sudo chmod g+w /usr/local/lib/node_modules/
# grep -qxF 'export PATH=~/.user_global_node_modules/bin:$PATH' ~/.profile || echo 'export PATH=~/.user_global_node_modules/bin:$PATH' >> ~/.profile

if [ "$SKIPPREREQS" = "true" ]; then
echo "skipping dev prereqs for firstrun"
else
#install code
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
sudo apt update
sudo apt install code
install code
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
sudo apt update
sudo apt install code
fi

sudo mkdir -p /var/chess
sudo chown $USER:$USER /var/chess
ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE
echo $ROOT
sudo mkdir -p $ROOT
cd $ROOT

git clone $REPOSERVER/$REPOOWNER/elxr.git

cd elxr
npm i
npm link
cd ..

# Install mysql
#sudo apt install mysql-server -y
systemctl is-active mysql
#sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mysql#minA1';"
#sudo mysql_secure_installation
#sudo mysql -e "FLUSH PRIVILEGES;" -u root -pmysql#minA1
#systemctl status mysql.service

# Init DB schema and Load Data
#mysql -u root -pmysql#minA1 < cihsr-data/cihsr-dev-schema.sql
fi

echo module.exports = { instanceName : "'$INSTANCENAME'", reposerver: "'$REPOSERVER'", gitUser: "'$GITUSER'", gitEmail:"'$GITEMAIL'" } > installchoices.js
elxr use elixir
elxr i



+ 8
- 8
index.js View File

// PB : TODO -- pick up remote definitions per repository... // PB : TODO -- pick up remote definitions per repository...
var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo , {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo
, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver } , node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver }
)) ))
try { try {
// PB : TODO -- pick up remote definitions per repository... // PB : TODO -- pick up remote definitions per repository...
return utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } return utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, {}, require(path.normalize( mpath + '/repo-manifest'))( null, moverrides ))
, {}, require(path.normalize( mpath + '/repo-manifest'))( {utils}, null, moverrides ))
} }
catch(e){ catch(e){
// Also attepmt to load preconfig specially for new chessinstances from ../chess-config/... // Also attepmt to load preconfig specially for new chessinstances from ../chess-config/...
var __repo_manifest_elxr = loadmanifest( instance.root + '/elxr' var __repo_manifest_elxr = loadmanifest( instance.root + '/elxr'
, { utils, username : instance.username /** ??? TODO */ , instanceName : instance.instanceName /** ??? TODO */
, { username : instance.username /** ??? TODO */ , instanceName : instance.instanceName /** ??? TODO */
, node_env : clioverrides.node_env, reposerver : instance.reposerver /** ??? TODO */ } // options , node_env : clioverrides.node_env, reposerver : instance.reposerver /** ??? TODO */ } // options
) )
if(instance_specific_config_manifest.error) console.log(instance_specific_config_manifest.e.message) if(instance_specific_config_manifest.error) console.log(instance_specific_config_manifest.e.message)
delete __repo_manifest_elxr.error delete __repo_manifest_elxr.error
delete __repo_manifest_elxr.e delete __repo_manifest_elxr.e
delete __repo_manifest_elxr.utils
// delete __repo_manifest_elxr.utils
delete instance_specific_config_manifest.error delete instance_specific_config_manifest.error
delete instance_specific_config_manifest.e delete instance_specific_config_manifest.e
delete instance_specific_config_manifest.utils
// delete instance_specific_config_manifest.utils
// selectedinstance is not complete until we load in the following order of priority... // selectedinstance is not complete until we load in the following order of priority...
// 1) inline defaults // 1) inline defaults
// PB : TODO -- pick up remote definitions per repository... // PB : TODO -- pick up remote definitions per repository...
var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo , {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo
, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver } , node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver }
)) ))


statuslog.statuslog(e, e) statuslog.statuslog(e, e)
var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest'); var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest');
utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, selectedinstance, require(manifestpath)( null, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, selectedinstance, require(manifestpath)( {utils}, null, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : 'https://git.bbh.org.in' } )) , node_env : selectedinstance.node_env, reposerver : 'https://git.bbh.org.in' } ))
console.dir(selectedinstance.repos) console.dir(selectedinstance.repos)
// Config from server always override merges into selection except for the current selection. // Config from server always override merges into selection except for the current selection.


var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest'); var manifestpath = path.normalize(selected.root + '/' + selected.instanceName + '-config-' + selected.node_env + '/repo-manifest');
utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, selectedinstance, require(manifestpath)( null, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName
, selectedinstance, require(manifestpath)( {utils}, null, { username : selectedinstance.username, instanceName : selectedinstance.instanceName
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver })) , node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver }))
console.dir(selectedinstance.repos) console.dir(selectedinstance.repos)
// Config from server always override merges into selection except for the current selection. // Config from server always override merges into selection except for the current selection.

+ 3
- 0
lin_verse.js View File

, runElevatedBatch( batchToRun ){ , runElevatedBatch( batchToRun ){
// In windows we don't need to run each task. We hand over to another shell which in elevated state rebuilds the whole batch and runs. // In windows we don't need to run each task. We hand over to another shell which in elevated state rebuilds the whole batch and runs.
// Irrespective of the batch we just call runElevated once. // Irrespective of the batch we just call runElevated once.
batchToRun.forEach(element => {
element.processedArgs = batchToRun[0].processedArgs
});
return any(batchToRun.map(shell_verse.runElevated)) return any(batchToRun.map(shell_verse.runElevated))
} }



+ 267
- 0
linux_setup.sh View File

# wget https://git.bbh.org.in/chess/elxr/raw/branch/master/linux_setup.sh

#STORE GIT CREDENTIALS IN CACHE
sudo yum install git
# git config --global --unset credential.helper
git config --global credential.helper store
# git config --global credential.helper 'store --file ~/.git-credentials'
# echo "Enter git username: "
# read gitUser
# echo "username=$gitUser" >> ~/.git-credentials
# echo "Enter git password: "
# read gitPassword
# echo "password=$gitPassword" >> ~/.git-credentials
# chmod 0600 ~/.git-credentials

# Install prerequisites
#NODE JS 16.17.1
wget https://nodejs.org/dist/v16.17.1/node-v16.17.1-linux-x64.tar.xz
tar -xf node-v16.17.1-linux-x64.tar.xz
# Move the extracted folder to /usr/local/lib
sudo mv node-v16.17.1-linux-x64 /usr/local/lib/
# Create a symbolic link to the node executable
sudo ln -s /usr/local/lib/node-v16.17.1-linux-x64/bin/node /usr/local/bin/node
node -v

#NPM
sudo yum install npm


#INSTALLING NODE JS
npm install -g pm2
npm install -g ember-cli
npm install -g loopback-cli

#development A SETUP
cd ~
cd Desktop
mkdir chess
cd chess
mkdir development_A
cd development_A


git clone http://git.bbh.org.in/chess/cihsr-config-development
cd cihsr-config-development
git checkout master
npm i --force

#TO CREATE SYMLINK
cd ..
ln -s cihsr-config-development/ config

git clone http://git.bbh.org.in/chess/cihsr-data
cd cihsr-data
git checkout master
npm i --force

cd ..
ln -s cihsr-data/ data

git clone http://git.bbh.org.in/chess/ember-masonry-grid
cd ember-masonry-grid
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/bbhverse
cd bbhverse
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/clientverse
cd clientverse
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/serververse
cd serververse
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/elxr
cd elxr
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-searchable-select
cd ember-searchable-select
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-component-jsonapi
cd loopback-component-jsonapi
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-jsonapi-model-serializer
cd loopback-jsonapi-model-serializer
git checkout master
npm i --force
npm run build

cd ..
git clone http://git.bbh.org.in/chess/loopback-connector-mysql
cd loopback-connector-mysql
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-connector-ds
cd loopback-connector-ds
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/setup
cd setup
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-service-worker
cd ember-service-worker
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-service-worker-asset-cache
cd ember-service-worker-asset-cache
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-service-worker-cache-fallback
cd ember-service-worker-cache-fallback
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-service-worker-index
cd ember-service-worker-index
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-sw-client-route
cd ember-sw-client-route
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/global-this
cd global-this
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/ember-cp-validations
cd ember-cp-validations
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-connector
cd loopback-connector
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback
cd loopback
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-datasource-juggler
cd loopback-datasource-juggler
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-connector-mssql
cd loopback-connector-mssql
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-filters
cd loopback-filters
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/loopback-connector-sqlite3
cd loopback-connector-sqlite3
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/chess-server-lib
cd chess-server-lib
git checkout master
npm i --force

cd server
npm i --force
cd ..

cd ..
git clone http://git.bbh.org.in/chess/cihsr-server
cd cihsr-server
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/bbh_patient_portal
cd bbh_patient_portal
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/project-genesis-frontend
cd project-genesis-frontend
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/project-genesis-backend
cd project-genesis-backend
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/processmanager
cd processmanager
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/client
cd client
git checkout master
npm i --force
bower install
node_modules/.bin/bower install

cd ..
git clone http://git.bbh.org.in/chess/chess-client-lib
cd chess-client-lib
git checkout master
npm i --force

cd ..
git clone http://git.bbh.org.in/chess/elixir-client
cd elixir-client
git checkout master
npm i --force

cd chess-client-lib
npm i --force
cd ..

+ 4
- 2
repo-manifest.js View File

module.exports = ((name, options)=>{
module.exports = ((meta, options)=>{


var name = meta.name
const utils = meta.utils
options = options || { username : `guest`, reposerver : `https://git.bbh.org.in`, password : `noneforguest` } options = options || { username : `guest`, reposerver : `https://git.bbh.org.in`, password : `noneforguest` }
utils = options.utils


// Default set of users in main repos. // Default set of users in main repos.
var users = [ var users = [

+ 255
- 0
setup.sh View File


#STORE GIT CREDENTIALS IN CACHE
sudo apt install git
git config --global credential.helper store
git config --global credential.helper 'store --file ~/.git-credentials'
echo "Enter git username: "
read gitUser
echo "username=$gitUser" >> ~/.git-credentials
echo "Enter git password: "
read gitPassword
echo "password=$gitPassword" >> ~/.git-credentials
chmod 0600 ~/.git-credentials

sudo apt update

# Install prerequisites for dev environment
sudo apt install python2
# sudo apt install build-essential
# sudo apt install -y make
sudo apt install nodejs
sudo apt install npm


#INSTALLING NODE JS
npm install -g pm2
npm install -g ember-cli

#PRODUCTION A SETUP
cd ~
cd Desktop
mkdir chess
cd chess
mkdir production_A
cd production_A


git clone https://git.bbh.org.in/chess/ember-masonry-grid
cd ember-masonry-grid
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/bbhverse
cd bbhverse
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/clientverse
cd clientverse
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/serververse
cd serververse
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/client
cd client
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/elxr
cd elxr
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-searchable-select
cd ember-searchable-select
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-component-jsonapi
cd loopback-component-jsonapi
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-jsonapi-model-serializer
cd loopback-jsonapi-model-serializer
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-connector-mysql
cd loopback-connector-mysql
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/cihsr-config-development
cd cihsr-config-development
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/cihsr-config-production
cd cihsr-config-production
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/cihsr-data
cd cihsr-data
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-connector-ds
cd loopback-connector-ds
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/chess-server-lib
cd chess-server-lib
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/setup
cd setup
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/elixir-client-todos
cd elixir-client-todos
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-service-worker
cd ember-service-worker
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-service-worker-asset-cache
cd ember-service-worker-asset-cache
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-service-worker-cache-fallback
cd ember-service-worker-cache-fallback
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-service-worker-index
cd ember-service-worker-index
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-sw-client-route
cd ember-sw-client-route
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/global-this
cd global-this
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/ember-cp-validations
cd ember-cp-validations
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/chess-client-lib
cd chess-client-lib
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-connector
cd loopback-connector
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback
cd loopback
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-datasource-juggler
cd loopback-datasource-juggler
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-connector-mssql
cd loopback-connector-mssql
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-filters
cd loopback-filters
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/loopback-connector-sqlite3
cd loopback-connector-sqlite3
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/Trias-Elixir_Hybrid
cd Trias-Elixir_Hybrid
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/bbh_patient_portal
cd bbh_patient_portal
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/project-genesis-frontend
cd project-genesis-frontend
git checkout production
npm i

cd ..
git clone https://git.bbh.org.in/chess/project-genesis-backend
cd project-genesis-backend
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/processmanager
cd processmanager
git checkout production
npm i

#TO CREATE SYMLINK
cd ..
ln -s cihsr-config-production/ config


+ 16
- 0
trias/Database/mysql_backup.sh View File

#!/bin/bash

# Set the database credentials
DB_USER="root"
DB_PASS="root@123"
DB_NAME="triq_demo"

# Set the backup directory
BACKUP_DIR="/mysql_backup"

# Set the backup filename format
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
FILENAME="${DB_NAME}_${DATE}"

# Create the backup
mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$FILENAME

+ 29
- 0
trias/Database/mysql_restore.sh View File

# Set the database credentials
sudo apt-get update
sudo apt-get -y install cifs-utils
cd /
mkdir mysql_backup
sleep 2

sudo chmod 777 mysql_backup
sleep 2

sudo mount //10.10.5.26/trias /mysql_backup/ -o username='baptist',password='2021Bbh',domain='bbh'
sleep 2

cd /mysql_backup/
ls

DB_USER="root"
DB_PASS="root@123"
DB_NAME="triq_demo"

# Set the backup directory
echo "Enter the name of backup file: "
read fileName
BACKUP_FILE="/mysql_backup/$fileName"

mysql -u $DB_USER -p$DB_PASS -e "CREATE database triq_demo;"

# Restore backup file
mysql -u $DB_USER -p$DB_PASS $DB_NAME < $BACKUP_FILE

+ 19
- 0
trias/Server/trias_app_update.sh View File

#SCRIPT TO PULL LATEST UPDATES AUTOMATICALLY
git config --global credential.helper store

cd ../project-genesis-backend
git pull

cd ../project-genesis-frontend
git pull

cd ../bbh_patient_portal
git pull

cd ../trias-config-production
git pull

cd ../processmanager
git pull

pm2 reload all

+ 113
- 0
trias/Server/trias_appserver_script.sh View File

#INSTALLING NODE JS
cd ~
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
sleep 2
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
sleep 2
nvm list-remote
sleep 2
nvm install v16.19.1
sleep 2
node --version
npm --version
npm install -g @angular/cli
npm install -g pm2
# echo "Enter the version of node you want to install: (Example. 'v16.19.1')"
# read nodeversion
# nvm install $nodeversion

#STORE GIT CREDENTIALS IN CACHE
git config --global credential.helper store
# git config --global credential.helper 'store --file ~/.git-credentials'
# echo "Enter git username: "
# read gitUser
# git config --global user.name '${gitUser}'
# echo "username=$gitUser" >> ~/.git-credentials
# echo "Enter git password: "
# read gitPassword
# git config --global user.password '${gitPassword}'
# echo "password=$gitPassword" >> ~/.git-credentials
# chmod 0600 ~/.git-credentials

#PRODUCTION A SETUP
cd ~
cd Desktop
mkdir chess
cd chess
mkdir production_A
cd production_A
git clone http://git.bbh.org.in/chess/project-genesis-backend
cd project-genesis-backend
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/project-genesis-frontend
cd project-genesis-frontend
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/bbh_patient_portal
cd bbh_patient_portal
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/Trias_Org/trias-config-production
cd trias-config-production
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/processmanager
cd processmanager
git checkout production
npm i

#TO CREATE SYMLINK
cd ..
ln -s trias-config-production/ config

#PRODUCTION B SETUP
cd ~
cd Desktop
cd chess
mkdir production_B
cd production_B
git clone http://git.bbh.org.in/chess/project-genesis-backend
cd project-genesis-backend
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/project-genesis-frontend
cd project-genesis-frontend
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/bbh_patient_portal
cd bbh_patient_portal
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/Trias_Org/trias-config-production
cd trias-config-production
git checkout production
npm i

cd ..
git clone http://git.bbh.org.in/chess/processmanager
cd processmanager
git checkout production
npm i

#TO CREATE SYMLINK
cd ..
ln -s trias-config-production/ config

+ 38
- 0
trias/Server/trias_dbserver_script.sh View File

#MYSQL SERVER INSTALLATION
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql.service

sleep 2

cd /
sudo mkdir mysql_backup

#STEPS FOR MYSQL_SECURE_INSTALLATION
#STEP-1 sudo mysql
#STEP-2 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SET_PASSWORD';
#STEP-3 exit;
#STEP-4 sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
#STEP-5 sudo systemctl restart mysql
#STEP-6 mysql -u root -p
#STEP-7 ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket; AND FOLLOW THE STEPS
#STEP-8 exit;
#STEP-9 sudo mysql_secure_installation;
#STEP-10 sudo mysql;
#STEP-11 mysql -u root -p
#STEP-12 "ENTER MYSQL PASSWORD THAT WAS SET IN STEP 2"
#STEP-13 CREATE USER '_username_'@'_desiredIP_' IDENTIFIED WITH mysql_native_password BY 'password';
#STEP-14 GRANT ALL PRIVILEGES ON *.* TO '_username_'@'_desiredIP_' WITH GRANT OPTION;
#STEP-15 FLUSH PRIVILEGES;

echo "Please enter password for mysql: "
read password
sudo mysql -u root -p${password} -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${password}';"
sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl restart mysql
echo "Please enter the IP address of app server: "
read IP
sudo mysql -u root -p${password} -e "CREATE USER 'root'@'${IP}' IDENTIFIED WITH mysql_native_password BY '${password}';";
sudo mysql -u root -p${password} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'${IP}' WITH GRANT OPTION;"
sudo mysql -u root -p${password} -e "FLUSH PRIVILEGES;"


Loading…
Cancel
Save