Sorry for such a newbie question. I got an answer from internet that I should just use the full path to the bundle.
> whereis bundle
bundle: /home/young/.rbenv/shims/bundle
then changed my script to:
#!/usr/bin/env bash
cd ~/softwares/discourse
/home/young/.rbenv/shims/bundle exec rails server -p 3030 2> ~/start-discourse-stderr.txt
then run the script in .profile asynchronously, start-discourse &. And it worked.
Sorry for such an unfocused question.