installer/unix-like/create_texts.rb in rhoconnect-3.2.0.beta1 vs installer/unix-like/create_texts.rb in rhoconnect-3.2.0.beta2
- old
+ new
@@ -371,15 +371,14 @@
File.open('/opt/nginx/conf/nginx.conf', 'w' ) { |f| f << nginx_server_conf }
Dir.mkdir "/opt/nginx/conf/conf.d" unless File.exist? "/opt/nginx/conf/conf.d"
rho_vhost_conf = <<_VHOST_CONF_
upstream thin_cluster {
- server unix:/tmp/thin.sock;
- #server unix:/tmp/thin.0.sock;
- #server unix:/tmp/thin.1.sock;
- #server unix:/tmp/thin.2.sock;
- #server unix:/tmp/thin.3.sock;
+ server unix:/tmp/thin.0.sock;
+ server unix:/tmp/thin.1.sock;
+# server unix:/tmp/thin.2.sock;
+# server unix:/tmp/thin.3.sock;
}
server {
listen 80;
root /opt/nginx/html/#{app_name}/public; # <-- be sure to point to 'public' folder of your application!
@@ -477,19 +476,25 @@
readme = <<_NGINX_README_
4) Installer compiled Nginx web server (/opt/nginx) with the following configuration files:
- Nginx start-up script (/etc/init.d/nginx)
- Nginx logrotate settings (/etc/logrotate.d/nginx)
- Nginx configuration file (/opt/nginx/conf/nginx.conf)
- - passenger configuration file and virtual host template for rhoconnect application
- (/opt/nginx/conf/conf.d/passenger.conf and /opt/nginx/conf/conf.d/rhoconnect.conf)
+ - virtual host template for rhoconnect application
+ (/opt/nginx/conf/conf.d/rhoconnect.conf)
- To complete setup of web server
+ To change default setup of web server
A) Configure virtual host for rhoconnect application:
Edit the file /opt/nginx/conf/conf.d/rhoconnect.conf so that it reflects your specifications.
-
B) As root user start server to pick up the changes:
/etc/init.d/nginx start
+
+5) Installer also configured Thin app server with the following configuration files:
+ - Thin start-up script (/etc/init.d/thin)
+ - Thin configuration file (/etc/thin/rhoapp.yml)
+
+ By default, init script start cluster of 2 servers running on UNIX domain sockets.
+ Nginx connected to cluster via upstream block in nginx config file.
_NGINX_README_
readme
end
def generate_rhoapp(rho_path)
@@ -523,29 +528,24 @@
`chown -R nginx:nginx benchapp/`
end
def config_and_install_thin_scripts(rho_path)
puts "Configuring and installing thin scripts ..."
- `#{rho_path}/bin/thin install`
+ `env PATH=#{rho_path}/bin:$PATH thin install`
+ # >> Installing thin service at /etc/rc.d/thin (RedHat) or /etc/init.d/thin (Ubuntu) ...
- # >> Installing thin service at /etc/rc.d/thin ...
- # mkdir -p /etc/rc.d
- # writing /etc/rc.d/thin
- # chmod +x /etc/rc.d/thin
- # mkdir -p /etc/thin
- #
- # To configure thin to start at system boot:
- # on RedHat like systems:
- # sudo /sbin/chkconfig --level 345 thin on
- # on Debian-like systems (Ubuntu):
- # sudo /usr/sbin/update-rc.d -f thin defaults
- # on Gentoo:
- # sudo rc-update add thin default
- #
- # Then put your config files in /etc/thin
+ thin_conf_file = (File.exists?('/etc/init.d/thin')) ? "/etc/init.d/thin" : "/etc/rc.d/thin"
+ File.open("/tmp/thin", 'w') do |f|
+ File.foreach(thin_conf_file) do |line|
+ f << "export PATH=/opt/rhoconnect/bin:$PATH" << "\n" if line =~ /^DAEMON/
+ f << line
+ end
+ end
+ File.rename("/tmp/thin", thin_conf_file)
+ `chmod +x #{thin_conf_file}`
- `#{rho_path}/bin/thin config -C /etc/thin/rhoapp.yml -c /opt/nginx/html/rhoapp/ --socket /tmp/thin.sock --log /opt/nginx/logs/thin.log --pid /var/run/thin.pid -e production`
+ `env PATH=#{rho_path}/bin:$PATH thin config -C /etc/thin/rhoapp.yml -c /opt/nginx/html/rhoapp/ --socket /tmp/thin.sock --servers 2 --log /opt/nginx/logs/thin.log --pid /var/run/thin.pid -e production`
`ln -s /etc/rc.d/thin /etc/init.d/.` if File.directory?('/etc/rc.d')
end
def create_texts
if @redis
@@ -591,21 +591,21 @@
2) Rhoconnect 'benchapp' application is created in /opt/nginx/html directory. To run it
A) As root user start redis and nginx servers:
/etc/init.d/redis start
/etc/init.d/nginx start
B) To verify that application up and running open web console in your browser:
- http://localhost/console/
+ http://server_ip_address
_NGINX_TO_DO_
else
server_todo_list = <<_NGINX_TO_DO_
2) Try rhoconnect 'rhoapp' application, created in /opt/nginx/html directory
- A) As root user start redis and nginx servers:
+ A) As root user start redis, nginx and thin servers:
/etc/init.d/redis start
/etc/init.d/nginx start
/etc/init.d/thin start
B) Open RhoConnect application web console in your browser:
- http://localhost/console/
+ http://server_ip_address
_NGINX_TO_DO_
end
afterwords << about_app