Volume 3 : Technical Guide
I Overview
1
About BETYdb: Database Description and User’s Guide
1.1
Objectives
1.2
Citation
1.3
Scope
1.4
Content
1.5
Design
1.6
Data Entry
1.7
Software
1.8
List of Tables in the BETY Database
2
BETYdb Tables
2.1
Schema: Enhanced Entity-Relationship Model
2.2
Tables
2.3
Table and field naming conventions
2.3.1
Data Tables
2.3.2
Auxillary Tables
2.3.3
Join Tables
II Installing BETYdb
3
Deploying a Production Copy of the BETYdb Web Application
Installing and Configuring Ruby and Rails Code
Step 1: Log in to the deployment machine as an administrator
Step 2: Add a new user as the owner of the BETYdb instance
Step 3: Choose a location for the application code
Step 4: Create the target parent directory and clone the BETYdb code from the GitHub repository:
Step 5: If you have not already done so, install the correct version of Ruby
Step 6: Log in to the application’s user account and make sure you are in the Rails root directory:
Step 7: Use the Bundler to install the application Gems:
Step 8: Create a database configuration file
Step 9: Create a Rails application customization file
Step 10: Compile Rails assets:
Loading the BETYdb Database
Step 11: Download the load.bety.sh script from the PEcAn repository:
Step 12: If you aren’t already there, cd to the application root directory:
Step 13: Log in as user postgres:
Step 14: Create a role and a database for the BETYdb app
Step 15: Run the load.bety.sh script:
Step 16: (Optional) Load data from another machine:
Step 17: Exit the postgres user account:
Complete Apache and Passenger configuration
Step 18: Check that the correct version of Ruby is enabled:
Step 19: Find the path to the Ruby interpreter:
Step 20: Configure the Apache Server
Step 21: Restart Apache:
Step 22: Test:
Final Steps
Step 23: Create a BETYdb administrative account
Step 24: Re-Set the Guest user account password
Step 25: Ensure images for Priors pages are generated
Step 26: Ensure the SchemaSpy documentation can be generated
4
Setting Up a CentOS Server
4.1
Install CentOS 7
4.2
Install additional system software
4.3
Install required Ruby and Rails software
4.3.1
RVM (Ruby Version Manager)
4.4
Bundler:
4.5
node.js (needed to be able to compile Rails assets):
4.6
Phusion Passenger
5
Configuring PostgreSQL
5.1
Step 1: Initialize the database cluster and start the server
5.2
Step 2: Enable password authentication for all users other than postgres
5.3
Step 3: Create a new role and new database for BETYdb
6
Archived Setup Documentation
6.1
Setting up a RedHat or CentOS Server
6.1.1
Overview
6.2
Instructions for Installing and Configuring PostgreSQL
6.3
Installing the BETYdb Rails Application
6.3.1
Prerequisites
6.3.2
Installing the Rails Application
6.3.3
Updating / Syncing the database
6.3.4
Starting the BETYdb Rails Web Application
6.3.5
Logrotation
III BETYdb System Administration
7
Updating BETYdb When New Versions are Released
7.1
Updating the BETY database
7.2
Update the Rails app and schema
7.3
Load a fresh version of database
8
Distributed instances of BETYdb
8.1
Syncing Databases
8.1.1
Exporting Data
8.1.2
Importing Data
8.1.3
Primary Key Allocations
8.2
Feedback Tab
8.3
Customization
8.4
Issues
IV BETYdb Development
9
Ruby on Rails Application Overview (draft)
9.1
Introduction to Ruby-on-Rails
9.2
Introduction to MVC
9.3
Source Code Map
9.4
Misc. Information
9.4.1
Providing model output for download
9.4.2
Related Issues / Commits:
10
Ruby-on-Rails: Developing, Upgrading, and Deploying
10.1
Development and Testing
10.2
Deploying a new version:
10.3
Deploying or upgrading to a new version of the BETYdb Rails app
10.3.1
Running Migrations
10.4
Versioning and Tagging
10.4.1
Protocol for defining and releasing versions
10.4.2
Version Numbering
10.5
Commenting in the Rails Models
11
Automated Tests
11.1
Development and Testing
11.2
Running the RSpec tests on BETYdb.
11.2.1
Preparing the test database.
11.2.2
Running the tests
11.2.3
Troubleshooting
11.2.4
Creating a new PostGIS-enabled database template
12
Code Style
12.1
Whitespace conventions in the BETYdb Code
12.2
Fixing legacy formatting
13
Complex Joins in the Web Interface
14
Database Constraints
14.1
Types of Constraints
14.2
Value Constraints (including some NOT NULL constraints)
Global
covariates:
managements:
species:
sites:
traits:
treatments:
users:
yields: [see also traits constraints]
14.3
Foreign Key Constraints
14.4
Non Null Constraints
14.5
Uniqueness constraints
14.6
Technical Note
15
Modifying the BETYdb schema
15.1
Troubleshooting
16
Issuing a New Release
16.1
Writing release notes
16.2
Upgrading the canonical BETYdb Rails site
16.3
Upgrading other production sites
16.4
Finishing the release
16.4.1
Version Numbering
V Appendix
Release Notes Template
Biofuel Ecophysiological Traits and Yields Database
Biofuel Ecophysiological Traits and Yields Database
By: BETYdb Team
2019-08-13
Volume 3 : Technical Guide