Project

General

Profile

2 instances at once

Added by Marc Arbour over 15 years ago

Hi.

I have today's trunk running just fine and I want to start development of a plugin.

Can anyone direct me as hot to go about this:

I would like to have 2 different sets of files for my redmine installations to develop my plugin without impacting my production environment.

I already know how to run prod on port 3000 OR dev on port 3001, but not both at once... And less again running on 2 differents sets of file sources.

Any pointers would be appreciated.

Thanks in advance.

Marc Arbour


Replies (15)

RE: 2 instances at once - Added by Jean-Baptiste Barth over 15 years ago

It's quite easy, you just have to create 2 different directories (for instance /opt/redmine_prod/ and /opt/redmine_dev/) with all the files in both. Each one may have a different configuration of config/database.yml (you'll need 2 different databases). Then start the two apps on different ports and that's all !

RE: 2 instances at once - Added by Marc Arbour over 15 years ago

Hi Jean-Baptiste.

I may have done something wrong for I have done exactly this.

My directories are /home/redmine/redmine and /home/redmine/redminedev. My database.yml files differ in the fact they point to 2 tables with the same user.

It works fine when I do this: ruby /home/redmine/redmine/redmineserver.rb start f - e production -p 3000
It also works fine when I do this: ruby /home/redmine/redminedev/redmineserver.rb start -f -
-e production -p 3001 (or -e dev here... database.yml if config'd that way)

But running 1 command after the other without stopping the 1st instance, it results in: ERROR: there is already one or more instance(s) of the program running

Is there something I have missed?

Regards

Marc

RE: 2 instances at once - Added by Artem Konoplin over 15 years ago

Maybe you need to rename your script (for ex. in dev directory) and run like this:

ruby /home/redmine/redmine/redmineserver.rb start f - e production -p 3000
ruby /home/redmine/redminedev/redmineserver_dev.rb start -f -
-e production -p 3001

RE: 2 instances at once - Added by Jean-Baptiste Barth over 15 years ago

I don't know this script : redmineserver.rb. Where did you get this and what does it contain ?
Maybe this script forbids to run two instances on the same host : it's a common place in linux start scripts to create a lock file in /var/lock/ or /var/run/, but as far as I know this script is not provided with redmine standard distribution, and the error message is unknown for me.

RE: 2 instances at once - Added by Marc Arbour over 15 years ago

Hi Jean-Baptiste

Here is the content of that file unknown:

[root@www redminedev]# cat /home/redmine/redmine/redmineserver.rb
# this is myserver_control.rb

  require 'rubygems'        # if you use RubyGems
  require 'daemons'

  Daemons.run('/home/redmine/redmine/script/server')

I also did try to rename the file as suggested by Artem Konoplin without success.

I also tried renaming the server file in script directory as well... I seem to get nowhere.

Any other ideas?

Regards

Marc.

RE: 2 instances at once - Added by Thomas Pihl over 15 years ago

Why don't you run your dev instance with ruby script/server (and the usual startup stuff)? No need to make a daemon out of that one, is it?

If i read your code correctly you are running the server script without arguments at all. If that is correct your production code speed must be real bad. Or how would your redmineserver.rb pass arguments to Daemons.run? If you are using a production instance, make sure it runs as production (what log are growing, development.log or production.log?).

That said, i do run my dev environ under phusion passenger nowadays (unless i need to do some debugging). Change code in dev and then just a "touch tmp/restart.txt" to restart dev environment. But then again, as soon as i try to do something new, i go back to "ruby script/server -p 3001" (or real lazy, netbeans debugger).
/T

RE: 2 instances at once - Added by Jean-Baptiste Barth over 15 years ago

Marc : ok, so here is the problem, in your script ! Renaming the script will have no effect, but *inside* the script, you tell it to start the app under "/home/redmine/redmine" ; so you have to change the script in you redmine dev directory, replacing the daemonization with a @Daemons.run('/home/redmine/redminedev/script/server'). Did you try this ?

RE: 2 instances at once - Added by Jean-Baptiste Barth over 15 years ago

(oups, the formatting of my answer is not what I expected, but if you ommit the "@" it can be understood easily I think. Sorry for the double post...)

RE: 2 instances at once - Added by Marc Arbour over 15 years ago

JB: Yes I have tried. With the same result.

Thomas:

ruby script/server -p 3001

did the trick

Thomas again: my dev environment is way slower ran this way per comparison to my prod environment ran as "ruby /home/redmine/redmine/redmineserver.rb start f - -e production"

Is this what you call deamonized without parameters? Would you suggest something else? (I need to say that my prod env is way more performent then my dev as it is)

Thanks for all the help guys.

Best regards.

Marc

RE: 2 instances at once - Added by Artem Konoplin over 15 years ago

Hi,Marc!

Can you show to us content of the '/home/redmine/redmine/script/server'?

RE: 2 instances at once - Added by Artem Konoplin over 15 years ago

Pid-Files generated by Daemons have to following format:

<scriptname>.rb<number>.pid

I think you need to rename not your 'redmineserver.rb', but '/home/redmine/redmine/script/server'.
For ex:

#redmine/redmineserver.rb

...
Daemons.run('/home/redmine/redmine/script/server')
...

#redminedev/redmineserver.rb

...
Daemons.run('/home/redmine/redmine/script/serverdev')
...

RE: 2 instances at once - Added by Jean-Baptiste Barth over 15 years ago

Artem: for the dev environment, you wanted to say

Daemons.run('/home/redmine/redminedev/script/serverdev')
no ? ;-)

RE: 2 instances at once - Added by Marc Arbour over 15 years ago

Hi Guys.

Artem's got it right with Jean-Baptiste's correction.

Everything works like a charm. Though the dev environment is much slower then the prod, I can play in my code at heart's content.

Here is the content of the requested file:

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'

Isn't it a standard Redmine file?

Thanks again guys. Your help got me through the understanding of "processed" and "deamonized"!

Marc

RE: 2 instances at once - Added by Marv Fr almost 6 years ago

Hey guys,

i just run a new container in Docker on my NAS and changed the path and port and when I want to start it is stops after 5 seconds ... what do i do wrong ?

    (1-15/15)