Deployment

codesy is designed with 12-factor app philosophy to run on heroku, so you can easily deploy your changes to your own heroku app with heroku toolbelt.

Deploy your own

  1. Create a heroku remote. We suggest naming it codesy-username:

    heroku apps:create codesy-username
    
  2. Set a DJANGO_SECRET_KEY on heroku that’s unique to you.:

    heroku config:set DJANGO_SECRET_KEY="username-birthdate"
    
  3. Set other required environment variables for heroku:

    heroku config:set DJANGO_DEBUG=True
    heroku config:set ACCOUNT_EMAIL_VERIFICATION=none
    heroku config:set ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
    
  4. Push code to the heroku remote:

    git push heroku master
    
  5. Migrate DB tables:

    heroku run python manage.py migrate
    
  6. Create a superuser:

    heroku run python manage.py createsuperuser
    
  7. Set the site domain name: Go to /admin/sites/site/1/change/ and make it match codesy-username.herokuapp.com

  8. To enable GitHub sign-ins on your heroku domain, use the following settings to register your own GitHub App:

    Note

    You must use https

  9. Now go to https://codesy-username.herokuapp.com/admin/socialaccount/socialapp/add/ to `enable GitHub Auth`_ on your heroku domain, using your new GitHub App Client ID and Secret

    Note

    Remember to use https

  10. That’s it. https://codesy-username.herokuapp.com/ should work.

Configure backing services

  1. To enable email via SendGrid, set SENDGRID_USERNAME and SENDGRID_PASSWORD config values:

    heroku config:set SENDGRID_USERNAME=
    heroku config:set SENDGRID_PASSWORD=
    
  2. To enable Stripe, you will need to set STRIPE_SECRET_KEY and STRIPE_PUBLIC_KEY values from Stripe Dashboard API Keys:

    heroku config:set STRIPE_SECRET_KEY=
    heroku config:set STRIPE_PUBLIC_KEY=
    
  3. To enable PayPal, you will need to set PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET value from PayPal Developer Dashboard Apps & Credentials:

    heroku config:set PAYPAL_CLIENT_ID=
    heroku config:set PAYPAL_CLIENT_SECRET=
    

Configure extensions to use the server

Check the extension docs.

Deploying to production

We use Travis CI for continuous deployment to Heroku. Our .travis.yml defines the flow:

  1. Commits to master are tested on Travis.
  2. If/when the build passes, the code is automatically deployed to https://codesy-stage.herokuapp.com
  3. To deploy changes to production, a repo owner pushes a commit to the production branch on GitHub.

This means anyone can request a production deployment by submitting a Pull Request from master to production.