Skip to content

UW Soil Science ag weather and modeling Rails app

Notifications You must be signed in to change notification settings

uwent/soils-ag-wx

Repository files navigation

AgWeather/Soils website

CircleCI

This codebase generates the agweather website which serves in part as a frontend for the agweather backend API.

Dependencies

Ruby

# install rbenv
sudo apt -y install rbenv

# install ruby-build
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

# or update ruby-build if already installed
git -C "$(rbenv root)"/plugins/ruby-build pull

# may need to force git to use https
# per https://stackoverflow.com/questions/70663523/the-unauthenticated-git-protocol-on-port-9418-is-no-longer-supported
git config --global url."https://github.com/".insteadOf git://github.com/

# install ruby with rbenv
rbenv install 3.3.6 # or latest version

# update bundler to latest
gem install bundler

# update gems...
bundle update

# OR if migrating to a new version of Ruby...
rm Gemfile.lock
bundle install

When upgrading Ruby versions, need to change the version number in the documentation above, in .ruby-version, and in config/deploy.rb.

Rails

When upgrading to a new version of Rails, run the update task with THOR_MERGE="code -d $1 $2" rails app:update. This will use VSCode as the merge conflict tool.

Postgres

# install postgres
sudo apt -y install postgresql-16 postgresql-client-16 libpq-dev
sudo service postgresql start

# Set postgres user password to 'password'
sudo su - postgres
psql -c "alter user postgres with password 'password'"
exit

# install gem pg
gem install pg

Setup

  1. Ensure project dependencies outlined above are satisfied
  2. Clone the project
  3. Install gems with bundle install in project directory
  4. Create database and schema with bundle exec rake db:setup
  5. Ensure ag-weather is set up and running on port 8080
  6. Run the server with bundle exec rails s
  7. Launch the site with localhost:3000

Running Tests

Lint

# check code for style before commit
bundle exec standardrb --fix

Test

Agweather must be running on port 8080 for some tests to pass.

bundle exec rake test TESTOPTS = "-v"

Deployment

Work with db admin to authorize your ssh key for the deploy user. Confirm you can access the dev and production servers:

Then run the following commands from the main branch to deploy:

  • Staging: cap staging deploy
  • Production: cap production deploy

Deployment targets:

About

UW Soil Science ag weather and modeling Rails app

Resources

Stars

Watchers

Forks