Difference between revisions of "User:Woozle/Redmine/1"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(saving work)
(→‎part 2: part 3)
Line 175: Line 175:
  
 
So then the next step was to muck around with Apache's config to point it to Redmine and make it go. There were a couple of Rails directives that Apache didn't recognize and which were causing the reload to fail with no error. [https://cutie.space/users/iona/statuses/99292704349862209 Apparently] "libapache2-mod-passenger" needs to be installed.
 
So then the next step was to muck around with Apache's config to point it to Redmine and make it go. There were a couple of Rails directives that Apache didn't recognize and which were causing the reload to fail with no error. [https://cutie.space/users/iona/statuses/99292704349862209 Apparently] "libapache2-mod-passenger" needs to be installed.
 +
===part 3===
 +
Installed that, restored the missing Rails directives, reloaded Apache... and now I get a Rails error page, which is progress. Following it through, I end up doing this:
 +
<pre>
 +
root@cloud4:~# passenger-config --detect-apache2
 +
Looking for possible Apache installations...
 +
--> Looking for /usr/local/sbin/apxs2: not found
 +
--> Looking for /usr/local/bin/apxs2: not found
 +
--> Looking for /usr/sbin/apxs2: not found
 +
--> Looking for /usr/bin/apxs2: not found
 +
--> Looking for /sbin/apxs2: not found
 +
--> Looking for /bin/apxs2: not found
 +
--> Looking for /usr/games/apxs2: not found
 +
--> Looking for /usr/local/games/apxs2: not found
 +
--> Looking for /snap/bin/apxs2: not found
 +
--> Looking for /usr/local/sbin/apxs: not found
 +
--> Looking for /usr/local/bin/apxs: not found
 +
--> Looking for /usr/sbin/apxs: not found
 +
--> Looking for /usr/bin/apxs: not found
 +
--> Looking for /sbin/apxs: not found
 +
--> Looking for /bin/apxs: not found
 +
--> Looking for /usr/games/apxs: not found
 +
--> Looking for /usr/local/games/apxs: not found
 +
--> Looking for /snap/bin/apxs: not found
 +
--> Looking for : found
 +
 +
Analyzing ...
 +
Detecting main Apache executable...
 +
Detecting version...
 +
--> 2.4.18
 +
Detecting control command...
 +
Cannot find a usable Apache installation using .
 +
 +
Final autodetection results
 +
Sorry, this program cannot find an Apache installation.
 +
 +
Please install Apache and its development headers.
 +
 +
* To install Apache:
 +
  Please install it with apt-get install apache2-mpm-worker
 +
 +
* To install Apache development headers:
 +
  Please install it with apt-get install apache2-threaded-dev
 +
 +
If you are sure that you have Apache installed, please read the documentation:
 +
https://www.phusionpassenger.com/library/install/apache/customizing_compilation_process.html#forcing-location-of-command-line-tools-and-dependencies
 +
root@cloud4:~# apt install apache2-mpm-worker
 +
Reading package lists... Done
 +
Building dependency tree     
 +
Reading state information... Done
 +
E: Unable to locate package apache2-mpm-worker
 +
root@cloud4:~#
 +
</pre>
 +
The instructions are misleading. <code>apache2-mpm-worker</code> is actually the "[https://httpd.apache.org/docs/2.4/mod/worker.html worker]" module already installed with Apache; it just needs to be activated.
 +
 +
Following instructions [https://askubuntu.com/questions/524770/apache-enable-worker-mpm here]:
 +
<pre>
 +
root@cloud4:~# a2dismod mpm_prefork
 +
Module mpm_prefork disabled.
 +
To activate the new configuration, you need to run:
 +
  service apache2 restart
 +
root@cloud4:~# a2enmod mpm_worker
 +
Considering conflict mpm_event for mpm_worker:
 +
Considering conflict mpm_prefork for mpm_worker:
 +
Enabling module mpm_worker.
 +
To activate the new configuration, you need to run:
 +
  service apache2 restart
 +
</pre>
 +
The instructions then say to run the following command to see if it's working -- but they didn't say to restart Apache first, so I didn't:
 +
<pre>
 +
root@cloud4:~# apachectl -V | grep -i mpm
 +
[Fri Jan 05 00:00:19.913519 2018] [so:warn] [pid 21156] AH01574: module dav_module is already loaded, skipping
 +
[Fri Jan 05 00:00:19.952379 2018] [:crit] [pid 21156:tid 140326418311040] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
 +
AH00013: Pre-configuration failed
 +
</pre>
 +
The instructions say if you get that message, then do this:
 +
<pre>
 +
root@cloud4:~# apt remove libapache2-mod-php5
 +
Reading package lists... Done
 +
Building dependency tree     
 +
Reading state information... Done
 +
Package 'libapache2-mod-php5' is not installed, so not removed
 +
The following package was automatically installed and is no longer required:
 +
  libllvm4.0
 +
Use 'apt autoremove' to remove it.
 +
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 +
</pre>
 +
Well, okay, seems that package is already removed. Maybe I just needed to go ahead and restart Apache?
 +
<pre>
 +
root@cloud4:~# service apache2 restart
 +
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
 +
</pre>
 +
So, we're back there again. Okay, time to revert and consider other options.
 +
<pre>
 +
root@cloud4:~# a2dismod mpm_worker
 +
Module mpm_worker disabled.
 +
To activate the new configuration, you need to run:
 +
  service apache2 restart
 +
root@cloud4:~# a2enmod mpm_prefork
 +
Considering conflict mpm_event for mpm_prefork:
 +
Considering conflict mpm_worker for mpm_prefork:
 +
Enabling module mpm_prefork.
 +
To activate the new configuration, you need to run:
 +
  service apache2 restart
 +
root@cloud4:~# service apache2 restart
 +
root@cloud4:~#
 +
</pre>
 +
At least we're back to Apache being happy. (Yes, I keep testing other sites on the same server to make sure they are still working.)

Revision as of 00:05, 5 January 2018

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

part 1

  • 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.

part 2

Finding definitive upgrade instructions for Redmine has not been fruitful; so far, this is the only thing I've been able to find, and it's for an old version and doesn't explain a lot of things.

Based on that, though, I tried this:

root@cloud4:/usr/share/redmine# rake db:migrate RAILS_ENV=production

...but nothing happened, which could mean either success or failure or "nothing needed doing".

So then the next step was to muck around with Apache's config to point it to Redmine and make it go. There were a couple of Rails directives that Apache didn't recognize and which were causing the reload to fail with no error. Apparently "libapache2-mod-passenger" needs to be installed.

part 3

Installed that, restored the missing Rails directives, reloaded Apache... and now I get a Rails error page, which is progress. Following it through, I end up doing this:

root@cloud4:~# passenger-config --detect-apache2
Looking for possible Apache installations...
 --> Looking for /usr/local/sbin/apxs2: not found
 --> Looking for /usr/local/bin/apxs2: not found
 --> Looking for /usr/sbin/apxs2: not found
 --> Looking for /usr/bin/apxs2: not found
 --> Looking for /sbin/apxs2: not found
 --> Looking for /bin/apxs2: not found
 --> Looking for /usr/games/apxs2: not found
 --> Looking for /usr/local/games/apxs2: not found
 --> Looking for /snap/bin/apxs2: not found
 --> Looking for /usr/local/sbin/apxs: not found
 --> Looking for /usr/local/bin/apxs: not found
 --> Looking for /usr/sbin/apxs: not found
 --> Looking for /usr/bin/apxs: not found
 --> Looking for /sbin/apxs: not found
 --> Looking for /bin/apxs: not found
 --> Looking for /usr/games/apxs: not found
 --> Looking for /usr/local/games/apxs: not found
 --> Looking for /snap/bin/apxs: not found
 --> Looking for : found

Analyzing ...
Detecting main Apache executable...
Detecting version...
 --> 2.4.18
Detecting control command...
Cannot find a usable Apache installation using .

Final autodetection results
Sorry, this program cannot find an Apache installation.

Please install Apache and its development headers.

 * To install Apache:
   Please install it with apt-get install apache2-mpm-worker

 * To install Apache development headers:
   Please install it with apt-get install apache2-threaded-dev

If you are sure that you have Apache installed, please read the documentation:
https://www.phusionpassenger.com/library/install/apache/customizing_compilation_process.html#forcing-location-of-command-line-tools-and-dependencies
root@cloud4:~# apt install apache2-mpm-worker
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package apache2-mpm-worker
root@cloud4:~# 

The instructions are misleading. apache2-mpm-worker is actually the "worker" module already installed with Apache; it just needs to be activated.

Following instructions here:

root@cloud4:~# a2dismod mpm_prefork
Module mpm_prefork disabled.
To activate the new configuration, you need to run:
  service apache2 restart
root@cloud4:~# a2enmod mpm_worker
Considering conflict mpm_event for mpm_worker:
Considering conflict mpm_prefork for mpm_worker:
Enabling module mpm_worker.
To activate the new configuration, you need to run:
  service apache2 restart

The instructions then say to run the following command to see if it's working -- but they didn't say to restart Apache first, so I didn't:

root@cloud4:~# apachectl -V | grep -i mpm
[Fri Jan 05 00:00:19.913519 2018] [so:warn] [pid 21156] AH01574: module dav_module is already loaded, skipping
[Fri Jan 05 00:00:19.952379 2018] [:crit] [pid 21156:tid 140326418311040] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
AH00013: Pre-configuration failed

The instructions say if you get that message, then do this:

root@cloud4:~# apt remove libapache2-mod-php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libapache2-mod-php5' is not installed, so not removed
The following package was automatically installed and is no longer required:
  libllvm4.0
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Well, okay, seems that package is already removed. Maybe I just needed to go ahead and restart Apache?

root@cloud4:~# service apache2 restart
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

So, we're back there again. Okay, time to revert and consider other options.

root@cloud4:~# a2dismod mpm_worker
Module mpm_worker disabled.
To activate the new configuration, you need to run:
  service apache2 restart
root@cloud4:~# a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Enabling module mpm_prefork.
To activate the new configuration, you need to run:
  service apache2 restart
root@cloud4:~# service apache2 restart
root@cloud4:~# 

At least we're back to Apache being happy. (Yes, I keep testing other sites on the same server to make sure they are still working.)