Skip to content

Instantly share code, notes, and snippets.

@svallory
Last active August 12, 2023 21:09
Show Gist options
  • Save svallory/d08e9baa88e18d691605 to your computer and use it in GitHub Desktop.
Save svallory/d08e9baa88e18d691605 to your computer and use it in GitHub Desktop.
Deploying Sharetribe to Heroku

Deploying to Heroku

  1. Deploy the app to heroku following heroku normal instructions (add link to heroku help)

  2. Set heroku environment variables

    Make sure all the options in config.yml are properly set then run:

     bundle exec rake heroku:config
    

    Copy, paste and run the generated command

  3. Remove postgres addon

     heroku addons:destroy heroku-postgresql
    
  4. Addons: MemCachier (free) and SSL ($20)

     heroku addon:create memcachier:dev
     heroku addons:create ssl:endpoint
    
  5. Addons: New Relic

     heroku addon:create newrelic:wayne
    

    Open the addon by running

     heroku addon:open newrelic
    

    Click on the top-right dropdown menu and select "Account Settings". On your account page, copy your License key. Open config/newrelic.yml to set license_key variable value to your license.

  6. Addon: Flying Sphinx ($55)

     heroku addons:create flying_sphinx:ceramic
    

    Ceramic plan is needed for Delta indexes. If you can manage without Delta Indexing, smaller plan is also ok

  7. Addon: MySQL

     heroku addon:create cleardb:ignite
    

    Now get your database url by running

     heroku config:get CLEARDB_DATABASE_URL
    

    Copy the value of CLEARDB_DATABASE_URL returned and CHANGE the adapter from mysql:// to mysql2:// (there's a 2 there). Then set the value of DATABASE_URL environment variable.

     heroku config:add DATABASE_URL='mysql2://{the rest of your connection string}'
    

    And initialize your database

     heroku run bundle exec rake db:schema:load
    
  8. Addon: Heroku scheduler

     heroku addon:create scheduler:standard
    

    Open the scheduler

     heroku addon:open scheduler
    

    And add the following jobs

    Job Frequency
    flying-sphinx index hourly
    rails runner "CommunityMailer.deliver_community_updates" Daily
    rake sharetribe:delete_expired_auth_tokens Daily

Recomended dyno sizes

  • web: Standard-2X
  • worker: Standard-2X
@mooreds
Copy link

mooreds commented Aug 11, 2016

If you are deploying 5.8, you need to make sure you set up the node multipack first otherwise the NPM calls will fail: https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app

@johnsonyeap
Copy link

johnsonyeap commented Jan 3, 2017

When there is no schema.rb in the project folder,

how will the following command works?

heroku run bundle exec rake db:schema:load

@jarvisjohnson
Copy link

@johnsonyeap - Sharetribe uses SQL - command is

heroku run bundle exec rake db:structure:load

Also, AFAIK SSL:endpoint addon is not necessary with less than 1% of browsers requiring it.

Instead, just upload your certificate to Heroku, no addon needed.

@jarvisjohnson
Copy link

I've created an updated version of these instructions if anyone needs them here

Cheers

@cstbr
Copy link

cstbr commented Jan 23, 2017

What the mininum to deploy a serve at heroku? Like 500users? 1 dyno + ceramic + free addons?

@priyatam
Copy link

priyatam commented Sep 23, 2018

What are the values that should be overridden in config.yml? The default example doesn't mention the required fields.

Also, does anyone know why the following command fails:
heroku run bundle exec rake db:structure:load

bash: bundle: command not found.

I had already pushed the app once using `git push heroku' after creating the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment