OakCreekDB is a web-based DBMS for managing Oak Creek Zoological Conservatory's animal information.
Make sure you have installed all of the following prerequisites on your (Ubuntu) Linux machine:
- Ruby - You should have Ruby 2.6.3 installed.
- Rails - You should have Rails 6.0.0 installed.
- Node.js 8.16.0+ - You should have Node.js installed.
- Yarn 1.x+ - Download & Install Yarn.
- ImageMagick
Install Ruby and Rails:
$ rvm install ruby-2.6.3
$ rvm use 2.6.3
$ gem install rails --version=6.0.0
Install Bundler 2:
$ gem install bundler
Install the gems:
$ bundle install --without production
First-time local database creation and initialization:
$ rails db:migrate
$ rails db:seed
If using Amazon S3 for file uploads, put your S3 credentials in application.yml
, and setup CORS:
S3_BUCKET: "..."
S3_ACCESS_KEY_ID: "..."
S3_SECRET_ACCESS_KEY: "..."
S3_REGION: "..."
SHRINE_SECRET_KEY_BASE: "..."
For more information, check out our project setup guide.
If you have deployed to Heroku before, just create a new app container with heroku create
. If this is your first time deploying to Heroku, you will need to do two things. First, sign up for a free Heroku account. Then set up ssh
keys to securely communicate with Heroku for app deployments. The three basic commands you need are the following, but see the Heroku page for more details.
$ ssh-keygen -t rsa
$ heroku login
$ heroku keys:add
Once your keys are set up (a one-time process), you should be able to create an "app container" on Heroku into which you'll deploy:
$ heroku create
Finally, deploy the app to Heroku:
$ git push heroku master
Just as we ran rails db:migrate
and rails db:seed
to do first-time database creation locally, we must also cause a database to be created on the Heroku side:
$ heroku run rails db:migrate
and
$ heroku run rails db:seed
Now you should be able to navigate to your app's URL.
You'll need to create an AWS S3 bucket, which is where the uploads will be stored. See this walkthrough on how to do that.
Next you'll need to configure CORS for that bucket, so that it accepts (multipart) uploads directly from the client. In the AWS S3 Console go to your bucket, click on the "Permissions" tab and then on "CORS configuration". There paste in the following:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>https://my-app.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
<AllowedHeader>x-amz-date</AllowedHeader>
<AllowedHeader>x-amz-content-sha256</AllowedHeader>
<AllowedHeader>content-type</AllowedHeader>
<ExposeHeader>ETag</ExposeHeader>
</CORSRule>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
</CORSRule>
</CORSConfiguration>
Replace https://my-app.com
with the URL to your app (in development you can
set this to *
). Once you've hit "Save", it may take some time for the new
CORS settings to be applied.
- Webpacker - Manages app-like JavaScript modules in Rails
- Shrine - File attachment toolkit for Ruby applications
- Devise - Flexible authentication solution for Rails based on Warden
This project is licensed under the terms of the MIT license.