This site provides the main user experience for The Odin Project, including the home page and all user functions. It is meant to be a shell around The Curriculum and to include the tools that help students learn more effectively along their learning journeys.
The website has been open-sourced to provide both a learning resource for students who want to see how the tools they're using are built and to give students the opportunity to stretch their wings and contribute to a real open-sourced project... while building the tools they themselves will be using.
For minor fixes, either submit a github issue or a pull request. Please coordinate with the project maintainers if you're interested in working on some of the larger features in order to avoid traffic jams.
Check out the Contributing Page if you'd like to learn more about how to help out
Contact us directly at firstname.lastname@example.org
Contributing to the Site
This project is emphatically beginner-friendly so, if you're interested in potentially contributing, take a look at the Contributing Page on the website for more information. See the Getting Involved document for details of how we develop the website.
Hacking on the Site Yourself: Getting Set Up
This site runs on Ruby 2.0.0-p353 and Rails 4.0.0 (upgraded from Ruby 1.9.3 and Rails 3.2.12 in February 2014)
We STRONGLY recommend windows users and newbies having trouble setting up their environments just use nitrous.io. Nitrous is a cloud-based development environment. They basically just give you a fully stocked machine that's almost ready to go out of the box.
We use Nitrous almost exclusively during our group coding sessions so, if you'd like to get involved that way, you'll need to set it up eventually.
- Follow along with this gist to do the setup.
- Don't forget to populate your test database with
$ rake db:test:prepare
- Start by forking this repository by clicking the Fork button at the top right of this Github repo and then download your copy of the repo to your local machine by doing a
$ git clone email@example.com:YOUR_USERNAME/theodinproject.gitfrom the command line (the $ stands for your command prompt)
- Hopefully you've got RVM set up on your machine (if not, check out the Installations Project. You'll need to make sure you have Ruby 2.0.0p-353 installed (see installed rubies with
$ rvm list). If you don't have it, get it using
$ rvm get stablethen
rvm install 2.0.0-p353.
- You'll need to create a project-specific gemset to keep track of all the gems we use in one place. The repo has a (hidden) file called
.ruby-gemsetwhich specifies the gemset for you every time you enter the project's directory. It should be called
theodinprojectto match up. You can create it by running
$ rvm gemset create theodinproject. For help with RVM, check out this blog post
cdinto the project directory using
$ cd theodinproject
- Run a
$ bundle installto install all the gems used by the project.
- Note: Both local and production databases are Postgres, so if you're used to just using Rails' default SQLite database you'll need to get Postgres fired up on your local machine. You can probably get away with just typing
$ rake db:createbut may need to download a client for it and create a
theodinprojectdatabase that the application can connect to. The major difference is that Postgres operates almost like a server. Ryan Bates has a RailsCast episode about migrating to Postgres that may be helpful if you're a newbie. If you're deployed on Heroku (which we are), you need to use PG anyway.
- Once you've got postgres installed and have created the empty database, run a
$ rake db:migrateto run all the migrations that will set up the schema properly. Then run
$ rake db:test:prepareto set up the test database so you can actually run specs.
Populating the Database
db/seeds.rbfile is used to populate all the course and lesson meta-data. Use the command
$ rake db:seedto populate all the meta-data for courses and lessons so you can run the rake task in the next step.
db/seeds.rbis identical to the data you'll see presented on the production site (this is used to populate it). You can run it as many times as you'd like... it basically deletes all metadata and repopulates it with each run. The seeds file only creates curriculum data, it doesn't create any users.
One thing the seeds file will not populate is the actual content for each lesson. This needs to be retrieved from the curriculum repository on github (which is at http://www.github.com/theodinproject/curriculum) by running the rake task (
$ rake curriculum:update_content). But there's a catch... Github only allows you something like 50 API calls per hour if you haven't registered for an API key with them and used it to authenticate your requests. As of this writing, there are over 90 lessons so you would be rate limited before even finishing populating them with the rake task if you don't get an API key yourself. So go get an API key from github (at https://github.com/settings/applications) and use Figaro (as described below) to pass that key to the application so you can happily download all the curriculum files into your build.
The DISQUS forums and Github API calls rely on private environment variables (to store their API secret keys) that you won't find in the repo. I upload them directly to the server myself using the
figarogem and a corresponding file called
application.ymlthat's located in my
config/directory but not checked into git (no, you can't have my passwords). Check out the Figaro Documentation for a very easy-to-understand explanation of how the gem works. You basically just need to run
$ rails generate figaro:installand populate the missing variables to
application.yml. An example, as of this writing:
# config/application.yml --these are two steps. first two steps are created on initial registration at [http://disqus.com/admin/create/]. Second two are given when you request access to SSO for your application via a form at [http://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on] DISQUS_ACCOUNT_NAME: generated_on_intial_signup DISQUS_WEBSITE_NAME: generated_on_initial_application_registration DISQUS_API_SECRET_KEY: generated_after_SSO_permission_granted DISQUS_API_PUBLIC_KEY: generated_after_SSO_permission_granted # config/application.yml --acquire this on your github account, through settings/application/register new application.This is to make OAUTH (signin with github) function correctly. GITHUB_API_TOKEN: your_token_would_go_here GITHUB_API_ID: API_ID_Generated_with_registering_application GITHUB_SECRET: ALSO_GENERATAED_WITH_REGISTERING_APPLICATION
$ rails serverand see if that lets you check out the app at
That... should... be... it...?
This is basically all you need to get yourself set up with the repo and you should be able to run a server with
$ rails s or the tests with
$ rspec spec. Of course, nothing ever goes according to plan when installing things but hopefully your "Googling the error message" skills are up to the task.
Installing Postgres on Linux
If you're running Linux, this should be helpful. If not... carry on, nothing to see here.
Open your terminal and type ```sudo apt-get install postgresql
After installing postgres, you might like to install pgAdmin III. It is a nice GUI to have, especially for beginners. To do this, in terminal type ```sudo apt-get install pgadmin3
To start off, we need to change the PostgreSQL postgres user password; we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command. In terminal, type ```sudo -u postgres psql postgres
Set a password for the "postgres" database role using the command: ```\password postgres and give your password when prompted. The password text will be hidden from the console for security purposes. Type Control+D to exit the posgreSQL prompt.
To create the first database, which we will call "odin", simply type:
6. For ""Postgresql 9.1""+ install the adminpack "extension": ```sudo -u postgres psql ```CREATE EXTENSION adminpack; 7. Open up pgAdmin III (app menu->development->pgAdmin III) 8. Open file->add server and populate the following as field:data Name: localhost Host: localhost Port: 5432 Service: <leave blank> Maintenance DB: postgres Username: $USER Password: <whatever> Store Password: yes and click "OK". 9. You should see a new server populated in the side panel of the pgadmin window. 10. Expand (+) the server and you will see the database you created with a red X next to it. Double click to connect the database. 11. You now have postgresql set up with a GUI frontend for management, if you so desire. It is much easier for a newcomer to user pgadmin III than to try and figure out all the terminal commands. 12. Edit your /config/database.yml with the correct database information you set up in the prior steps. It will then connect to the database you created and ```rake db:migrate will now properly function. *Please let me know what I've missed here!* ## Now that you're up and running... [Come Help Out!](http://theodinproject.com/contributing) ## Significant Contributors * [Erik Trautman](https://github.com/eriktrautman) * [Afshin Moktari](https://github.com/afshinator) * [Josh Gorchov](https://github.com/gorchov) * [Joe Sawyer](https://github.com/zkay) * [Bill Walker](https://github.com/mach1010) * [Neil Gehani](https://github.com/ngehani) <hr> Created by [Erik Trautman](http://www.github.com/eriktrautman)