These prerequisites assume you're working on a 64bit Windows 10 operating system machine.
Since DEV's codebase is using the Ruby on Rails framework, we will need to install Windows Subsystem for Linux. Some dependencies used by the source code triggered errors when installing on Windows, so using WSL allows you to work on the software and not having to fix gem incompatibilities.
First, let's enable Windows Subsystem for Linux in your machine. You can do this by opening
Control Panel, going to
Programs, and then clicking
Turn Windows Features On or Off. Look for the
Windows Subsystem for Linux option and check the box next to it. Windows will ask for a reboot.
Once you've got this installed and after rebooting, install Ubuntu 18.04 on Windows.
On your first run, the system will ask for username and password. Take note of both since it will be used for
First, install Ruby language dependencies:
sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev
For installing Ruby, we recommend using rbenv:
1 2 3 4 5 6 7 8 9 10 11 12 13
cd 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/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc exec $SHELL rbenv install 2.6.3 rbenv global 2.6.3 ruby -v
To install NodeJS, we're going to add it using the official repository:
1 2 3 4
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs node -v npm -v
npm -v gives
Syntax error: word unexpected (expecting "in"), restart the terminal and try again.
And now, for rails itself:
gem install rails -v 5.2.3
rbenv rehash to make the Rails executable available. Check it out by using
rails -v command
1 2 3
rbenv rehash rails -v # Rails 5.2.3
The fastest way to install Yarn for WSL would be from Debian package repository. Configure the repository with the following commands:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Then you can simply issue:
sudo apt-get update && sudo apt-get install yarn
Make sure that Yarn is installed with
If you don't have PostgreSQL installed on your Windows system, you can do so right now. WSL is able to connect to a PostgreSQL instance on your Windows machine. DEV requires PostgreSQL version 9.4 or higher.
Download PostgreSQL for Windows and install it.
Pay attention to the username and password you setup during installation of PostgreSQL as you will use this to configure your Rails applications to login to the database later.
git clone https://github.com/<your-username>/dev.to.git
gem install bundler
Set up your environment variables/secrets
Envfile. This file lists all the
ENVvariables we use and provides a fake default for any missing keys. You'll need to get your own free Algolia credentials to get your development environment running.
For any key that you wish to enter/replace:
config/application.ymlby copying from the provided template (ie. with bash:
cp config/sample_application.yml config/application.yml). This is a personal file that is ignored in git.
GITHUB_KEY: "SOME_REAL_SECURE_KEY_HERE" GITHUB_SECRET: "ANOTHER_REAL_SECURE_KEY_HERE"
ENVvariables on bootup, the envied gem will alert you with messages similar to
'error_on_missing_variables!': The following environment variables should be set: A_MISSING_KEY..
There is a possibility that you might encounter a statement timeout when seeding the database for the first time. Please increase the value of
If the installation process failed with the following error
ERROR: Error installing pg. Please consider installing the following package
sudo apt-get install libpq-dev
If you encountered any errors that you subsequently resolved, please consider updating this section with your errors and their solutions.