Skip to content
/ ag-vdifn Public

Provides a front-end map-based interface for browsing vegetable disease and insect pest pressure models computed by the ag-weather backend service.

Notifications You must be signed in to change notification settings

uwent/ag-vdifn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ag-Vdifn

CircleCI

Description

University of Wisconsin Vegetable Disease & Insect Forecasting Network

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

Node

node and pnpm

# install npm
sudo apt install npm
npm -v

# install n, Node's version manager
sudo npm install -g n

# install the latest stable version of Node
sudo n stable
node -v

# install pnpm
curl -fsSL https://get.pnpm.io/install.sh | sh -
pnpm -v

# install packages
pnpm install

# or update packages to latest - be sure to test for breaking changes after updates
pnpm up --latest

Initial Setup

  1. Install core dependencies listed above.
  2. Install ruby gems with bundle install and node packages with pnpm install
  3. Setup database with bundle exec rails db:setup
  4. Run ag-weather server on port 8080 with ag-weather> bundle exec rails s
  5. Run ag-vdifn server with bin/dev
  6. Launch site by visiting localhost:3000 in browser

Running Tests

# check ruby code for style
bundle exec standardrb --fix

# Ruby specs
bundle exec rspec

# JS specs
pnpm test

# Check for build success
pnpm build

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

Provides a front-end map-based interface for browsing vegetable disease and insect pest pressure models computed by the ag-weather backend service.

Resources

Stars

Watchers

Forks