* Improve format and clarity of the docs [ci skip] While this change produces a lot of git noise by enacting what seems like an arbitrary linewrap on most of the files in the documentation it will result in better version control and tracking of the changes in the documentation. For example, as it currently stands, if one was to make a PR to move a comma in a sentence because each paragraph in most of the files is on a single line, that small change would look in the git history like the author had modified the entire paragraph. In reality, this author just moved a comma. This change also includes a significant number of modifications to the more article-esque docs. Many of these docs were written in a sort of stream-of-conciousness and aren't as easy to read as they could be. Hopefully this is the first of several readability changes. If we could get these docs to a more accessible reading level, we would probably see an increase in contributions. :) * Delegate markdown wrapping to Prettier * Add linewrapping explanation in the docs [ci skip]
4.8 KiB
| title |
|---|
| Linux |
Installing DEV on Linux
Installing prerequisites
These prerequisites assume you're working on a Linux-based operating system, but they have only been tested on Ubuntu 18.04.
Ruby
- If you don't already have a Ruby version manager, we highly recommend rbenv. Please follow their installation guide.
- With the Ruby version manager, install the Ruby version listed on our badge.
(ie with rbenv:
rbenv install 2.6.5)
For very detailed rbenv installation directions on several distros, please visit DigitalOcean's guide.
Yarn
There are two ways to install Yarn.
- Yarn's official installation guide (recommended).
- DigitalOcean's detailed
tutorial
describes how to install Node version
Manager. By installing NVM you can select
a Node version (we recommend either LTS or current); the guide will also
explain how to install NPM. This way you'll have Node, NPM, and then you can
run
npm install -g yarnto install Yarn.
PostgreSQL
- Run
sudo apt update && sudo apt install postgresql postgresql-contrib libpq-dev. - To test the installation you can run
sudo -u postgres psqlwhich should open a PostgreSQL prompt. Exit the prompt by running\qthen runsudo -u postgres createuser -s $YOUR_USERNAMEwhere$YOUR_USERNAMEis the username you are currently logged in as.
There are more than one ways to setup PostgreSQL. For additional configuration, check out our PostgreSQL setup guide or the official PostgreSQL site for further information.
ImageMagick
DEV uses ImageMagick to manipulate images on upload.
Please refer to ImageMagick's instructions on how to install it.
Redis
DEV requires Redis version 4.0 or higher.
We recommend following Digital Ocean's extensive How To Install and Configure Redis on Ubuntu 16.04 (available for other Linux distributions as well) to setup Redis.
Installing DEV
-
Fork DEV's repository, e.g. https://github.com/thepracticaldev/dev.to/fork
-
Clone your forked repository, e.g.
git clone https://github.com/<your-username>/dev.to.git -
Install bundler with
gem install bundler -
Set up your environment variables/secrets
-
Take a look at
Envfile. This file lists all theENVvariables 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. -
The backend guide will show you how to get free API keys for additional services that may be required to run certain parts of the app.
-
For any key that you wish to enter/replace:
- Create
config/application.ymlby copying from the provided template (i.e. with bash:cp config/sample_application.yml config/application.yml). This is a personal file that is ignored in git. - Obtain the development variable and apply the key you wish to enter/replace. i.e.:
GITHUB_KEY: "SOME_REAL_SECURE_KEY_HERE" GITHUB_SECRET: "ANOTHER_REAL_SECURE_KEY_HERE" - Create
-
If you are missing
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.. -
You do not need "real" keys for basic development. Some features require certain keys, so you may be able to add them as you go.
-
-
Run
bin/setup
Possible error messages
While installing, you might run into an error due to the pg gem requiring
PostgreSQL libraries. If so, please run sudo apt-get install libpq-dev before
retrying.
While installing, you might run into an error due to the sass-rails gem
requiring sassc, which requires the g++ compiler. If so, please run sudo apt-get install g++ before retrying.
While installing, if you didn't install node or nvm manually, you might run
into an error due to an older system node version being present, which can cause
issues while yarn is installing packages. If so, you'll need to install
nvm and then run nvm install node to get the most recent node version before retrying.