Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

General discussion
  1. OpenProject
  2. Forums
  3. General discussion
  4. [Solved] Heroku Development Recipe

[Solved] Heroku Development Recipe

Added by Ziyan Junaideen about 11 years ago

I am wondering if any one has a Heroku deployment recipe/steps that I can just follow and have success.

As per the moment, I think I will have to reorganize Gemfile in such a way that sqlite and others stay in development. Also it might be good idea to have a feature that can simply publish the application to Heroku for that matter as I have seen on OSCurrency project

@
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/tmp/build_4d057504-1fe1-4ea5-87f5-68df67ebd2f5/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for sqlite3.h… no
sqlite3.h is missing. Try ‘port install sqlite3 +universal’
or ‘yum install sqlite-devel’ and check your shared library search path (the
location where your sqlite3 shared library is located).
* extconf.rb failed*
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
—with-opt-dir
—without-opt-dir
—with-opt-include
—without-opt-include=${opt-dir}/include
—with-opt-lib
—without-opt-lib=${opt-dir}/lib
—with-make-prog
—without-make-prog
—srcdir=.
—curdir
—ruby=/tmp/build_4d057504-1fe1-4ea5-87f5-68df67ebd2f5/vendor/ruby-2.0.0/bin/ruby
—with-sqlite3-dir
—without-sqlite3-dir
—with-sqlite3-include
—without-sqlite3-include=${sqlite3-dir}/include
—with-sqlite3-lib
—without-sqlite3-lib=${sqlite3-dir}/
—enable-local
—disable-local

Gem files will remain installed in /tmp/build_4d057504-1fe1-4ea5-87f5-68df67ebd2f5/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7 for inspection.
Results logged to /tmp/build_4d057504-1fe1-4ea5-87f5-68df67ebd2f5/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
Installing sass (3.2.9)
Installing oj (2.1.6)
Installing syck (1.0.1)
An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v ‘1.3.7’` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!

! Push rejected, failed to compile Ruby app
.@


Replies (5)

RE: Heroku Development Recipe - Added by Troy Burke almost 11 years ago

Here’s what worked for me.

Clone OpenProject repo:

git clone https://github.com/opf/openproject.git your_app_name

Go into project directory and checkout stable branch:

cd your_app_name
git checkout stable

Create copy of stable branch (My thought here is that I do not want to make changes in the stable branch, so i can pull updates from remote and then merge them into my branch which I use to deploy to Heroku. I’m new to Git, so there may be a better approach):

git checkout -b your_branch_name origin/stable

Fire up your text editor and make the following file updates and additions.

Edit config/environments/production.rb as follows:

# Disable Rails's static asset server (Apache or nginx will already do this)
  #config.serve_static_assets = false
  config.serve_static_assets = true

Create database.yml file in /config folder (this example is for Postgres):

development:
  adapter: postgresql
  encoding: unicode
  database: your_app_name_development
  pool: 5
  username: your_app_name
  password:

test:
  adapter: postgresql
  encoding: unicode
  database: your_app_name_test
  pool: 5
  username: your_app_name
  password:

production:
  adapter: postgresql
  encoding: unicode
  database: your_app_name_production
  pool: 5
  username: your_app_name
  password:

Edit gemfile, remove non-postgres gem references (I also commented out the jruby block for good measure) and move gem ‘thin’ outside of development block:

#platforms :mri, :mingw do
#  group :mysql2 do
#    gem "mysql2", "~> 0.3.11"
#  end

#  group :postgres do
      gem 'pg', "~> 0.17.1"
#  end

#  group :sqlite do
#    gem "sqlite3"
#  end

group :development do
  gem 'letter_opener', '~> 1.0.0'
  gem 'rails-dev-tweaks', '~> 0.6.1'
#  gem 'thin'
  gem 'faker'
  gem 'quiet_assets'
end

gem 'thin'

Get it running locally.

Create database user:

create user "your_app_name" with superuser password '';

Run bundle tasks:

bundle install --without mysql mysql2 sqlite development test
bundle exec rake generate_secret_token
bundle exec rake db:create:all
bundle exec rake db:migrate db:seed RAILS_ENV=production
bundle exec rake assets:precompile

NEVER RUN bundle update! (this screwed things up for me)

Start up rails server:

RAILS_ENV=production bundle exec rails server

Go to localhost:3000 (site should be running) login is admin/admin.

Make sure to commit your changes.

Now the Heroku stuff.

Create new Heroku app:

heroku apps:create your_app_name

Set secret token:

heroku config:set SECRET_TOKEN=your_secret_token

Install the Postgres add-on:

heroku addons:add heroku-postgresql

Push project to Heroku:

git push heroku your_branch_name:master

It takes long time to bundle, pray for no error messages.

Run database migrations:

heroku run rake db:migrate

Run database seed:

heroku run rake db:seed

Go to http://your_app_name.herokuapp.com

Hopefully it works!

Missing steps - Added by Deleted user over 10 years ago

Your instructions are excelent Troy. But in my case, I have to make some changes to get it working:

Database

Don’t use the pool property and add the host property for all the databases

production:
  adapter: postgresql
  encoding: unicode
  database: psql_database
  host: localhost
  username: psql_user_name
  password: psql_user_pass

Procfile

Edit the file Procfile and pay attention to the web: line. It should match Heroku’s policies. In my case, commenting the default value and adding the correct value that Heroku provides. It should looks like this:

# web: bundle exec unicorn --config-file config/unicorn.rb --host ${HOST:="127.0.0.1"} --port ${PORT:="8080"} --env ${RAILS_ENV:="development"}
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec rake jobs:work
backup: ./packaging/scripts/backup
check: ./packaging/scripts/check

Make sure to commit and push the changes! :-)

RE: [Solved] Heroku Development Recipe - Added by Duarte Dias over 10 years ago

Hi all,

I just wanted to know. After you installed Open Project on Heroku, were you able to store files as anexes of the tasks? Or store any kind of file? My concern is that I had previous problems with saving uploaded files directly in the file system in heroku, in my previous experience something like paperclip should be necessary.
I want to know because this is crucial to my project. Im trying to deploy to heroku but I have not successed yet, I need to know if it will be worth it to try to push this heroku idea.
Thanks in advance and thanks for your instructions.

RE: [Solved] Heroku Development Recipe - Added by Chris Seelus about 10 years ago

We did it in a slightly different, concise way: http://www.imeos.com/blog/2015/03/18/deploy-openproject-to-heroku-the-easy-way/

RE: Heroku Development Recipe - Added by Shalahudin Ayyuby about 5 years ago

i got error

Installing nio4r 2.5.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:

C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2/ext/nio4r

C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r

./siteconf20200324-3460-1ejjszg.rb extconf.rb

current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2/ext/nio4r

make "DESTDIR=" clean

current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2/ext/nio4r

make "DESTDIR="

make failedNo such file or directory - make "DESTDIR="

Gem files will remain installed in

C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2 for inspection.

Results logged to

C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/nio4r-2.5.2/gem_make.out

An error occurred while installing nio4r (2.5.2), and Bundler cannot continue.

Make sure that `gem install nio4r -v '2.5.2' --source 'https://rubygems.org/'`

succeeds before bundling.

In Gemfile:

 openproject-openid_connect was resolved to 1.0.0, which depends on

   lobby_boy was resolved to 0.1.3, which depends on

     rails was resolved to 6.0.2.2, which depends on

       actioncable was resolved to 6.0.2.2, which depends on

         nio4r

how to fix this?

  • (1 - 5/5)
Loading...