Error with Gitlab: Sidekiq; gemfile syntax error

I’ve been breaking my head over this error for hours now, and still haven’t found a fix. When I run sidekiq using sudo -u root -H RAILS_ENV=production script/background_jobs start I’m getting this error in the sidekiq.log:

Gemfile syntax error:
/home/website/git/gitlab/Gemfile:20: syntax error, unexpected ':', expecting $end
gem "mysql2", group: :mysql

I’ve installed Ruby 2.1.0 and am running CentOS. I’ve seen other posts with this error, and their problem was that they were running Ruby 1.8, however, I’m running Ruby 2.1.0 and also getting this error.

  • What is the equivalent of hg up -C in git
  • Suggestions for Distributed Version Control in Eclipse
  • Query on setting up a pre-receive hook in git
  • How to undo git pull from unrelated project?
  • How do I protect git-assume-unchanged files from being overwritten by remote?
  • Completely remove files from Git repo and remote on GitHub
  • Any help is greatly appreciated.

    EDIT: My gemfile

    bundle returns

    Your bundle is complete!
    Gems in the groups development, test, postgres, puma and aws were not installed.
    It was installed into ./vendor/bundle

    EDIT2: My background_jobs script

    bundle show bundler returns


    EDIT3: I think I have found the problem, not sure how to solve it though. I added p RUBY_VERSION as first line of my Gemfile, then I changed every line written like this: group: :mysql to this :group => :mysql (because that is working on older versions).

    However, when I run Sidekiq now, this shows up in the sidekiq.log:

    bundler: command not found: sidekiq
    Install missing gem executables with `bundle install`

    I am really, really confused now. Here it clearly says my Ruby version is 1.8.7, but that’s not right. ruby -v or rvm list rubies only show that Ruby 2.1.0 is installed, and set as default.

  • Git log --graph; HEAD to top
  • What's the Windows command shell equivalent of bash's `true` command?
  • Line history viewer - Git
  • Heroku : Username for '': git
  • Autodeploy with git
  • Clone huge 16 GB Git repo with Eclipse Neon
  • One Solution collect form web for “Error with Gitlab: Sidekiq; gemfile syntax error”

    Make sure, that when you issue bundle install you have picked up the ruby 2.1.0, just do as follows:

    1. Enter into app’s folder, then edit the Gemfile to a few lines, inserting into it p RUBY_VERSION

    2. Issue bundle install, and see the ruby version output, it shell be 2.1.0, and the form of gem "mysql2", group: :mysql should work.

    3. Then add line one-by-one, or group-by-group, issuing the bundle install

    4. So make sure that the Gemfile will be fully restored at the end.

    5. Then you should do a proper setup shell environment in your run script. So if you use the rvm just replace the first line with:

      #!/bin/bash -l
    6. Add sourcing to rvm:

      source "$HOME/.rvm/scripts/rvm"
    7. Before starting the script, add shell command to set proper version of ruby to 2.1.0

      rvm use ruby-2.1.0@global

    NOTE: Probably you have to use an other gemset not the global one.

    Git Baby is a git and github fan, let's start git clone.