Giter VIP home page Giter VIP logo

deploy-sinatra-backend-heroku's Introduction

Prerequisites

  • install postgesql
  • install the heroku cli

Change database from sqlite3 to postgresql

in the gemfile remove:

gem "sqlite3"

in the terminal run:

bundle add pg

next we will need to change the db.yml file to look something like:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: your_project_name_development

test:
  <<: *default
  database: your_project_name_test

production:
  <<: *default
  database: your_project_name_production

Run your app to make sure it is still running after the database change

rake db:create db:migrate db:seed
rake server

Deploying to heroku

First run the following command to add additional platforms to your Gemfile.lock

 bundle lock --add-platform x86_64-linux

next we need to commit the changes

git add .
git commit -m "switched db from sqlite3 to posgresql"

after we have commited our changes we can create a new heroku app with the heroku cli

heroku create

Next we need to push the code to the heroku repository that was created with the above command. First run the command

git branch --show-current

if it printed out main

git push heroku main

if it printed out master

git push heroku master

Next we need to migrate and seed the database on the server

heroku run rake db:migrate db:seed

finally run:

heroku open

deploy-sinatra-backend-heroku's People

Contributors

emileypalmquist avatar

Stargazers

Brooke  avatar Mark Reese avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.