Backend for DUCSS' freshers' week signup app, written in rails and designed for heroku(-ish) deployment.
You will need:
- A Ruby
- A Bundler
- A Git
First things first, clone the repo:
git clone git@github.com:c-brenn/signup.git
You can install and manage ruby easily using rbenv. Step by step instructions on how to install rbenv and then ruby are on the github page. At the time of writing this rails app uses ruby 2.2.2 (check the .ruby-version file to see if I'm telling the truth), so I'd recommend installing that.
With ruby installed and aliased you can now install bundler:
gem install bundler
With bundler installed you can now install and manage the app's dependencies.
cd signup
bundle install --path vendor/bundle
Now that they're all installed you will need to set up the database:
bundle exec rake:db migrate
Now that you have everything installed and configured you can run the server. You'll need to create a user or else you won't be able to log in. Open the rails console
bundle exec rails c
then create a user
User.create(email: 'spoot@bean.com', password: 'magnusman', password_confirmation: 'magnusman')
You can run the server on http://localhost:3000
with bundler:
bundle exec rails s
If you feel so inclined you can run the tests:
bundle exec rspec
The easiest way to deploy this app is probably Heroku. That being said, I have used Dokku on DigitalOcean and will now endeavour to tell you how to do just that.
Thankfully Dokku provide some nice documentation telling you how to set up DNS correctly for a server running Dokku here. It involves pointing two A records at the server, one for yourdomain.com and one for all subdomains of yourdomain.com.
DigitalOcean provide a base Dokku image that works out of the box. A guide on how to set it up, with Postgres can be found here. It involves:
- Creating a droplet from the Dokku image
- Installing the Postgres plugin
- Deploying your app (git push dokku master)
This app has a little script in deploy/post-deploy
that runs any pending database migration. You can get this to run after every Dokku deploy easily using this plugin
Once your DNS records propagate you're all done.