Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions config/native_setup_database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: localhost

development:
<<: *default
database: operationcode_development

test:
<<: *default
database: operationcode_test

production:
<<: *default
host: <%= ENV['POSTGRES_HOST'].present? ? ENV['POSTGRES_HOST'] : 'operationcode-psql-postgresql' %>
database: operationcode_production
user: opcode_superuser
password: <%= OperationCode.fetch_secret_with name: :postgres_password %>
47 changes: 47 additions & 0 deletions docs/setup/native_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Native Setup

### Git
Git is a distributed version control system. This is how our code is stored and managed. Git can be frustrating, but it is an essential tool. If you want to learn more about Git, a great resource is [Think Like a Git](http://think-like-a-git.net/). If you find yourself in a real git pickle, see ["Oh, shit, git!"](http://ohshitgit.com/). If you have already installed Git as a part of the Docker Toolbox, you don't need to install it again using the following link.

* [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

### Code Base
You are now ready for the actual **OperationCode Backend** code base.

* The common practice is to make a copy of the GitHub repository you want to work on (known as `forking` the repo), make your changes, and then request to merge those changes back into the project (known as a `pull request`).
* Forking a repo is done through GitHub's web UI. It can be found in the top right corner of the **OperationCode Backend**'s [GitHub](https://github.com/OperationCode/operationcode_backend) page.

* The following commands will pull down the source code from your forked repo.
* Make sure to replace `[YOUR-GITHUB-NAME]` with your GitHub name. (example: https://github.com/iserbit/operationcode_backend.git)

#### Local Development Environment
_Fork the repo first._
```bash
git clone https://github.com/[YOUR-GITHUB-NAME]/operationcode_backend.git operationcode-upstream
cd operationcode-upstream
git remote add upstream https://github.com/OperationCode/operationcode_backend.git
```

1. If [Bundler](https://bundler.io/) is not installed run `gem install bundler`.
2. Run `bundle install` to install all of the gems in your [Gemfile](Gemfile).
3. Download and install [PostgreSQL](https://www.postgresql.org/download/) if you don't have it already.

#### Database Setup:


1. Run `cp config/database.yml. config/native_setup_database.yml`.
2. Run `bin/rake db:create`.
3. Run `bin/rake db:migrate`.
4. Run `bin/rake db:seed` --> **This is where I am getting errors** :sweat_smile:.

### Testing
1. Run `RAILS_ENV=test rake db:test:prepare`.
2. Run `bin/rake test & rubocop`.

#### Running OperationCode Backend:
To run the OperationCode Backend simply type:
```bash
rails s
```

You can now visit http://localhost:3000 and you should see the "Yay! You're on Rails!" welcome message.