User:Woozle/Redmine/1
2017-12-27
This is my second attempt to migrate-and-upgrade a Redmine site. The first, I was never able to get working. This time I'm trying a different approach: installing from the repository, which currently (Ubuntu 16.04) has the oldest version of Redmine that is still officially available, 3.2.1-2.
"apt install redmine" seems to assume you want sqlite for the back end, in that the packages it installs include redmine-sqlite, dbconfig-sqlite3, ruby-sqlite3, and sqlite3.
I want MySQL because I know how to work with that (and it's already installed), so I'm going to try "apt install redmine-mysql" first (which installs dbconfig-mysql, redmine-mysql, and ruby-mysql2 but also ruby-sqlite3 and sqlite3 anyway, who knows why).
The upgrade instructions on the official Redmine site assume you're installing from source, so I'm winging this...
During the install process, I get a text-dialog box which says:
The redmine/instances/default package must have a database installed and configured before it can be used. This can be optionally handled with dbconfig-common.
If you are an advanced database administrator and know that you want to perform this configuration manually, or if your database has already been installed and configured, you should refuse this option. Details on what needs to be done should most likely be provided in /usr/share/doc/redmine/instances/default.
Otherwise, you should probably choose this option.
Configure database for redmine/instances/default with dbconfig-common?
Given that I have a database I want it to use, I replied "no".
At the end of the installation, it gave me this message:
Errors were encountered while processing: redmine E: Sub-process /usr/bin/dpkg returned an error code (1)
...which I assume is the result of me saying "no", and not an actual error.
Apparently this also installs redmine itself, as "apt install redmine" comes back with nothing new to install.
No sources seemed to be forthcoming with information about where file uploads are stored (so they can be migrated to a new server), so I figured it out the hard way by looking in the "attachments" table for a filename, and then searching the hard drive for that file. Apparently they are stored in /var/lib/redmine/default/files.
(Now I need to go migrate the data.)
2018-01-04
- Data migrated to vbz-rm on cloud4.
- Created MySQL user, gave it ALL privileges on vbz-rm.
- Running "dbconfig-common"... is not a command. Maybe an option?
- Apparently it is a command that I don't have installed. Do I want to use it?
- I think the answer is "no", because it looks like what it does is help with the process of creating the db and assigning a user to it -- which I already did (that's the part I do know how to do).
- What I don't know how to do is configure Redmine to use the db and user I've created.
- Let me see if there's a config file in the old instance...
- Yes there is, in /etc/redmine/default. I copied over configuration.yml (unchanged) and database.yml, then altered database.yml to use the new/local credentials.
- Now going back to "apt -f install" to see what the errors (still) are...
- "`/var/www` is not writable." -- it's writeable by root; who else needs to write it? Here's more of the block of text:
Setting up redmine (3.2.1-2) ... dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/default.conf error: template infile /usr/share/redmine/templates/database-.yml.template does not exist dbconfig-common: flushing administrative password `/var/www` is not writable. Bundler will use `/tmp/bundler/home/root' as your home directory temporarily. rake aborted! Gem::LoadError: Specified 'mysql' for database adapter, but the gem is not loaded. Add `gem 'mysql'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
The Gemfile is found in /usr/share/redmine/Gemfile; I manually added "gem 'mysql'" to the file with a text editor. Now it says this:
Setting up redmine (3.2.1-2) ... Could not find gem 'mysql' in any of the gem sources listed in your Gemfile. dpkg: error processing package redmine (--configure): subprocess installed post-installation script returned error exit status 7
Extrapolating from the Mastodon install instructions, I'm going to try "gem install mysql" (why didn't the apt install routine do this?) Tentatively this was the right thing to do, or at least part of it, but it's not the whole thing:
root@cloud4:~/scripts# gem install mysql Fetching: mysql-2.9.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. current directory: /var/lib/gems/2.3.0/gems/mysql-2.9.1/ext/mysql_api /usr/bin/ruby2.3 -r ./siteconf20180104-983-1fztnkg.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h extconf failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql-2.9.1 for inspection. Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql-2.9.1/gem_make.out root@cloud4:~/scripts#
Clues here suggest that this is what is needed: "apt install ruby-dev"
"gem install mysql" then got a little further, but failed:
root@cloud4:~/scripts# gem install mysql Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. current directory: /var/lib/gems/2.3.0/gems/mysql-2.9.1/ext/mysql_api /usr/bin/ruby2.3 -r ./siteconf20180104-1311-4wf87b.rb extconf.rb checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** 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=/usr/bin/$(RUBY_BASE_NAME)2.3 --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib To see why this extension failed to compile, please check the mkmf.log which can be found here: /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql-2.9.1/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql-2.9.1 for inspection. Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql-2.9.1/gem_make.out root@cloud4:~/scripts#
Clues here suggested that "apt install libmysqlclient-dev" might be the thing. Did that, after which "gem install mysql" was successful.
So now back to "apt -f install" -- I still get the warning message about /var/www not being writeable, but that doesn't seem to be a show-stopper. The only other errors I get have to do with nginx, which I'm pretty sure came out of the attempted Mastodon install -- so I'm going to try "apt remove nginx-core nginx" (completed successfully) and then "apt -f install" again...
...which seems to be happy now; nothing needed doing. (I did "apt autoremove" just so it would stop mentioning those unneeded files.)
So now where are we? I guess I need to point test.rm.vbz.net at cloud4, and tell Apache that this is an alias for Redmine, so I can test this deployment without making the old one inaccessible... or is there an upgrade process which needs to be run from the CLI? Will have to check on that.