Skip to content

Kagoku/backend

 
 

Repository files navigation

vscode logo

Devsnest's Backend

workflow

Uses:

Ruby MySQL Rails

Installation

If you don't have build tools installed (gcc, make etc) install them.

$ sudo apt install build-essential

Install ruby using rbenv.

$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc

$ exec $SHELL

$ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

$ rbenv install 2.7.2

$ rbenv global 2.7.2

$ ruby -v

Install bundle and rails

# Arch users can skip first command
$ sudo apt-get install -y libreadline-dev zlib1g-dev

$ gem install bundler

$ gem install rails

$ rbenv rehash

$ rails -v

Install MySQL

Ubuntu

$ sudo apt install mysql-server

$ sudo /etc/init.d/mysql start
# check this issue if it gives error
# https://github.com/wslutilities/wslu/issues/101

$ sudo mysql_secure_installation

Arch

$ sudo pacman -S mariadb

$ sudo /etc/init.d/mysql start
# If you get an error run next 2 commands otherwise skip

$ sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

$ sudo systemctl start mysqld

$ sudo mysql_secure_installation

ALWAYS use a password containing uppercase, lowercase, and special characters or else MySQL will give error (eg. Test@1234)

Setup

Clone the repository.

$ git clone git@github.com:devs-nest/backend.git

$ cd backend/devsnest

Setup .env file and run.

$ bundle install

$ bundle exec rake db:create db:migrate db:seed

$ rails s -p 8000

Common Errors

If you get a MySQL error during bundle install

$ sudo apt-get install libmysql-ruby libmysqlclient-dev

If you are on WSL, you might get a Network Error while doing auth with discord, it is likely that IPv6 is causing it so disable it

Environment Variables

KEY VALUE
MYSQL_NAME Database Name
MYSQL_USERNAME Username for MySQL
MYSQL_PASSWORD Password for MySQL
MYSQL_HOST Hostname for MySQL
AWS_SECRET_KEY
DEVISE_JWT_SECRET_KEY
DISCORD_TOKEN
SENTRY_DSN
RAILS_ENV Type of rails environment
SECRET_KEY_BASE
DISCORD_CLIENT_ID Client id of discord bot
DISCORD_CLIENT_SECRET Client secret of discord bot
FRONTEND_URL Frontend url
DISCORD_REDIRECT_URI URL to redirect to after discord login
NEW_RELIC_KEY Key for New Relic

Resources

POSTMAN Collection link

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 99.8%
  • Other 0.2%