Skip to content

Commit

Permalink
pull latest main branch, resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzz212zzZ committed Feb 21, 2024
2 parents 801abcd + 2d1f2d0 commit 7d3b404
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 28 deletions.
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ gem "rails", "~> 7.1.3"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"
# Use postgres for all env dbs
gem "pg"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
Expand Down Expand Up @@ -85,4 +85,3 @@ group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end

13 changes: 3 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ GEM
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.2)
msgpack (1.7.2)
multi_test (1.1.0)
Expand Down Expand Up @@ -239,6 +238,8 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
pg (1.5.5)
pg (1.5.5-x86-mingw32)
popper_js (2.11.8)
pry (0.14.2)
coderay (~> 1.1)
Expand Down Expand Up @@ -339,14 +340,6 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.7.2)
mini_portile2 (~> 2.8.0)
sqlite3 (1.7.2-aarch64-linux)
sqlite3 (1.7.2-arm-linux)
sqlite3 (1.7.2-arm64-darwin)
sqlite3 (1.7.2-x86-linux)
sqlite3 (1.7.2-x86_64-darwin)
sqlite3 (1.7.2-x86_64-linux)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
Expand Down Expand Up @@ -398,13 +391,13 @@ DEPENDENCIES
jbuilder
jquery-rails
lms-api
pg
puma (>= 5.0)
rails (~> 7.1.3)
rspec-rails
sassc-rails (~> 2.1)
simplecov
sprockets-rails
sqlite3 (~> 1.4)
stimulus-rails
turbo-rails
tzinfo-data
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
@command -v overmind > /dev/null 2>&1 || { echo >&2 "please install overmind first"; exit 1; }
@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
1 change: 1 addition & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec rails s -p 3000
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
# flextensions
# 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 (recommended through a `.env` file at root):

- 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 you must first install [Overmind](https://github.com/DarthSim/overmind).
Development has been tested with overmind 2.4.0

With Overmind, you can run `$make dev` or `$make`
32 changes: 20 additions & 12 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# SQLite. Versions 3.8.0 and up are supported.
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem "sqlite3"
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
adapter: postgresql
pool: 5
timeout: 5000
host: localhost
port: <%= ENV['DB_PORT'] || '5432' %>
username: <%= ENV['DB_USER'] || ENV['USER'] || 'postgres' %>
password: <%= ENV['DB_PASSWORD'] || 'password' %>
database: <%= ENV['DB_NAME'] || 'postgres' %>

development:
<<: *default
database: storage/development.sqlite3
database: flextentions_dev

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: storage/test.sqlite3
database: flextentions_test

staging:
adapter: postgresql
pool: 5
timeout: 5000
database: flextentions_stage

# MAKE SURE THE ENVIRONMENT CONFIG IS SET UP FOR PROD
production:
<<: *default
database: storage/production.sqlite3
adapter: postgresql
pool: 5
timeout: 5000
database: flextentions_prod
5 changes: 4 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_02_20_081032) do
ActiveRecord::Schema[7.1].define(version: 0) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

end
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "flextensions",
"version": "1.0.0",
"description": "Back end/API for UC Berkeley EECS \"Flextensions\" software",
"directories": {
"lib": "lib"
},
"scripts": {
"dev": "overmind s -f Procfile.dev"
},
"author": "CS169l flextentions development team",
"license": "BSD-2-Clause"
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit 7d3b404

Please sign in to comment.