Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # PB : TODO -- Prompt if not passed in.
  2. REPOSERVER=http://git.bbh
  3. DEFAULTREPOOWNER=chess
  4. REPOOWNER=$DEFAULTREPOOWNER
  5. INSTANCENAME=elixir
  6. INSTANCETYPE=dev
  7. GITUSER=pb
  8. GITEMAIL=pradeep@bbh.org.in
  9. #OPTIONS
  10. SKIPPREREQS=true
  11. SKIPDEVPREREQS=true
  12. if [ "$SKIPPREREQS" = "true" ]; then
  13. echo "skipping prereqs for firstrun"
  14. else
  15. sudo groupadd chessprod
  16. echo "$USER"
  17. sudo usermod -a -G chessprod $USER
  18. sudo apt update
  19. # Install prerequisites for dev environment
  20. sudo apt install git
  21. git config --global user.name "$GITUSER"
  22. git config --global credential.helper store
  23. #git config --global credential.helper 'store --file ~/.git-credentials'
  24. #echo "Enter git username: "
  25. #read gitUser
  26. #git config --global user.name '${gitUser}'
  27. #echo "username=$gitUser" >> ~/.git-credentials
  28. #echo "Enter git password: "
  29. #read gitPassword
  30. #git config --global user.password '${gitPassword}'
  31. #echo "password=$gitPassword" >> ~/.git-credentials
  32. #chmod 0600 ~/.git-credentials
  33. sudo apt install python2
  34. sudo apt install build-essential
  35. sudo apt install -y make
  36. #INSTALLING NODE JS
  37. cd ~
  38. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh
  39. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  40. sleep 2
  41. touch ~/.bashrc
  42. source ~/.bashrc
  43. export NVM_DIR="$HOME/.nvm"
  44. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  45. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  46. sleep 2
  47. nvm list-remote
  48. sleep 2
  49. nvm install v16.19.1
  50. sleep 2
  51. node --version
  52. npm --version
  53. # OLD version...
  54. #sudo apt install nodejs
  55. #sudo apt install npm
  56. # For production we create a npm global per user.
  57. # npm prefix is not compatible with nvm!!!
  58. # mkdir -p ~/.user_global_node_modules/
  59. # npm config set prefix '~/.user_global_node_modules'
  60. # sudo mkdir /usr/local/lib/node_modules/
  61. # sudo chown -R root:chessprod /usr/local/lib/node_modules/
  62. # sudo chmod g+w /usr/local/lib/node_modules/
  63. # grep -qxF 'export PATH=~/.user_global_node_modules/bin:$PATH' ~/.profile || echo 'export PATH=~/.user_global_node_modules/bin:$PATH' >> ~/.profile
  64. if [ "$SKIPPREREQS" = "true" ]; then
  65. echo "skipping dev prereqs for firstrun"
  66. else
  67. #install code
  68. sudo apt-get install wget gpg
  69. wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
  70. sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
  71. 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'
  72. rm -f packages.microsoft.gpg
  73. sudo apt install apt-transport-https
  74. sudo apt update
  75. sudo apt install code
  76. install code
  77. sudo apt-get install wget gpg
  78. wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
  79. sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
  80. 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'
  81. rm -f packages.microsoft.gpg
  82. sudo apt install apt-transport-https
  83. sudo apt update
  84. sudo apt install code
  85. fi
  86. sudo mkdir -p /var/chess
  87. sudo chown $USER:$USER /var/chess
  88. ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE
  89. echo $ROOT
  90. sudo mkdir -p $ROOT
  91. cd $ROOT
  92. git clone $REPOSERVER/$REPOOWNER/elxr.git
  93. cd elxr
  94. npm i
  95. npm link
  96. cd ..
  97. # Install mysql
  98. # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names
  99. sudo debconf-set-selections <<< "mysql-server mysql-server/lowercase-table-names select Enabled"
  100. #sudo apt install mysql-server -y
  101. systemctl is-active mysql
  102. #sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mysql#minA1';"
  103. #sudo mysql_secure_installation
  104. #sudo mysql -e "FLUSH PRIVILEGES;" -u root -pmysql#minA1
  105. #systemctl status mysql.service
  106. # Init DB schema and Load Data
  107. #mysql -u root -pmysql#minA1 < cihsr-data/cihsr-dev-schema.sql
  108. ##############
  109. ###UNINSTALL MYSQL
  110. #sudo apt-get remove --purge mysql*
  111. #sudo apt-get autoremove
  112. #sudo apt-get autoclean
  113. fi
  114. echo module.exports = { instanceName : "'$INSTANCENAME'", reposerver: "'$REPOSERVER'", gitUser: "'$GITUSER'", gitEmail:"'$GITEMAIL'" } > installchoices.js
  115. elxr use elixir
  116. elxr i