I’m trying to ue the vanilla_mysql.rb importer script to migrate my shitty forum to the awesome discourse platform. However, when I execute the commands this happens:
root@discourse-app:/var/www/discourse# gem install mysql2 --platform=ruby
Building native extensions. This could take a while…
Successfully installed mysql2-0.4.6
1 gem installed
root@discourse-app:/var/www/discourse# bundle exec ruby script/import_scripts/vanilla_mysql.rb
script/import_scripts/vanilla_mysql.rb:1:in require': cannot load such file -- mysql2 (LoadError) from script/import_scripts/vanilla_mysql.rb:1:in ’
root@discourse-app:/var/www/discourse#
What am I doing wrong / how can I fix it? I’m using the default docker container on a clean ubuntu 16.04 vps.
Thanks for your reply. Here is a short version of my output:
**root@discourse-app:/var/www/discourse#: su discourse -c 'export IMPORT=1; bundle install --no-deployment --without test --without development --path vendor/bundle'**
[[....]]
An error occurred while installing mysql2 (0.4.6), and Bundler cannot
continue.
Make sure that `gem install mysql2 -v '0.4.6'` succeeds before bundling.
**root@discourse-app:/var/www/discourse#: exec ruby script/import_scripts/vanilla_mysql.rb'** Could not find gem 'mysql2' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
**root@discourse-app:/var/www/discourse#: bundle install**
[[....]]
Bundle complete! 96 Gemfile dependencies, 175 gems now installed.
Gems in the group development were not installed.
Bundled gems are installed into ./vendor/bundle.
**root@discourse-app:/var/www/discourse#: su discourse -c 'export IMPORT=1; bundle exec ruby script/import_scripts/vanilla_mysql.rb'** Could not find gem 'mysql2' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
I am facing this same situation but I am having trouble issuing these su discourse -c commands, they ask me for a password. I don’t think I created this user, it comes with the Docker container, so how do I get its password? Or how do I avoid being asked for one?
Thanks, your confirmation that I “shouldn’t be prompted” sent me searching again, this time in a slightly different direction…
And I solved it! I was using a scripted command to enter the container that had slightly different options than the standard ./launcher enter app. One of them (maybe the absence of the --login option?) was causing this difference in behavior.
Anyway I am going to make sure I always use ./launcher going forward, there’s lots of stuff in there. Once again, thanks for your answer.
I ran into problems with the installation of tiny_tds, and then with another thing it depends on called FreeTDS. After some wasted time on this I realized these are useful only for MS SQL imports, which I won’t be using, so I simply commented out the tiny_tds line in my Gemfile.
(it would be nice to have a comment in front of each of those packages saying what they are used for, if anyone knows)
안녕하세요. 이 스크립트를 실행할 때 저도 동일한 문제를 겪고 있는데, 해당 명령어들은 도움이 되지 않습니다… su discourse -c 'export IMPORT=1; bundle exec ruby script/import_scripts/vanilla_mysql.rb'를 실행하려고 할 때 받는 출력이 다음과 같습니다:
root@ip-xxx-xx-xx-xx-app:/var/www/discourse# su discourse -c 'export IMPORT=1; bundle exec ruby script/import_scripts/snuffhouse.rb'
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
If this is a development machine, remove the /var/www/discourse/Gemfile freeze
by running `bundle config unset deployment`.
The list of sources changed
The dependencies in your gemfile changed
You have added to the Gemfile:
* mysql2
* redcarpet
* sqlite3 (~> 1.3, >= 1.3.13)
* ruby-bbcode-to-md
* reverse_markdown
* tiny_tds
* csv
안녕하세요, 해결은 했는데 여기 답변을 깜빡했네요. 사실 mysql을 사용하는 포럼의 마이그레이션 스크립트를 실행하려다가 몇 가지 오류가 발생했거든요. 하지만 아래 단계를 그대로 따랐더니 문제없이 잘 작동했어요:
Discourse가 실행 중인 docker-machine 내부에서:
# 프로젝트 디렉터리로 이동
cd /var/www/discourse
# MySQL 의존성 설치
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libmariadb-dev
# MySQL gems 설치 (export = 1)
su discourse -c 'export IMPORT=1; bundle install'
# 스크립트 실행 (이 경우 vanilla_mysql)
su discourse -c 'export IMPORT=1; bundle exec ruby script/import_scripts/vanilla_mysql.rb'