Skip to content

Instantly share code, notes, and snippets.

@JangoSteve
Created March 1, 2012 21:39
Show Gist options
  • Save JangoSteve/1953419 to your computer and use it in GitHub Desktop.
Save JangoSteve/1953419 to your computer and use it in GitHub Desktop.
Importing Redmine to Git, Deploying to Heroku

Import Redmine from SVN Trunk (latest and greatest) to Git, Deploy to Heroku

Adapted (but very updated) from:

http://blog.firsthand.ca/2010/10/installing-redmine-on-heroku-with-s3.html

http://blazingcloud.net/2010/06/18/deploying-a-redmine-wiki-to-heroku/

  1. Import the latest trunk from svn to git (since we're not concerned with all the branches and tags, we don't need to use svn2git tool)

    git svn clone -s http://redmine.rubyforge.org/svn redmine-git
    git remote add origin [email protected]:username/redmine-git.git
    
  • Install gems

    gem install bundler
    bundle install
    
    gem install heroku
    heroku create MY_REDMINE_APP_NAME --stack bamboo-ree-1.8.7
    
  • Create database locally

    rake db:create
    rake db:migrate
    
  • Load default data and configuration

    rake redmine:load_default_data
    
    • Type en (for English) and hit enter
    rake generate_session_store
    
  • Switch attachments to use S3

    git clone git://github.com/JangoSteve/redmine_s3.git vendor/plugins/redmine_s3
    cp vendor/plugins/redmine_s3/config/s3.yml.example config/s3.yml
    
  • Edit config/s3.yml

    production:
      access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
      secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
      bucket: <%= ENV['S3_BUCKET'] %>
      endpoint:
      secure: true
      private:
      expires:
    
  • Install sendgrid plugin

    heroku addons:add sendgrid:starter

  • Remove /config/email.yml from .gitignore and add the file

    production:
      delivery_method: :smtp
      smtp_settings:
        address: "smtp.sendgrid.net"
        port: 25
        authentication: :plain
        domain: "heroku.com"
        user_name: <%= ENV['SENDGRID_USERNAME'] %>
        password: <%= ENV['SENDGRID_PASSWORD'] %>
    
  • Remove /public/plugin_assets from .gitignore

    git add .gitignore
    git add public/plugin_assets
    
  • Edit to not try to create directory on heroku when server started

    vendor/plugins/engines/lib/engines.rb

    86:       Engines::Assets.initialize_base_public_directory
    86:       #Engines::Assets.initialize_base_public_directory
    
  • Edit Redmine to allow Bundler v1.0.7 (used in the heroku bamboo stack)

    config/preinitializer.rb

    9: - if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.21")
    9: + if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.7")
    
  • Edit Redmine to read configuration file through ERB

    lib/redmine.rb

    84: - yaml = YAML::load_file(file)
    84: + file = ERB.new( File.read(filename) ).result
    85: + yaml = YAML::load(file)
    
  • Add session store secret key to environment.rb (within Rails::Initializer.run do |config|)

    config.action_controller.session = { :key => "_myapp_session", :secret => ENV['SESSION_SECRET'] }
    
    • Add new session secret to heroku config vars

      curl https://raw.github.com/gist/1953264 -o session_secret.rb
      bundle exec ruby session_secret.rb
      heroku config:add SESSION_SECRET=<copy secret from above output>
      
  • Add json gem to Gemfile (for redmine_s3 plugin)

    gem 'json'
    
  • git push heroku

  • Push default data to production

    gem intall taps
    heroku db:push
    
  • Visit app on heroku

  • Login as admin:admin and go to My Account and change info and password

@alejandrok5
Copy link

I believe this documentation is not updated at this point.(04-14-2014)

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