Windows Setup - brownfield-team/anacapa-github-linker GitHub Wiki
Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
Configure Git
To configure git for Unix style line endings, do this:
git config --global core.autocrlf true
git config --global user.email "[email protected]"
git config --global user.name "Your name"
Installing RVM
Instructions say to use gpg2, but plain gpg seems to be already installed on WSL.
gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Next Command:
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
\curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
Then:
- If you've already cloned the directory with the repo, find the directory where the source repository has been cloned, and cd into the directory.
- Otherwise, use
cd
to your home directory for WSL and then do:
Thengit clone [email protected]:brownfield-team/anacapa-github-linker.git
cd anacapa-github-linker
You should see a message like this:
rvm install ruby-2.7.3
Next, use:
gem install bundler
Followed by:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Next, install yarn:
curl -o- -L https://yarnpkg.com/install.sh | bash
Followed by installing rails:
sudo apt-get install libpq-dev
gem install pg -v '1.2.3' --source 'https://rubygems.org/'
bundle install
And installing postgress:
sudo apt-get install postgresql
It it is successful, you should see a line of output like this:
Success! You can now start the database server using:
[there will be some command here]
It may vary from system to system. Here are a few examples:
- Example 1:
pg_ctlcluster 12 main start
- Example 2:
usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
Copy this command and save it somewhere, but don't type it in yet. We may need to do a few other things first. (And truth be told, we may not need this command at all.)
Try this:
sudo service postgresql start
Then, try:
psql -d postgres
If this throws the error psql: error: FATAL: role "username" does not exist
, try:
sudo -u postgres psql
This should give you a postgres prompt, something like this:
psql (14.3, server 12.3)
Type "help" for help.
postgres=#
At the prompt, we are going to disable the password for the postgres
user:
postgres=# \password postgres
Then, it will prompt you to enter a new password. Choose the password postgres
(literally, postgres
as both username and password).
Next, we need to locate the configuration file for postgres security. To do that, we can type:
SHOW hba_file;
This will give you a file name, which you will need to edit as the root user. So, for example, if the filename given is /Users/pconrad/Library/Application Support/Postgres/var-12/pg_hba.conf
sudo bash
vim /Users/pconrad/Library/Application Support/Postgres/var-12/pg_hba.conf
In this file, find this line (likely the first uncommented line):
local all postgres peer
And change peer
to md5
:
local all postgres md5
Then, we restart postgres:
sudo service postgresql restart
Then, see whether we can login using the postgres
user with no password on localhost:
psql -U postgres -W
What should happen here is that if you use postgres
as the password, it works, and if you use anything else, it should not. If that happens, then you probably have things configured correctly, and you can move to the next step.
If that gives you an error, then it's likely that the rails app isn't going to be able to connect to the database.
But if it works, then you can just use \q
to exit postgres, and then you can try the next few steps.
Finally:
yarn install
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
rails s
This should give you a webpage on http://localhost:3000 with a login button, but the login button will not work yet. The next step is to configure OAuth.