This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
performexa_application_setup [2021/08/01 16:34] 157.51.110.15 [Deploy the application] |
performexa_application_setup [2021/10/28 06:46] (current) 157.49.205.44 |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| =====Install rbenv and Dependencies===== | =====Install rbenv and Dependencies===== | ||
| - | First, update your package list | + | First, install the dependencies required to install Ruby: |
| - | **sudo apt update** | + | **sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel** |
| - | + | ||
| - | Next, install the dependencies required to install Ruby: | + | |
| - | + | ||
| - | **sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev** | + | |
| if anything breaks the installation, remove the particular dependency and install the other packages | if anything breaks the installation, remove the particular dependency and install the other packages | ||
| Once the dependencies download, you can install rbenv itself. Clone the rbenv repository from GitHub into the directory ~/.rbenv | Once the dependencies download, you can install rbenv itself. Clone the rbenv repository from GitHub into the directory ~/.rbenv | ||
| - | **git clone https://github.com/rbenv/rbenv.git ~/.rbenv** | + | =====git clone git://github.com/sstephenson/rbenv.git .rbenv===== |
| Next, add ~/.rbenv/bin to your $PATH so that you can use the rbenv command line utility. Do this by altering your ~/.bashrc file so that it affects future login sessions: | Next, add ~/.rbenv/bin to your $PATH so that you can use the rbenv command line utility. Do this by altering your ~/.bashrc file so that it affects future login sessions: | ||
| - | **echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc** | + | **echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile** |
| Then add the command eval "$(rbenv init -)" to your ~/.bashrc file so rbenv loads automatically: | Then add the command eval "$(rbenv init -)" to your ~/.bashrc file so rbenv loads automatically: | ||
| - | **echo 'eval "$(rbenv init -)"' >> ~/.bashrc** | + | **echo 'eval "$(rbenv init -)"' >> ~/.bash_profile** |
| + | |||
| + | ** exec $SHELL ** | ||
| Next, apply the changes you made to your ~/.bashrc file to your current shell session: | Next, apply the changes you made to your ~/.bashrc file to your current shell session: | ||
| - | **source ~/.bashrc** | + | **source ~/.bashprofile** |
| Verify that rbenv is set up properly by using the type command, which will display more information about the rbenv command: | Verify that rbenv is set up properly by using the type command, which will display more information about the rbenv command: | ||
| Line 36: | Line 34: | ||
| Next, install the ruby-build, plugin. This plugin adds therbenv install command, which simplifies the installation process for new versions of Ruby: | Next, install the ruby-build, plugin. This plugin adds therbenv install command, which simplifies the installation process for new versions of Ruby: | ||
| - | **git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build** | + | **git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build** |
| + | **echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile** | ||
| + | **exec $SHELL** | ||
| - | With the ruby-build plugin now installed, you can install versions of Ruby y may need through a simple command. First, let’s list all the available versions of Ruby: | + | with the ruby-build plugin now installed, you can install versions of Ruby y may need through a simple command. First, let’s list all the available versions of Ruby: |
| **rbenv install -l** | **rbenv install -l** | ||
| Line 169: | Line 169: | ||
| we need to uninstall the nginx module that comes with os first then need to install nginx with passenger module | we need to uninstall the nginx module that comes with os first then need to install nginx with passenger module | ||
| - | ** | + | **sudo apt-get purge nginx nginx-full nginx-light nginx-naxsi nginx-common** |
| - | sudo apt-get purge nginx nginx-full nginx-light nginx-naxsi nginx-common | + | |
| - | sudo rm -rf /etc/nginx | + | **sudo rm -rf /etc/nginx** |
| - | ** | + | |
| above commands will completely uninstall the nginx | above commands will completely uninstall the nginx | ||
| then install nginx with passenger module | then install nginx with passenger module | ||
| + | |||
| **passenger-install-nginx-module** | **passenger-install-nginx-module** | ||
| Next, need to validate nginx installation through below commands. | Next, need to validate nginx installation through below commands. | ||
| - | ** | + | |
| - | rvmsudo passenger-config validate-install | + | **rvmsudo passenger-config validate-install** |
| - | rvmsudo passenger-memory-stats | + | |
| - | ** | + | **rvmsudo passenger-memory-stats** |
| these commands will list you nginx process with pid as well passenger process with pid | these commands will list you nginx process with pid as well passenger process with pid | ||
| to restart nginx we need to kill the existing process and then start nginx service | to restart nginx we need to kill the existing process and then start nginx service | ||
| - | ** | + | |
| - | sudo kill $(cat /opt/nginx/logs/nginx.pid) | + | **sudo kill $(cat /opt/nginx/logs/nginx.pid)** |
| - | sudo /opt/nginx/sbin/nginx | + | |
| - | ** | + | **sudo /opt/nginx/sbin/nginx** |
| + | |||
| + | |||
| + | now, edit Nginx config file to respond performexa application | ||
| + | |||
| + | file name **/opt/nginx/conf/nginx.conf** | ||
| + | |||
| + | inside http block add below set of code | ||
| + | |||
| + | passenger_root /home/expdev01/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/passenger-6.0.8; | ||
| + | passenger_ruby /home/expdev01/.rbenv/versions/2.6.3/bin/ruby; | ||
| + | passenger_min_instances 1; | ||
| + | passenger_max_pool_size 3; | ||
| + | passenger_pre_start "http://performexa.exphosted.com/"; | ||
| + | client_body_buffer_size 10K; | ||
| + | client_header_buffer_size 1k; | ||
| + | client_max_body_size 8m; | ||
| + | large_client_header_buffers 4 32k; | ||
| + | client_body_timeout 10; | ||
| + | client_header_timeout 10; | ||
| + | send_timeout 12; | ||
| + | server_tokens off; | ||
| + | gzip on; | ||
| + | gzip_comp_level 2; | ||
| + | gzip_min_length 1000; | ||
| + | gzip_proxied expired no-cache no-store private auth; | ||
| + | gzip_types text/plain application/x-javascript text/xml text/css application/xml; | ||
| + | include mime.types; | ||
| + | default_type application/octet-stream; | ||
| + | |||
| + | add blow set of code to server block | ||
| + | |||
| + | listen 443 ssl; | ||
| + | server_name performexa.exphosted.com; | ||
| + | server_name *.performexa.exphosted.com; | ||
| + | ssl_certificate /opt/nginx/conf/ssl/performexa.crt; | ||
| + | ssl_certificate_key /opt/nginx/conf/ssl/performexa.key; | ||
| + | ssl_prefer_server_ciphers on; | ||
| + | #ssl_dhparam /etc/pki/tls/private/dhparam.pem; | ||
| + | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
| + | ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; | ||
| + | passenger_enabled on; | ||
| + | passenger_app_env production; | ||
| + | root /deploy/performance/current/public; | ||
| + | open_file_cache max=2000 inactive=20s; | ||
| + | open_file_cache_valid 60s; | ||
| + | open_file_cache_min_uses 5; | ||
| + | open_file_cache_errors off; | ||
| + | location ~* .(jpg|jpeg|png|gif|ico|css|js)$ { | ||
| + | expires 365d; | ||
| + | } | ||
| + | location / { | ||
| + | proxy_set_header Host $host; | ||
| + | #proxy_set_header X-Real-IP $remote_addr; | ||
| + | #proxy_set_header X-Forwarded-Proto https; | ||
| + | #proxy_set_header X-Forwarded-Proto $scheme; | ||
| + | #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | } | ||
| + | |||
| + | reference | ||
| + | **https://www.phusionpassenger.com/library/install/nginx/install/oss/rubygems_rvm/** | ||
| + | |||
| + | Once all the gems installed successfully, we can start the deployment with capistrano command. Actual deployment directory is ‘/deploy/performance’. Run the below command inside ‘/home/expdev01/performexa_production’ | ||
| + | |||
| + | **cap production deploy** | ||
| + | |||
| + | once the deployment is success, need to restart the application using below 2 commands | ||
| + | |||
| + | **sudo kill $(cat /opt/nginx/logs/nginx.pid)** | ||
| + | **sudo /opt/nginx/sbin/nginx** | ||
| + | |||
| + | =====Install ejabberd service===== | ||
| + | |||
| + | 1. https://www.process-one.net/en/ejabberd/downloads/ | ||
| + | 2. choose Download the "Linux x86 64-bits Installer". | ||
| + | 3. chmod +x ejabberd-YY.MM-linux-x64.run | ||
| + | 4. ./ejabberd-YY.MM-linux-x64.run | ||
| + | |||
| + | provide necessary inputs. In domain name you need to give the proper subdomain name, example ‘performexa.exphosted.com’ | ||
| + | |||
| + | after the installation there should be ejabberd-21.04 folder in /home/expdev01 | ||
| + | |||
| + | **start ejabberd** | ||
| + | |||
| + | cd ejabberd-21.04 | ||
| + | ./bin/ejabberdctl start | ||
| + | |||
| + | **Access ejabberd sevice** | ||
| + | |||
| + | To access ejabberd sevice under http/https ports, we need to allow access to 5280 and 5281 ports | ||
| + | usually to check this we need to give below command | ||
| + | telnet ip_address port_number | ||
| + | ex: telner 127.0.0.1 5280 | ||
| + | |||
| + | if we have access for that port will be connected. | ||
| + | Now open the ejabberd admin panel in the browser | ||
| + | https://performexa.exphosted.com:5281/admin/ | ||
| + | |||
| + | provide username and password when we gave while installing ejabberd service | ||