### Steps to deploy OMNI Production. 1. Download the release folder from Github. 2. Move the release folder to /tmp folder of Omni production server (10.1.0.120) 3. Navigate to release folder which is in /tmp folder and generate build using ``` npm run build ``` 4. Rename the generated build folder to omni-build using ``` mv build omni-build ``` 5. Delete the previous omni-build folder in /var/www/html folder and copy the omni-build folder from release folder. ``` rm -rf /var/www/html/omni-build cp -R ./omni-build /var/www/html ``` 6. Configure Nginx (only once) ``` server { # SSL configuration # listen 443 ssl; listen [::]:443 ssl; ssl_certificate /etc/nginx/certs/eportal_omni-united_com.crt; ssl_certificate_key /etc/nginx/certs/eportal.omni-united.com.key; root /var/www/html/omni-build; # Add index.php to the list if you are using PHP index index.html; server_name eportal.omni-united.com; location / { try_files $uri $uri/ /index.html; } } # Redirect Rule server { if ($host = eportal.omni-united.com) { return 301 https://$host$request_uri; } server_name eportal.omni-united.com; listen 80; return 404; } ``` 7. Install PostGreSQL 8. Create a production database ``` createdb -h localhost -U ubuntu omni_prd ``` 9. Go To Backend Repository and initialize the db and application using ``` RAILS_ENV=production bundle exec rake db:create db:schema:load RAILS_ENV=production bundle exec rake db:migrate bundle exec rake assets:precompile RAILS_ENV=production bundle exec puma -e production -b tcp://0.0.0.0:3000 ``` 10. Rails Server will be running on port 3000 now. 11. Configure it in nginx. Updated Nginx will look like ``` server { # SSL configuration # listen 443 ssl; listen [::]:443 ssl; ssl_certificate /etc/nginx/certs/eportal_omni-united_com.crt; ssl_certificate_key /etc/nginx/certs/eportal.omni-united.com.key; root /var/www/html/omni-build; # Add index.php to the list if you are using PHP index index.html; server_name eportal.omni-united.com; location ~ /api/v1 { proxy_pass http://0.0.0.0:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location / { try_files $uri $uri/ /index.html; } } ``` For SAP connections add hosts in /etc/hosts file with the ip of