-
Notifications
You must be signed in to change notification settings - Fork 18
Freehub Developer Guide
This developer guide is a work in progress with information added as we need to capture it.
To contribute to Freehub, feel free to send a pull request or join the "freehub-users google group":http://groups.google.com/group/freehub-users. We'll take it from there.
You can check Freehub out from "GitHub":http://github.com/asalant/freehub.
See Where To Find Things to start getting familiar with Freehub.
Freehub was originally created in 2008 and is worked on part time or not at all for long stretches of time (like years!). For this reason, it has a number of dependencies that are out of date. For example, it uses Ruby 1.9.3 and Rails 2.3. If anyone wants to help update to more modern versions of Ruby and Rails, let us know ;-)
Freehub is set up for development using Docker in order to make it easy to get set up with the correct versions of Ruby, Rails, and MySQL.
To get set up developing Freehub with Docker, first install "Docker and Docker Compose":https://hub.docker.com/?overlay=onboarding (Compose is included with Docker Desktop for Mac and Windows).
Then checkout Freehub:
git clone http://github.com/asalant/freehub.git freehub
cd freehub
Bootstrap the Docker images, create the development databases, and load test data:
docker-compose build
docker-compose up -d mysql
docker-compose run app rake db:create db:migrate db:fixtures:load
docker-compose run app rake db:create RAILS_ENV=test
Once you have done this you can start the app, log in, and play around. You can log in as the sfbk
test user with password test
:
docker-compose up
open http://localhost:3000
To run the test suite:
docker-compose run app rake test
To get a console into the docker MySQL instance (the development root password is password
):
docker-compose run app mysql freehub_for_all_development -h mysql -u root -p
To shut down the containers (but not lose database data):
docker-compose stop
To stop and remove the containers (losing database data):
docker-compose down
What's going on here is that we are using docker-compose
to manage two docker containers, one that runs the Rails app and one that runs MySQL. The container running the app is started with your local freehub
working directory mapped to /app
in the container where Rails is run from. You can make changes locally and they will be picked up immediately.
To run any rake tasks or scripts in the Rails container, just prefix with docker-compose run app
. If you make changes to gem dependencies, you'll need to rebuild the app container with docker-compose build
.
For background and more info on this Docker setup, see "this post":https://blog.codeship.com/running-rails-development-environment-docker/.
For "http://freehub.bikekitchen.org":http://freehub.bikekitchen.org Freehub is deployed on Engine Yard AppCloud from the 'release' branch of this GitHub project. Use the "AppCloud dashboard":https://cloud.engineyard.com/dashboard to trigger new stage and production deploys.
You may also trigger deploys with "GitHub post-commit hooks":http://docs.engineyard.com/howtos/howto-deploy-your-app-from-github-with-a-post-commit-hook.
To merge master to the stable release branch and deploy to staging:
git checkout release
git merge -m"[deploy Freehub_Staging migrate] Deploy release branch to staging" master
git push origin release
To release the stable release branch to production:
git checkout release
git commit --allow-empty -m"[deploy Freehub_Production migrate] Deploy release branch to production"
git push origin release
Freehub uses:
- "HAML":http://haml-lang.com for generating markup in its views.
- the Ruby Test::Unit testing suite with Rails fixtures.
- "annotate-models":http://github.com/ctran/annotate_models plugin for model schema information
- "Rails API, method reference":http://api.rubyonrails.org/
- "Front to back Rails tutorial":http://railstutorial.org/ that uses github as its example VCS. Uses Heroku for deployment, eRB for views and rspec for testing, which isn't that helpful, but it's a good starter tutorial anyway.
- "RailsGuides":http://guides.rubyonrails.org/index.html In depth guides to particular features. Look here if you're already familiar with rails, but need more.
Freehub is licensed for use under the "Apache 2.0 License":http://www.apache.org/licenses/LICENSE-2.0.