Skip to content
Snippets Groups Projects

smart-report-install.sh

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Karn Tirasoontorn
    Edited
    snippetfile1.txt 1.71 KiB
    #!/bin/bash
    
    dependencies() {
      sudo apt update
      version=`lsb_release -r -s`
      if [ $version == "20.04" ]; then
        apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libpq-dev redis-server python2.7 git shared-mime-info
      elif [ $version == "18.04" ]; then
        sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev libpq-dev redis-server python2.7 git shared-mime-info
      else
        sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev libpq-dev redis-server python2.7 git shared-mime-info
      fi
    }
    
    # Install dependencies
    dependencies
    # Install nodejs
    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt install -y nodejs
    
    # Install rbenv
    git clone https://github.com/rbenv/rbenv.git ~/.rbenv
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    eval 'source ~/.bashrc'
    
    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
    
    git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
    rbenv install 2.7.2
    rbenv global 2.7.2
    # gem install rails
    
    git clone http://karn:5zhczoyhxG-xzXcy8C2M@gitlab.opensource-technology.com/karn/smart_report.git
    cd smart_report
    gem update --system
    bundle update --bundler
    bundle install
    cp config/example.app.env config/app.env
    export $(cat config/app.env |xargs)
    rails app:prepare
    rails deploy:make_key
    rails deploy:systemd
    rails deploy:sidekiq_systemd
    
    npm install
    sudo npm install pm2 -g
    pm2 start index.js --name dbf
    pm2 startup
    pm2 save
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment