discourse/docs/DEVELOPER-ADVANCED.md

Failed to ignore revisions in .git-blame-ignore-revs.

84 lines
3.0 KiB
Markdown
Raw Normal View History

# Discourse Advanced Developer Install Guide
2018-04-04 16:04:31 -04:00
This guide is aimed at advanced Rails developers who have installed their own Rails apps before.
Note: If you are developing on a Mac, you will probably want to look at [these instructions](DEVELOPMENT-OSX-NATIVE.md) as well.
2016-06-01 14:42:05 -04:00
# Preparing a fresh Ubuntu install
2018-10-01 00:28:16 -04:00
To get your Ubuntu 16.04 or 18.04 LTS install up and running to develop Discourse and Discourse plugins follow the commands below. We assume an English install of Ubuntu.
2016-06-01 14:42:05 -04:00
# Basics
whoami > /tmp/username
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get -yqq update
sudo apt-get -yqq install python-software-properties vim curl expect debconf-utils git-core build-essential zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev libpcre3 libpcre3-dev imagemagick redis-server advancecomp gifsicle jhead jpegoptim libjpeg-turbo-progs optipng pngcrush pngquant gnupg2
2016-06-01 14:42:05 -04:00
# Ruby
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
curl -sSL https://get.rvm.io | bash -s stable
2016-06-01 14:42:05 -04:00
echo 'gem: --no-document' >> ~/.gemrc
# exit the terminal and open it again to activate RVM
rvm install 2.6.2
rvm --default use 2.6.2 # If this error out check https://rvm.io/integration/gnome-terminal
gem install bundler mailcatcher rake
2016-06-01 14:42:05 -04:00
# Download and install postgresql-10 from https://wiki.postgresql.org/wiki/Apt
2016-06-01 14:42:05 -04:00
# Postgresql
sudo -u postgres -i
createuser --superuser -Upostgres $(cat /tmp/username)
2016-06-01 14:42:05 -04:00
psql -c "ALTER USER $(cat /tmp/username) WITH PASSWORD 'password';"
exit
2016-06-01 14:42:05 -04:00
# Node
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# exit the terminal and open it again to activate NVM
nvm install node
nvm alias default node
npm install -g svgo
2014-06-03 19:18:32 -04:00
2016-06-01 14:42:05 -04:00
If everything goes alright, let's clone Discourse and start hacking:
2014-06-03 19:18:32 -04:00
2016-06-01 14:42:05 -04:00
git clone https://github.com/discourse/discourse.git ~/discourse
cd ~/discourse
bundle install
# run this if there was a pre-existing database
bundle exec rake db:drop
RAILS_ENV=test bundle exec rake db:drop
# time to create the database and run migrations
bundle exec rake db:create
bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate
# run the specs (optional)
bundle exec rake autospec # CTRL + C to stop
# launch discourse
bundle exec rails s -b 0.0.0.0 # open browser on http://localhost:3000 and you should see Discourse
2013-03-24 23:49:22 -04:00
Create an admin account with:
bundle exec rake admin:create
If you ever need to recreate your database:
bundle exec rake db:drop db:create db:migrate
bundle exec rake admin:create
RAILS_ENV=test bundle exec rake db:drop db:create db:migrate
2016-06-01 14:42:05 -04:00
Discourse does a lot of stuff async, so it's better to run sidekiq even on development mode:
2013-03-24 23:49:22 -04:00
mailcatcher # open http://localhost:1080 to see the emails, stop with pkill -f mailcatcher
bundle exec sidekiq # open http://localhost:3000/sidekiq to see queues
2016-06-01 14:42:05 -04:00
bundle exec rails server
2013-03-24 23:49:22 -04:00
2016-06-01 14:42:05 -04:00
And happy hacking!