These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Ruby on Rails - Install script on the new forum.
Hi dragons,
do anyone have experience with RoR applications running under virtualmin? I got runnging webmin and RoR default installation (everything is working - mongrel runs on its own port and apache is proxying it on port 80) - one little problem - I got Redmine (RoR) application and I want to have it installed by default instead of RoR default. Is there any way to do that? I know this is done by modifying rails.pl script somehow - but - I am only poor administrator - not a programmer ;o))) - or - do you have any ideas ?
Thanks a lot.
You'll probably want to look at the install scripts for Radiant or Mephisto, which are applications that use the Ruby on Rails stack, which would probably provide a good starting point. I think we've heard a few others wishing for Redmine, so I wouldn't rule out seeing it included in the next couple of revisions.
--
Check out the forum guidelines!
Joe I think that you are G(od). Virtualmin and webmin .... I don't know what to say. Of course it was only try to have knowledge from some one and do none investigation myself. I don't know wha to say.
Just - I'll help you two (Jammie and Joe ;o) as much as I can.
THANKS
Thanks for the kind words.
We're always happy to see others working on Install Scripts...even if it's not perfect the first time. A few of our officially supported scripts were actually contributed by users, which is really cool to see. It helps Jamie refine the APIs, and also makes more apps available to everybody.
I'm sure you've seen the API docs, but just in case:
http://www.virtualmin.com/documentation/id,script_installers/
The Trac and Moin Moin scripts, for example, were contributed by jezdez, and he did an awesome job (we're really proud of him, as he's mostly a Pythonista, but he made short work of learning the Perl he needed to get it done). We'd love to see some Rubyists getting in on the act. (In case you haven't noticed, we're mostly language agnostic. We happen to both like and have done a lot of work in Python, and every time I've used Ruby, I've enjoyed it immensely.) ;-)
Anyway, see what you come up with and post your results--even if it doesn't work, Jamie or I might be able to guide you to a solution to any problems that come up.
--
Check out the forum guidelines!
Here you can check script for installation of Redmine (best Project Management solution - we are using it in our company and we are very satisfied with it).
I think that it is working well.
Only with upgrading this script may be problem - redmine uses rubyforge and this repository creates urls like - http://rubyforge.org/frs/$rand_num/redmine-$version.tar.gz
This script is for actual version 0.7.3 of redmine.
Here goes file ;o)
Once again.
I don't understand I cannot attache .txt file - I don't know why.
# @redmine_tables = (
# );
# script_redmine_desc()
sub script_redmine_desc
{
return "redmine";
}
sub script_redmine_uses
{
return ( "ruby", "proxy" );
}
sub script_redmine_longdesc
{
return "Redmine is a flexible project management web application.";
}
# script_redmine_versions()
sub script_redmine_versions
{
return ( "0.7.3" );
}
sub script_redmine_category
{
return "Project Management";
}
# script_redmine_depends(&domain, version)
# Check for ruby command, ruby gems, mod_proxy
sub script_redmine_depends
{
local ($d, $ver) = @_;
local @rv;
&has_command("ruby") || push(@rv, "The ruby command is not installed");
&require_apache();
&has_proxy_balancer($d) ||
push(@rv, "The Apache proxy module is not installed");
&has_domain_databases($d, [ "mysql" ]) ||
push(@rv, "redmine requires either MySQL database");
return @rv;
}
# script_redmine_params(&domain, version, &upgrade-info)
# Returns HTML for table rows for options for installing Redmine
sub script_redmine_params
{
local ($d, $ver, $upgrade) = @_;
local $rv;
local $hdir = &public_html_dir($d, 1);
if ($upgrade) {
# Options are fixed when upgrading
local ($dbtype, $dbname) = split(/_/, $upgrade->{'opts'}->{'db'}, 2);
$rv .= &ui_table_row("Database for redmine tables", $dbname);
local $dir = $upgrade->{'opts'}->{'dir'};
$dir =~ s/^$d->{'home'}\///;
$rv .= &ui_table_row("Install directory", $dir);
}
else {
# Show editable install options
local @dbs = &domain_databases($d, [ "mysql" ]);
$rv .= &ui_table_row("Database for redmine tables",
&ui_database_select("db", undef, \@dbs, $d, "redmine"));
$rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>",
&ui_opt_textbox("dir", "redmine", 30,
"At top level"));
$rv .= &show_mongrels_ports_input($d);
}
return $rv;
}
# script_redmine_parse(&domain, version, &in, &upgrade-info)
# Returns either a hash ref of parsed options, or an error string
sub script_redmine_parse
{
local ($d, $ver, $in, $upgrade) = @_;
if ($upgrade) {
# Options are always the same
return $upgrade->{'opts'};
}
else {
local $hdir = &public_html_dir($d, 0);
$in->{'dir_def'} || $in->{'dir'} =~ /\S/ && $in->{'dir'} !~ /\.\./ ||
return "Missing or invalid installation directory";
local $dir = $in->{'dir_def'} ? $hdir : "$hdir/$in->{'dir'}";
local ($newdb) = ($in->{'db'} =~ s/^\*//);
local $mongrels = &parse_mongrels_ports_input($d, $in);
return $mongrels if (!int($mongrels));
return { 'db' => $in->{'db'},
'newdb' => $newdb,
'dir' => $dir,
'mongrels' => $mongrels,
'path' => $in{'dir_def'} ? "/" : "/$in{'dir'}",
};
}
}
# script_redmine_check(&domain, version, &opts, &upgrade-info)
# Returns an error message if a required option is missing or invalid
sub script_redmine_check
{
local ($d, $ver, $opts, $upgrade) = @_;
if (-r "$opts->{'dir'}/config/database.yml") {
return "Redmine appears to be already installed in the selected directory";
}
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
foreach my $t (@redmine_tables) {
local $clash = &find_database_table($dbtype, $dbname, $t);
$clash && return "redmine appears to be already using the selected database (table $clash)";
}
$opts->{'mongrels'} ||= 1;
return undef;
}
# script_redmine_files(&domain, version, &opts, &upgrade-info)
# Returns a list of files needed by redmine, each of which is a hash ref
# containing a name, filename and URL
sub script_redmine_files
{
local ($d, $ver, $opts, $upgrade) = @_;
local @files = ( { 'name' => "source",
'file' => "redmine-$ver.tar.gz",
'url' => "http://rubyforge.org/frs/download.php/39477/redmine-$ver.tar.gz" } );
}
sub script_redmine_commands
{
return ("ruby", "gcc", "make");
}
# script_redmine_install(&domain, version, &opts, &files, &upgrade-info)
# Actually installs PhpWiki, and returns either 1 and an informational
# message, or 0 and an error
sub script_redmine_install
{
local ($d, $version, $opts, $files, $upgrade) = @_;
local ($out, $ex);
# Check for the gem command (here instead of earlier, as it may have been
# automatically installed).
&has_command("gem") || return (0, "The Ruby gem command is not installed");
# Get database settings
if ($opts->{'newdb'} && !$upgrade) {
local $err = &create_script_database($d, $opts->{'db'});
return (0, "Database creation failed : $err") if ($err);
}
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local $dbuser = &mysql_user($d);
local $dbpass = &mysql_pass($d);
local $dbhost = &get_database_host($dbtype);
local $dberr = &check_script_db_connection($dbtype, $dbname,
$dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr);
# Install mongrel first, as we need it to run redmine
local $err = &install_ruby_gem("mongrel", undef, 1);
if ($err) {
return (0, "Mongrel GEM install failed : <pre>$err</pre>");
}
if (!&find_rails_command("mongrel_rails")) {
return (0, "Mongrel appeared to install, but mongrel_rails command ".
"was not found");
}
# Install Ruby on Rails
$err = &install_ruby_gem("rails", undef, 1);
if ($err) {
return (0, "Rails on Rails install failed : <pre>$err</pre>");
}
# Install Ruby mysql driver
$err = &install_ruby_gem("mysql", undef, 1);
if ($err) {
return (0, "Rails MySQL driver install failed : <pre>$err</pre>");
}
if ($upgrade) {
# Stop the running redmine server
&script_redmine_stop_server($d, $opts);
}
# Extract tar file to temp dir and copy to target
local $temp = &transname();
local $err = &extract_script_archive($files->{'source'}, $temp, $d,
$opts->{'dir'}, "redmine-$ver");
$err && return (0, "Failed to extract source : $err");
local $cfilebase = "$opts->{'dir'}/config/database.example.yml";
if (!$upgrade) {
# Find a free port
$opts->{'port'} = &allocate_mongrel_port(undef, $opts->{'mongrels'});
# Setup DB config
local $cfile = "$opts->{'dir'}/config/database.yml";
&open_tempfile(CFILE, ">$cfile");
&print_tempfile(CFILE, "production:\n".
" adapter: mysql\n".
" database: $dbname\n".
" username: $dbuser\n".
" password: $dbpass\n".
" host: $dbhost\n");
&print_tempfile(CFILE, "development:\n".
" adapter: mysql\n".
" database: $dbname\n".
" username: $dbuser\n".
" password: $dbpass\n".
" host: $dbhost\n");
&close_tempfile(CFILE);
&set_ownership_permissions($d->{'uid'}, $d->{'ugid'}, undef, $cfile);
# Run the DB creation script
$out = &run_as_domain_user($d, "cd ".quotemeta($opts->{'dir'})." && ".
"rake db:migrate RAILS_ENV=production");
if ($?) {
return (-1, "Database creation failed : <pre>$out</pre>");
}
}
# Fix up URL base
if ($opts->{'path'} ne '/') {
# In config file
local $efile = "$opts->{'dir'}/config/environment.rb";
local $lref = &read_file_lines($efile);
foreach my $l (@$lref) {
if ($l =~ /^#*\s*ActionController::AbstractRequest.relative_url_root/) {
$l = "ActionController::AbstractRequest.relative_url_root = '$opts->{'path'}'";
}
}
&flush_file_lines($efile);
# In CSS file
local $cssfile = "$opts->{'dir'}/public/stylesheets/redmine/mephisto.css";
local $lref = &read_file_lines($cssfile);
local $path = $opts->{'path'};
foreach my $l (@$lref) {
$l =~ s/url\(\/images/url\(${path}\/images/g;
}
&flush_file_lines($cssfile);
# In liquid.layout
local $lqfile = "$opts->{'dir'}/themes/default/layouts/layout.liquid";
local $lref = &read_file_lines($lqfile);
foreach my $l (@$lref) {
$l =~ s/<a\s+href="\/">/<a href="$path">/;
$l =~ s/action="\/search"/action="$path\/search"/;
}
&flush_file_lines($lqfile);
}
# Create log dir if missing, for mongrel
local $logdir = "$opts->{'dir'}/log";
if (!-d $logdir) {
&make_dir($logdir, 0700);
&set_ownership_permissions($d->{'uid'}, $d->{'ugid'}, undef, $logdir);
}
# Start the servers
local (@logs, @startcmds, @stopcmds);
local @ports = split(/\s+/, $opts->{'port'});
local $err = &mongrel_rails_start_servers($d, $opts, "redmine", \@startcmds,
\@stopcmds, \@logs);
return (0, $err) if ($err);
$opts->{'log'} = join(" ", @logs);
# Setup an Apache proxy for it
&setup_mongrel_proxy($d, $opts->{'path'}, $opts->{'port'},
$opts->{'path'} eq '/' ? undef : $opts->{'path'});
if (!$upgrade) {
# Configure server to start at boot
&setup_mongrel_startup($d,
join("\n", @startcmds),
join("\n", @stopcmds),
$opts,
1, "redmine-".$ports[0], "Mephisto Wiki");
}
if (!$upgrade) {
# Deny regular web access to directory
&protect_rails_directory($d, $opts);
}
local $url = &script_path_url($d, $opts);
local $adminurl = $url."login";
local $rp = $opts->{'dir'};
$rp =~ s/^$d->{'home'}\///;
return (1, "redmine installation complete. Go to <a target=_new href='$adminurl'>$adminurl</a> to manage it.<br />
", "Under $rp using $dbtype database $dbname", $url, "admin", "admin");
}
# script_redmine_uninstall(&domain, version, &opts)
# Un-installs a redmine installation, by deleting the directory and database.
# Returns 1 on success and a message, or 0 on failure and an error
sub script_redmine_uninstall
{
local ($d, $version, $opts) = @_;
# Shut down the server process
&script_redmine_stop_server($d, $opts);
# Remove bootup script
&delete_mongrel_startup($d, $opts, "mongrel_rails start", $opts->{'port'});
# Remove the contents of the target directory
local $derr = &delete_script_install_directory($d, $opts);
return (0, $derr) if ($derr);
# Remove proxy Apache config entry for /redmine
&delete_mongrel_proxy($d, $opts->{'path'});
&register_post_action(\&restart_apache);
# Remove all redmine tables from the database
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
&require_mysql();
foreach $t (&mysql::list_tables($dbname)) {
if (&indexof($t, @redmine_tables) >= 0) {
&mysql::execute_sql_logged($dbname,
"drop table ".&mysql::quotestr($t));
}
}
# Take out the DB
if ($opts->{'newdb'}) {
&delete_script_database($d, $opts->{'db'});
}
return (1, "redmine directory and tables deleted.");
}
# script_redmine_stop(&domain, &sinfo)
# Stop running mongrel process
sub script_redmine_stop
{
local ($d, $sinfo) = @_;
&script_redmine_stop_server($d, $sinfo->{'opts'});
&delete_mongrel_startup($d, $sinfo->{'opts'},
"mongrel_rails start", $sinfo->{'opts'}->{'port'});
}
sub script_redmine_latest
{
return ( "http://rubyforge.org/frs/?group_id=1850",
"redmine-([0-9\\.]+).tar.gz" );
}
sub script_redmine_start_server
{
local ($d, $opts) = @_;
return &mongrel_rails_start_servers($d, $opts, "redmine");
}
sub script_redmine_status_server
{
local ($d, $opts) = @_;
return &mongrel_rails_status_servers($d, $opts);
}
# script_redmine_stop_server(&domain, &opts)
# Stop an redmine webserver
sub script_redmine_stop_server
{
local ($d, $opts) = @_;
&mongrel_rails_stop_servers($d, $opts);
}
sub script_redmine_site
{
return 'http://www.redmine.org/';
}
1;
# @redmine_tables = (
# );
# script_redmine_desc()
sub script_redmine_desc
{
return "redmine";
}
sub script_redmine_uses
{
return ( "ruby", "proxy" );
}
sub script_redmine_longdesc
{
return "Redmine is a flexible project management web application.";
}
# script_redmine_versions()
sub script_redmine_versions
{
return ( "0.7.3" );
}
sub script_redmine_category
{
return "Project Management";
}
# script_redmine_depends(&domain, version)
# Check for ruby command, ruby gems, mod_proxy
sub script_redmine_depends
{
local ($d, $ver) = @_;
local @rv;
&has_command("ruby") || push(@rv, "The ruby command is not installed");
&require_apache();
&has_proxy_balancer($d) ||
push(@rv, "The Apache proxy module is not installed");
&has_domain_databases($d, [ "mysql" ]) ||
push(@rv, "redmine requires either MySQL database");
return @rv;
}
# script_redmine_params(&domain, version, &upgrade-info)
# Returns HTML for table rows for options for installing Redmine
sub script_redmine_params
{
local ($d, $ver, $upgrade) = @_;
local $rv;
local $hdir = &public_html_dir($d, 1);
if ($upgrade) {
# Options are fixed when upgrading
local ($dbtype, $dbname) = split(/_/, $upgrade->{'opts'}->{'db'}, 2);
$rv .= &ui_table_row("Database for redmine tables", $dbname);
local $dir = $upgrade->{'opts'}->{'dir'};
$dir =~ s/^$d->{'home'}\///;
$rv .= &ui_table_row("Install directory", $dir);
}
else {
# Show editable install options
local @dbs = &domain_databases($d, [ "mysql" ]);
$rv .= &ui_table_row("Database for redmine tables",
&ui_database_select("db", undef, \@dbs, $d, "redmine"));
$rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>",
&ui_opt_textbox("dir", "redmine", 30,
"At top level"));
$rv .= &show_mongrels_ports_input($d);
}
return $rv;
}
# script_redmine_parse(&domain, version, &in, &upgrade-info)
# Returns either a hash ref of parsed options, or an error string
sub script_redmine_parse
{
local ($d, $ver, $in, $upgrade) = @_;
if ($upgrade) {
# Options are always the same
return $upgrade->{'opts'};
}
else {
local $hdir = &public_html_dir($d, 0);
$in->{'dir_def'} || $in->{'dir'} =~ /\S/ && $in->{'dir'} !~ /\.\./ ||
return "Missing or invalid installation directory";
local $dir = $in->{'dir_def'} ? $hdir : "$hdir/$in->{'dir'}";
local ($newdb) = ($in->{'db'} =~ s/^\*//);
local $mongrels = &parse_mongrels_ports_input($d, $in);
return $mongrels if (!int($mongrels));
return { 'db' => $in->{'db'},
'newdb' => $newdb,
'dir' => $dir,
'mongrels' => $mongrels,
'path' => $in{'dir_def'} ? "/" : "/$in{'dir'}",
};
}
}
# script_redmine_check(&domain, version, &opts, &upgrade-info)
# Returns an error message if a required option is missing or invalid
sub script_redmine_check
{
local ($d, $ver, $opts, $upgrade) = @_;
if (-r "$opts->{'dir'}/config/database.yml") {
return "Redmine appears to be already installed in the selected directory";
}
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
foreach my $t (@redmine_tables) {
local $clash = &find_database_table($dbtype, $dbname, $t);
$clash && return "redmine appears to be already using the selected database (table $clash)";
}
$opts->{'mongrels'} ||= 1;
return undef;
}
# script_redmine_files(&domain, version, &opts, &upgrade-info)
# Returns a list of files needed by redmine, each of which is a hash ref
# containing a name, filename and URL
sub script_redmine_files
{
local ($d, $ver, $opts, $upgrade) = @_;
local @files = ( { 'name' => "source",
'file' => "redmine-$ver.tar.gz",
'url' => "http://rubyforge.org/frs/download.php/39477/redmine-$ver.tar.gz" } );
}
sub script_redmine_commands
{
return ("ruby", "gcc", "make");
}
# script_redmine_install(&domain, version, &opts, &files, &upgrade-info)
# Actually installs PhpWiki, and returns either 1 and an informational
# message, or 0 and an error
sub script_redmine_install
{
local ($d, $version, $opts, $files, $upgrade) = @_;
local ($out, $ex);
# Check for the gem command (here instead of earlier, as it may have been
# automatically installed).
&has_command("gem") || return (0, "The Ruby gem command is not installed");
# Get database settings
if ($opts->{'newdb'} && !$upgrade) {
local $err = &create_script_database($d, $opts->{'db'});
return (0, "Database creation failed : $err") if ($err);
}
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local $dbuser = &mysql_user($d);
local $dbpass = &mysql_pass($d);
local $dbhost = &get_database_host($dbtype);
local $dberr = &check_script_db_connection($dbtype, $dbname,
$dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr);
# Install mongrel first, as we need it to run redmine
local $err = &install_ruby_gem("mongrel", undef, 1);
if ($err) {
return (0, "Mongrel GEM install failed : <pre>$err</pre>");
}
if (!&find_rails_command("mongrel_rails")) {
return (0, "Mongrel appeared to install, but mongrel_rails command ".
"was not found");
}
# Install Ruby on Rails
$err = &install_ruby_gem("rails", undef, 1);
if ($err) {
return (0, "Rails on Rails install failed : <pre>$err</pre>");
}
# Install Ruby mysql driver
$err = &install_ruby_gem("mysql", undef, 1);
if ($err) {
return (0, "Rails MySQL driver install failed : <pre>$err</pre>");
}
if ($upgrade) {
# Stop the running redmine server
&script_redmine_stop_server($d, $opts);
}
# Extract tar file to temp dir and copy to target
local $temp = &transname();
local $err = &extract_script_archive($files->{'source'}, $temp, $d,
$opts->{'dir'}, "redmine-$ver");
$err && return (0, "Failed to extract source : $err");
local $cfilebase = "$opts->{'dir'}/config/database.example.yml";
if (!$upgrade) {
# Find a free port
$opts->{'port'} = &allocate_mongrel_port(undef, $opts->{'mongrels'});
# Setup DB config
local $cfile = "$opts->{'dir'}/config/database.yml";
&open_tempfile(CFILE, ">$cfile");
&print_tempfile(CFILE, "production:\n".
" adapter: mysql\n".
" database: $dbname\n".
" username: $dbuser\n".
" password: $dbpass\n".
" host: $dbhost\n");
&print_tempfile(CFILE, "development:\n".
" adapter: mysql\n".
" database: $dbname\n".
" username: $dbuser\n".
" password: $dbpass\n".
" host: $dbhost\n");
&close_tempfile(CFILE);
&set_ownership_permissions($d->{'uid'}, $d->{'ugid'}, undef, $cfile);
# Run the DB creation script
$out = &run_as_domain_user($d, "cd ".quotemeta($opts->{'dir'})." && ".
"rake db:migrate RAILS_ENV=production");
if ($?) {
return (-1, "Database creation failed : <pre>$out</pre>");
}
}
# Fix up URL base
if ($opts->{'path'} ne '/') {
# In config file
local $efile = "$opts->{'dir'}/config/environment.rb";
local $lref = &read_file_lines($efile);
foreach my $l (@$lref) {
if ($l =~ /^#*\s*ActionController::AbstractRequest.relative_url_root/) {
$l = "ActionController::AbstractRequest.relative_url_root = '$opts->{'path'}'";
}
}
&flush_file_lines($efile);
# In CSS file
local $cssfile = "$opts->{'dir'}/public/stylesheets/redmine/mephisto.css";
local $lref = &read_file_lines($cssfile);
local $path = $opts->{'path'};
foreach my $l (@$lref) {
$l =~ s/url\(\/images/url\(${path}\/images/g;
}
&flush_file_lines($cssfile);
# In liquid.layout
local $lqfile = "$opts->{'dir'}/themes/default/layouts/layout.liquid";
local $lref = &read_file_lines($lqfile);
foreach my $l (@$lref) {
$l =~ s/<a\s+href="\/">/<a href="$path">/;
$l =~ s/action="\/search"/action="$path\/search"/;
}
&flush_file_lines($lqfile);
}
# Create log dir if missing, for mongrel
local $logdir = "$opts->{'dir'}/log";
if (!-d $logdir) {
&make_dir($logdir, 0700);
&set_ownership_permissions($d->{'uid'}, $d->{'ugid'}, undef, $logdir);
}
# Start the servers
local (@logs, @startcmds, @stopcmds);
local @ports = split(/\s+/, $opts->{'port'});
local $err = &mongrel_rails_start_servers($d, $opts, "redmine", \@startcmds,
\@stopcmds, \@logs);
return (0, $err) if ($err);
$opts->{'log'} = join(" ", @logs);
# Setup an Apache proxy for it
&setup_mongrel_proxy($d, $opts->{'path'}, $opts->{'port'},
$opts->{'path'} eq '/' ? undef : $opts->{'path'});
if (!$upgrade) {
# Configure server to start at boot
&setup_mongrel_startup($d,
join("\n", @startcmds),
join("\n", @stopcmds),
$opts,
1, "redmine-".$ports[0], "Mephisto Wiki");
}
if (!$upgrade) {
# Deny regular web access to directory
&protect_rails_directory($d, $opts);
}
local $url = &script_path_url($d, $opts);
local $adminurl = $url."login";
local $rp = $opts->{'dir'};
$rp =~ s/^$d->{'home'}\///;
return (1, "redmine installation complete. Go to <a target=_new href='$adminurl'>$adminurl</a> to manage it.<br />
", "Under $rp using $dbtype database $dbname", $url, "admin", "admin");
}
# script_redmine_uninstall(&domain, version, &opts)
# Un-installs a redmine installation, by deleting the directory and database.
# Returns 1 on success and a message, or 0 on failure and an error
sub script_redmine_uninstall
{
local ($d, $version, $opts) = @_;
# Shut down the server process
&script_redmine_stop_server($d, $opts);
# Remove bootup script
&delete_mongrel_startup($d, $opts, "mongrel_rails start", $opts->{'port'});
# Remove the contents of the target directory
local $derr = &delete_script_install_directory($d, $opts);
return (0, $derr) if ($derr);
# Remove proxy Apache config entry for /redmine
&delete_mongrel_proxy($d, $opts->{'path'});
&register_post_action(\&restart_apache);
# Remove all redmine tables from the database
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
&require_mysql();
foreach $t (&mysql::list_tables($dbname)) {
if (&indexof($t, @redmine_tables) >= 0) {
&mysql::execute_sql_logged($dbname,
"drop table ".&mysql::quotestr($t));
}
}
# Take out the DB
if ($opts->{'newdb'}) {
&delete_script_database($d, $opts->{'db'});
}
return (1, "redmine directory and tables deleted.");
}
# script_redmine_stop(&domain, &sinfo)
# Stop running mongrel process
sub script_redmine_stop
{
local ($d, $sinfo) = @_;
&script_redmine_stop_server($d, $sinfo->{'opts'});
&delete_mongrel_startup($d, $sinfo->{'opts'},
"mongrel_rails start", $sinfo->{'opts'}->{'port'});
}
sub script_redmine_latest
{
return ( "http://rubyforge.org/frs/?group_id=1850",
"redmine-([0-9\\.]+).tar.gz" );
}
sub script_redmine_start_server
{
local ($d, $opts) = @_;
return &mongrel_rails_start_servers($d, $opts, "redmine");
}
sub script_redmine_status_server
{
local ($d, $opts) = @_;
return &mongrel_rails_status_servers($d, $opts);
}
# script_redmine_stop_server(&domain, &opts)
# Stop an redmine webserver
sub script_redmine_stop_server
{
local ($d, $opts) = @_;
&mongrel_rails_stop_servers($d, $opts);
}
sub script_redmine_site
{
return 'http://www.redmine.org/';
}
1;
i moved it around btw and it still doesnt work, virtualmin doesnt seem to see the script at all...
<b>Joe wrote:</b>
<div class='quote'>You'll probably want to look at the install scripts for Radiant or Mephisto, which are applications that use the Ruby on Rails stack, which would probably provide a good starting point. I think we've heard a few others wishing for Redmine, so I wouldn't rule out seeing it included in the next couple of revisions.</div>
No it is not a bug is a good feature - so when you will upgrade webmin and virtualmin your own scripts won't dissappear.
<div class='quote'>i moved it around btw and it still doesnt work, virtualmin doesnt seem to see the script at all... </div>
I suspect there's a bug in your copy of the script that prevents it from being parsed.
Try:
perl -c redmine.pl
If there are errors, it won't work, and Virtualmin won't "see" it.
--
Check out the forum guidelines!
<div class='quote'>hannibal:/etc/webmin/virtual-server/scripts# perl -c redmine.pl
syntax error at redmine.pl line 58, near "/;"
Unmatched ( in regex; marked by <-- HERE in m/url( <-- HERE / at redmine.pl line 239.</div>
indeed, there is an error in the script.
i just copy/pasted it from the one rawww pasted in this thread..
Sorry it was my fault.
Forum post throws away backslash signs. I will try to attache right file if this post will allow me to. [file name=redmine.txt size=10882]http://www.virtualmin.com/components/com_fireboard/uploaded/files/redmin...
<div class='quote'>Found http://rubyforge.org:80/frs/download.php/39477/redmine-0.7.3.tar.gz in cache ..
Now installing redmine version 0.7.3 ..
--------------------------------------------------------------------------------
Failed to install script : Failed to open /home/foodomain.tld/public_html/redmine/public/stylesheets/redmine/mephisto.css for writing : Bad file descriptor</div>
:(
When this happend?
During installation?
Are you running some other rails applications on your server?
My script is derivated from other install script and I hope that I've followed API instructions.
File descriptor seems to be problem somewher else.
Please let me know if you will find something.
I'm not sure why it won't let you upload a txt file. Did it give you an error, or just fail silently?
You could open a ticket requesting inclusion and attach it to the ticket (I'm pretty sure attachments in the tracker are working well). Looks sane from here, but I haven't tested it. Jamie will want to poke at it, and possibly "adopt" it into the official source tree, if you'd like to see it maintained by us going forward.
--
Check out the forum guidelines!
I can help you with this install script. If you will adpot it in official release I can upgrade it, because we are using Redmine for our clinets and we would like to continue with it.
It gave me "You can only upload: txt,gziped ... files" javascript error. I don't know why. I am using Joomla! for many years and fireboard too but I've never encountered simmilar problem.
where do i have to put that install script in order to use it?
i'm using redmine outside of virtualmin right now and having some problems, so i would love to have it inside of virtualmin...
Virtualmin scripts are located at $prefix/etc/webmin/virtual-server/scripts/ - you can put that file there or you can install it by virtualmin scprits managing page.
hm, i copy/pasted your code, saved that into a redmine.pl file, and uploaded it to the script installer module in virtualmin.
it says it was installed fine, but the script isntaller is nowhere to be found.
if i look at the available modules under "disable scripts" page, i can see under "others" a script without title that says "third party" and is disabled. if i enable it and save the changes, changes are not retained.
any ideas?
Is script located at /etc/webmin/virtual-server/scrips ?
And which editor did you use?
oh shit, it installed the script into /etc/webmin/virtual-server/scripts
however all the other scripts are located in /usr/share/webmin/virtual-server/scripts
i have a debian 4.0 system.
i guess this is a virtualmin bug?
Hi!
This happens on install. There are no other rails applications on the server or domain.
Other install scripts work fine!