123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- #!/bin/bash
-
- # PB : TODO -- Prompt if not passed in.
- echo "Enter repo server URL:"
- read reposervername
- REPOSERVER=$reposervername
- echo "Enter default repo owner:"
- read defaultrepoownername
- DEFAULTREPOOWNER=$defaultrepoownername
- REPOOWNER=$DEFAULTREPOOWNER
- echo "Enter instance name"
- read instancename
- INSTANCENAME=$instancename
- echo "Enter instance type:"
- read instancetypename
- INSTANCETYPE=$instancetypename
- echo "Enter Git user name:"
- read GITUSERID
- GITUSER=$GITUSERID
- echo "Enter Git user email:"
- read GITEMAILID
- GITEMAIL=$GITEMAILID
-
- # If $GITUSER = {{"git user id"}} then set $GITUSER = $USER # TODO : pavanendar -- read from user input default as login user.
-
- #OPTIONS
- SKIPPREREQS=false
- SKIPDEVPREREQS=false
-
- 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 user.email "$GITEMAIL"
- git config --global credential.helper store
- git clone $REPOSERVER/$REPOOWNER/bbhverse
- #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
- mkdir -p /var/chess/$INSTANCENAME
- sudo chown $USER:$USER /var/chess/$INSTANCENAME
- ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE
- mkdir -p $ROOT
- sudo chown $USER:$USER $ROOT
-
- cd $ROOT
-
- git clone $REPOSERVER/$REPOOWNER/elxr.git
-
- cd elxr
- npm i
- npm link
- cd ..
-
- # Install mysql
- # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names
- # sudo debconf-set-selections < "mysql-server mysql-server/lowercase-table-names select Enabled"
-
- sudo debconf-set-selections <<EOF
- mysql-server mysql-server/lowercase-table-names select Enabled
- EOF
- sudo debconf-show mysql-server
- 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
-
-
- ##############
- ###UNINSTALL MYSQL
- #sudo apt-get remove --purge mysql*
- #sudo apt-get autoremove
- #sudo apt-get autoclean
-
-
- fi
-
- echo module.exports = { instanceName : "'$INSTANCENAME'", reposerver: "'$REPOSERVER'", gitUser: "'$GITUSER'", gitEmail:"'$GITEMAIL'" } > installchoices.js
- elxr use elixir
- elxr i
|