phusion / passenger

A fast and robust web server and application server for Ruby, Python and Node.js
https://www.phusionpassenger.com/
MIT License
5k stars 548 forks source link

redmine production and development in multiple instance #2309

Open ashrafalzyoud opened 4 years ago

ashrafalzyoud commented 4 years ago

database.yml

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
  pool: 10

development:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
  pool: 10

my nginx

server {
        listen 80;
        server_name www.ashrafalzyod.com;

        error_log /var/log/nginx/ashrafalzyoud.error.log;
        access_log /var/log/nginx/ashrafalzyoud.access.log;

        root /home/redmine/4.11/public;

        passenger_enabled on;
        passenger_app_env development;
        passenger_app_group_name ashrafalzyoud;
        passenger_min_instances 3;
        passenger_friendly_error_pages on;
        passenger_ruby /home/redmine/.rbenv/versions/2.6.6/bin/ruby;
        client_max_body_size    10m;
}
server {
        listen 80;
        server_name www.ashrafalzyod.com;
        root /home/redmine/4.11/public;

         passenger_enabled on;
         passenger_app_env production;

        passenger_app_group_name ashrafalzyoud;
        passenger_friendly_error_pages on;
        passenger_ruby /home/redmine/.rbenv/versions/2.6.6/bin/ruby;
        client_max_body_size    10m;
}
passenger_pre_start http://www.ashrafalzyoud.com/;

passenger-status

redmine@172:~/4.11$ passenger-status 
*** Cleaning stale instance directory /tmp/passenger.UjIOTlH
    Warning: Operation not permitted @ rb_file_chown - /tmp/passenger.UjIOTlH/.
It appears that multiple Phusion Passenger instances are running. Please
select a specific one by running:

  passenger-status <NAME>

The following Phusion Passenger instances are running:

Name                       PID      Description
--------------------------------------------------------------------------
oR2Fxrti                   41650    nginx/1.18.0 Phusion_Passenger/6.0.6
XBKtMEPL                   89988    nginx/1.18.0 Phusion_Passenger/6.0.6

its normal to be in multiple instance or no??

ashrafalzyoud commented 4 years ago

HowTo have both development and production environment available from passenger

ashrafalzyoud commented 4 years ago
redmine@172:~/4.11$ passenger-memory-stats 
Version: 6.0.6
Date   : 2020-09-20 00:13:38 +0300
------------- Apache processes -------------
*** WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your 'apxs2' executable's filename, or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.

----------- Nginx processes -----------
PID     PPID    VMSize   Private  Name
---------------------------------------
115445  1       14.1 MB  ?        nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
115446  115445  14.5 MB  ?        nginx: worker process
### Processes: 2
### Total private dirty RSS: 0.00 MB (?)

----- Passenger processes ------
PID     VMSize    Private  Name
--------------------------------
111637  296.1 MB  2.8 MB   Passenger watchdog
111640  579.6 MB  4.7 MB   Passenger core
111657  29.5 MB   1.3 MB   /usr/lib/passenger/support-binaries/PassengerAgent temp-dir-toucher /tmp/passenger-standalone.rshpqb --cleanup --daemonize --pid-file /tmp/passenger-standalone.rshpqb/temp_dir_toucher.pid --log-file /home/redmine/4.11/log/passenger.3000.log --nginx-pid 111648
115430  296.2 MB  ?        Passenger watchdog
115437  580.1 MB  ?        Passenger core
115879  281.5 MB  32.0 MB  Passenger AppPreloader: /home/redmine/4.11
115921  414.3 MB  32.0 MB  Passenger AppPreloader: /home/redmine/4.11 (forking...)
115954  326.2 MB  8.4 MB   Passenger AppPreloader: /home/redmine/4.11
116156  458.2 MB  74.3 MB  Passenger AppPreloader: /home/redmine/4.11 (forking...)
116176  458.3 MB  8.5 MB   Passenger AppPreloader: /home/redmine/4.11 (forking...)
### Processes: 10
### Total private dirty RSS: 164.02 MB (?)
*** WARNING: Please run this tool with sudo. Otherwise the private dirty RSS (a reliable metric for real memory usage) of processes cannot be determined.
ashrafalzyoud commented 4 years ago
redmine@172:~/4.11$ passenger-status 4YCyHrv3
Version : 6.0.6
Date    : 2020-09-20 00:16:33 +0300
Instance: 4YCyHrv3 (nginx/1.18.0 Phusion_Passenger/6.0.6)

----------- General information -----------
Max pool size : 20
App groups    : 1
Processes     : 2
Requests in top-level queue : 0

----------- Application groups -----------
/home/redmine/4.11 (production):
  App root: /home/redmine/4.11
  Requests in queue: 0
  * PID: 116156   Sessions: 0       Processed: 0       Uptime: 4m 3s
    CPU: 0%      Memory  : 74M     Last used: 4m 3s ago
  * PID: 116176   Sessions: 0       Processed: 0       Uptime: 4m 3s
    CPU: 0%      Memory  : 8M      Last used: 4m 3s ago
ashrafalzyoud commented 4 years ago
redmine@172:~/4.11$ passenger-status xpNHYCYH
Version : 6.0.6
Date    : 2020-09-20 00:17:05 +0300
Instance: xpNHYCYH (nginx/1.18.0 Phusion_Passenger/6.0.6)

----------- General information -----------
Max pool size : 6
App groups    : 1
Processes     : 1
Requests in top-level queue : 0

----------- Application groups -----------
/home/redmine/4.11 (development):
  App root: /home/redmine/4.11
  Requests in queue: 0
  * PID: 115921   Sessions: 0       Processed: 0       Uptime: 4m 56s
    CPU: 0%      Memory  : 160M    Last used: 4m 56s ago
ashrafalzyoud commented 4 years ago

@vividtone if u can help or its normal mutiple instance?? in redmine

ashrafalzyoud commented 4 years ago

Ruby version 2.6.6-p146 (2020-03-31) [x86_64-linux] Rails version 5.2.4.2 ubuntu 20.04

CamJN commented 4 years ago

It is not normal for Nginx to start multiple Passenger instances. And your nginx config looks fine. How did you install Passenger and Nginx?

ashrafalzyoud commented 4 years ago

https://www.phusionpassenger.com/docs/tutorials/installation/meteor/

ashrafalzyoud commented 4 years ago

Ubuntu 20.04 Nginx 1.18 Passenger 6.0.6 Ruby 2.6.6

CamJN commented 4 years ago

Those instructions do not cover installing nginx.

ashrafalzyoud commented 2 years ago

I'm conflict how I install passenger with Nginx to good performance I'm see tow way 1- https://www.phusionpassenger.com/library/install/nginx/install/oss/tarball/

2-https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/nginx/install/oss/focal.html

Which the best ?!? @CamJN @FooBarWidget