forked from saasbook/flextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add documentation for standing up server with pg to README
- Loading branch information
1 parent
a1ef43c
commit e169d51
Showing
2 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,25 @@ | ||
dev: | ||
# These targets were made with unix in mind. If you are not on unix, feel free to update for support. | ||
-include .env | ||
.DEFAULT_GOAL = dev | ||
|
||
env: | ||
@export DB_PORT=${DB_PORT} | ||
@export DB_USER=${DB_USER} | ||
@export DB_PASSWORD=${DB_PASSWORD} | ||
@export DB_NAME=${DB_NAME} | ||
@echo 'db environment updated' | ||
|
||
dev: env | ||
@yarn run dev | ||
|
||
db-migrate: env | ||
bin/rails db:migrate | ||
|
||
db-seed: env | ||
bin/rails db:seed | ||
|
||
init: env | ||
@command -v yarn > /dev/null 2>&1 || { echo >&2 "please install yarn first"; exit 1; } | ||
bin/rails db:setup | ||
bin/rails db:migrate | ||
bin/rails db:seed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,44 @@ | ||
# flextensions | ||
Back end/API for UC Berkeley EECS "Flextensions" software | ||
|
||
[![Maintainability](https://api.codeclimate.com/v1/badges/8d99ec9a1784ddba34ac/maintainability)](https://codeclimate.com/github/cs169/flextensions/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/8d99ec9a1784ddba34ac/test_coverage)](https://codeclimate.com/github/cs169/flextensions/test_coverage) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/8d99ec9a1784ddba34ac/maintainability)](https://codeclimate.com/github/cs169/flextensions/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/8d99ec9a1784ddba34ac/test_coverage)](https://codeclimate.com/github/cs169/flextensions/test_coverage) | ||
|
||
## Installation | ||
|
||
### Environment Variables | ||
|
||
For the environment variables, you will need to configure on your local system (and any deployment machines) the following environment variables: | ||
|
||
- DB_PORT (default: 5432) | ||
- DB_USER (default: postgres) | ||
- DB_PASSWORD (default: password) | ||
- DB_NAME (default: postgres) | ||
|
||
Changing only the user and password then running `$make env` should be sufficient. | ||
|
||
### Postgres Installation | ||
|
||
#### MacOS | ||
|
||
- `brew install postgresql chromedriver` | ||
- Start postgres if necessary. `brew services start postgresql` | ||
|
||
#### Linux/WSL | ||
|
||
- `sudo apt install postgresql` | ||
- Create a postgres user. | ||
- `sudo su - postgres` (to get into postgres shell) | ||
- `createuser --interactive --pwprompt` (in postgres shell) | ||
- Save `DB_USER` and `DB_PASSWORD` fields in the `.env` file. | ||
- Start postgres if necessary. `pg_ctlcluster 12 main start` | ||
- Note: if you are using WSL2 on windows, the command to start postgres is `sudo service postgresql start` | ||
|
||
### Stand Up Server | ||
|
||
In order to stand up the server with [Overmind](https://github.com/DarthSim/overmind) in dev, run: | ||
|
||
```bash | ||
make dev | ||
``` | ||
|
||
*NOTE:* The Overmind binary is stored in `bin/overmind` and needs to be maintained manually. |