Monitoring native plants & biodiversity at OSU Cascades.
Ecotone enables Biology and Resource Management students to practice identifying native plants, identify different sites (plots), and track the long term trends of the ecotone on the OSU-Cascades campus.
If you want to contribute to Ecotone, be sure to review the contribution guidelines. This project adheres to Ecotones’s code of conduct. By participating, you are expected to uphold this code.
Add the GitHub repository in your choice of directory.
git clone git@github.com:osu-cascades/ecotone-web.git
After cloning the repository, install the required gems.
bundle install
If you run into dependency issues, try deleting Gemfile.lock
and rerunning the install command.
3.1 Create a .env
file following the format in .env.example
Fill the {} in the DATABASE_URL sections with the credentials you used setting up PostgreSQL.
Don’t worry about the GOOGLE_CLIENT yet, we’ll get there.
3.2 Obtain Google OAuth credentials
Now it’s time to worry about the GOOGLE_CLIENT sections.
ecotone.com
osu-ecotone.herokuapp.com
osu-ecotone-staging.herokuapp.com
http://localhost:3000/users/auth/google_oauth2/callback
https://osu-ecotone.herokuapp.com/users/auth/google_oauth2/callback
https://osu-ecotone-staging.herokuapp.com/users/auth/google_oauth2/callback
.env
file3.3 Finally, set up the databases in rails. If everything is set up correctly, these will run without errors.
rails db:setup
rails db:migrate
If you want to start with some information already populated in the database, run the seed file.
rails db:seed
If that command fails, instead run the reset command to drop and reset the databases with the seed data.
rails db:reset
rspec
rails s
If you see the Ecotone homepage pop up, congratulations! You can now hack away
Still not sick of setting up your dev environment? Then continue with configuring app deployment to Heroku by adding the following lines to your .git/config
file:
[remote "production"]
url = https://git.heroku.com/osu-ecotone.git
fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "staging"]
url = https://git.heroku.com/osu-ecotone-staging.git
fetch = +refs/heads/*:refs/remotes/heroku/*
This adds the remote Heroku repositories to your local git configuration. To use Heroku on the command line, make sure you have installed the Heroku CLI.
To deploy the app, git push to one of the Heroku apps.
git push [staging|production] {branch}:master
If you are pushing from your local master branch, then you can omit the last part of the command. Otherwise, replace {branch} with the name of the branch you are deploying from. To override outdated commits, such as when you push then rollback to a previous version, add --force
to the command.
Ecotone’s map of plots requires a specific library and API:
If you plan on working on the Leaflet map implementation locally, then you must enable the proper configuration variable within your .env
file by adding LEAFLET_KEY=<key>
. This will allow you to edit the map and its corresponding features in your development environment.
If you want all the app power of admin privileges, follow these steps:
First, find yourself as a user. You can either take a guess at your ID or check using Rails dbconsole.
rails db
Enter the password if prompted. This opens up a shell to your local development database. You can use basic SQL statements to see all users in the database. Find yourself and take note of what ID is assigned to you.
>>> SELECT * from users;
Next, open up the rails console (another shell), which we can use to manipulate information.
rails c
This will open up the rails terminal. Once inside, find yourself as a user then set your admin priveleges.
>>> me = User.find(ID)
>>> me.admin = true
>>> me.save
>>> exit
Run rails s
and go to localhost:3000
in your browser. You will know you are an admin if there is an additional “Users” section on the navbar and you have the ability to “Add Plots” on the Plots page.
Thanks for reading!
© 2019 Nathan Struhs, Yong Bakos.