production deployment changes
This commit is contained in:
@@ -1,83 +0,0 @@
|
||||
# ## SQLIte3 --- Setup
|
||||
#
|
||||
# # SQLite version 3.x
|
||||
# # gem install sqlite3
|
||||
# #
|
||||
# # Ensure the SQLite 3 gem is defined in your Gemfile
|
||||
# # gem 'sqlite3'
|
||||
# #
|
||||
# default: &default
|
||||
# adapter: sqlite3
|
||||
# pool: 5
|
||||
# timeout: 5000
|
||||
#
|
||||
# development:
|
||||
# <<: *default
|
||||
# database: db/development.sqlite3
|
||||
#
|
||||
# # Warning: The database defined as "test" will be erased and
|
||||
# # re-generated from your development database when you run "rake".
|
||||
# # Do not set this db to the same as development or production.
|
||||
# test:
|
||||
# <<: *default
|
||||
# database: db/test.sqlite3
|
||||
#
|
||||
# production:
|
||||
# <<: *default
|
||||
# database: db/production.sqlite3
|
||||
|
||||
# Mysql --- Setup
|
||||
# MySQL. Versions 5.0 and up are supported.
|
||||
#
|
||||
# Install the MySQL driver
|
||||
# gem install mysql2
|
||||
#
|
||||
# Ensure the MySQL gem is defined in your Gemfile
|
||||
# gem 'mysql2'
|
||||
#
|
||||
# And be sure to use new-style password hashing:
|
||||
# http://dev.mysql.com/doc/refman/5.7/en/old-client.html
|
||||
#
|
||||
default: &default
|
||||
adapter: mysql2
|
||||
encoding: utf8
|
||||
pool: 5
|
||||
username: root
|
||||
password:
|
||||
socket: /tmp/mysql.sock
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: SXRestaurants_development
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: SXRestaurants_test
|
||||
|
||||
# As with config/secrets.yml, you never want to store sensitive information,
|
||||
# like your database password, in your source code. If your source code is
|
||||
# ever seen by anyone, they now have access to your database.
|
||||
#
|
||||
# Instead, provide the password as a unix environment variable when you boot
|
||||
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||
# for a full rundown on how to provide these environment variables in a
|
||||
# production deployment.
|
||||
#
|
||||
# On Heroku and other platform providers, you may have a full connection URL
|
||||
# available as an environment variable. For example:
|
||||
#
|
||||
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
||||
#
|
||||
# You can use this database configuration with:
|
||||
#
|
||||
# production:
|
||||
# url: <%= ENV['DATABASE_URL'] %>
|
||||
#
|
||||
production:
|
||||
<<: *default
|
||||
database: SXRestaurants_production
|
||||
username: SXRestaurants
|
||||
password: <%= ENV['SXRESTAURANTS_DATABASE_PASSWORD'] %>
|
||||
@@ -1,3 +1,13 @@
|
||||
# set :stage, :production
|
||||
# set :server_name, "svr.sxrestaurant.host"
|
||||
|
||||
# set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
||||
# server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true
|
||||
|
||||
# set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
||||
# set :rbenv_ruby, '2.4.1'
|
||||
# set :rails_env, :production
|
||||
|
||||
set :stage, :production
|
||||
set :server_name, "a.c2l.shop"
|
||||
set :branch, "r-1902001-01"
|
||||
|
||||
@@ -3,45 +3,47 @@ class ActionController::Base
|
||||
|
||||
private
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# authenticate_session_token
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# authenticate_session_token
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
else
|
||||
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
else
|
||||
redirect_to activate_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def current_license(url)
|
||||
def current_license(url)
|
||||
@license = License.new(url)
|
||||
flag = @license.detail_with_local_file()
|
||||
if (flag == 0)
|
||||
flash[:notice] = 'Expired or No License!'
|
||||
flash[:notice] = 'Expired or No License!'
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
puts "RUN SAY BYAR"
|
||||
end
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
|
||||
if (@license.detail_with_local_cache(lookup) == true)
|
||||
return @license
|
||||
@@ -51,7 +53,7 @@ class ActionController::Base
|
||||
end
|
||||
|
||||
def check_license
|
||||
License.check_license_file
|
||||
License.check_license_file
|
||||
end
|
||||
|
||||
def check_installation
|
||||
@@ -83,7 +85,7 @@ class ActionController::Base
|
||||
# RESTful url for localize
|
||||
def default_url_options
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -92,26 +94,26 @@ class ActionController::API
|
||||
|
||||
private
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# authenticate_session_token
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# authenticate_session_token
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
|
||||
if (@license.detail_with_local_cache(lookup) == true)
|
||||
return @license
|
||||
@@ -143,7 +145,6 @@ class ActionController::API
|
||||
# RESTful url for localize
|
||||
def default_url_options
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
# directory application_path
|
||||
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
# environment "production"
|
||||
# pidfile "#{application_path}/tmp/puma/pid"
|
||||
# state_path "#{application_path}/tmp/puma/state"
|
||||
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
# port ENV.fetch("PORT") { 62158 }
|
||||
# workers 2
|
||||
# preload_app!
|
||||
|
||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
directory application_path
|
||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
environment "production"
|
||||
pidfile "#{application_path}/tmp/puma/pid"
|
||||
state_path "#{application_path}/tmp/puma/state"
|
||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
port ENV.fetch("PORT") { 62158 }
|
||||
workers 2
|
||||
preload_app!
|
||||
threads 1,1
|
||||
|
||||
@@ -3,6 +3,7 @@ require 'sidekiq/web'
|
||||
Rails.application.routes.draw do
|
||||
|
||||
scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
root 'home#index'
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
@@ -12,7 +13,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
# if ENV["SERVER_MODE"] != "cloud"
|
||||
mount ActionCable.server => "/cable"
|
||||
# end
|
||||
|
||||
|
||||
|
||||
#--------- SmartSales Activation ------------#
|
||||
get 'activate' => 'install#index'
|
||||
@@ -28,7 +29,16 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
delete 'logout' => 'home#destroy'
|
||||
get 'dashboard' => 'home#dashboard'
|
||||
|
||||
namespace :induties do
|
||||
# resources :assign_in_duties
|
||||
get ':booking_id/assign' => 'assign_in_duties#index', as: :assign_in_duties
|
||||
get "/assign_in_duties/get_all_occupied_dining/:id" =>'assign_in_duties#get_all_occupied_dining', as: :get_all_occupied_dining
|
||||
post ':booking_id/assign_create' => 'assign_in_duties#induties_create', as: :induties_create
|
||||
post ':booking_id/assign_checkout/:induty_id' => 'assign_in_duties#induties_checkout', as: :induties_checkout
|
||||
delete ':booking_id/assign_remove/:induty_id' => 'assign_in_duties#induties_remove', as: :induties_remove
|
||||
get ':booking_id/get_current_booking' => 'assign_in_duties#get_current_booking'
|
||||
|
||||
end
|
||||
#--------- API Routes ------------#
|
||||
namespace :api, :defaults => {:format => 'json'} do
|
||||
#Session Login and Logout
|
||||
@@ -46,7 +56,9 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :menu_item_instances, only: [:show]
|
||||
get "item_sets" => "item_sets#index"
|
||||
end
|
||||
|
||||
namespace :payment do
|
||||
post 'mobilepayment/:cashier_id/:receipt_no/cash' =>"mobilepayment#cash"
|
||||
end
|
||||
#User request move table or bills
|
||||
post "bill/:booking_id" => "bill#create"
|
||||
post "move" => "move#create"
|
||||
@@ -92,7 +104,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post "callback/:id" => "order_reservation#update_status"
|
||||
get "get_tax_profile" => "order_reservation#get_tax_profile"
|
||||
end
|
||||
|
||||
|
||||
post "sound_effect" => "sound_effect#sound_effect"
|
||||
|
||||
#API for cashier app
|
||||
@@ -102,19 +114,22 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post "request_bill" => "bill#request_bill"
|
||||
post "paymal_payment" => "payments#paymal_payment"
|
||||
get ":sale_id/void" => "void#overall_void"
|
||||
|
||||
#API for sync cloud
|
||||
post 'sync_data' => 'sync#sync_data'
|
||||
end
|
||||
|
||||
#--------- Cashier ------------#
|
||||
namespace :origami do
|
||||
namespace :origami do
|
||||
root "home#index"
|
||||
|
||||
post '/check_emp_access_code/:code' => 'home#check_emp_access_code', :defaults => { :format => 'json' }
|
||||
|
||||
get "dashboard" => "dashboard#index"
|
||||
get "get_all_menu" => "dashboard#get_all_menu"
|
||||
get "dashboard" => "dashboard#index"
|
||||
get "get_all_menu" => "dashboard#get_all_menu"
|
||||
|
||||
get "quick_service" => "quick_service#index"
|
||||
|
||||
|
||||
get ":type/pending_order" => "pending_order#index"
|
||||
get ":type/pending_order/:sale_id" => "pending_order#show"
|
||||
get ":type/completed_sale/:sale_id" => "pending_order#completed_sale"
|
||||
@@ -122,7 +137,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order"
|
||||
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
|
||||
post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' }
|
||||
|
||||
|
||||
get ":type/cash_ins" => "pending_order#cash_ins"
|
||||
get ":type/cash_outs" => "pending_order#cash_outs"
|
||||
|
||||
@@ -135,7 +150,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
resources :cash_ins, only: [:new, :create]
|
||||
resources :cash_outs, only: [:new, :create]
|
||||
|
||||
|
||||
get "table/:dining_id" => "home#show" do #origami/:booking_id will show
|
||||
# resources :discounts, only: [:index,:new, :create ] #add discount type
|
||||
resources :customers #add customer type
|
||||
@@ -206,6 +221,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
post 'payment/:type/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
||||
post 'payment/cash' => 'payments#create'
|
||||
# post 'payment/kbz_query/:sale_id' => 'payments#kbz_query', :defaults => {:format => 'json'}
|
||||
post 'payment/mpu' => "mpu#create"
|
||||
post 'payment/jcb' => "jcb#create"
|
||||
post 'payment/master' => "master#create"
|
||||
@@ -268,10 +284,10 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
|
||||
get '/:addorders/:id' => "addorders#detail"
|
||||
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
|
||||
|
||||
|
||||
|
||||
get '/addorders/get_item_instance/:id' => "addorders#get_item_instance",:as => "get_item_instance", :defaults => { :format => 'json' }
|
||||
|
||||
|
||||
resources :commissions
|
||||
resources :commissioners
|
||||
|
||||
@@ -341,7 +357,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get 'sale/:sale_id/:type/credit_payment/others_payment/Alipay' => "alipay#index"
|
||||
# get 'sale/:sale_id/:type/credit_payment/others_payment/DINGA' => "dinga#index"
|
||||
# get 'sale/:sale_id/:type/credit_payment/others_payment/GiftVoucher' => "gift_voucher#index"
|
||||
|
||||
|
||||
#------------- Start Reservation -------------------#
|
||||
resources :reservation
|
||||
#------------- End Reservation -------------------#
|
||||
@@ -358,6 +374,8 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
namespace :crm do
|
||||
root "home#index"
|
||||
resources :customers
|
||||
get "/customers/:id/sync" => "customers#sync", as:"customer_sync"
|
||||
get "/customers/:id/customer_update_phone_email_member_type" => "customers#customer_update_phone_email_member_type", as:"customer_update_phone_email_member_type"
|
||||
resources :dining_queues
|
||||
post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel
|
||||
get '/print/:id', to: "home#print_order" #print order for crm
|
||||
@@ -400,8 +418,8 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
collection do
|
||||
post :import
|
||||
end
|
||||
resources :menu_categories, only: [:new, :create, :edit, :delete]
|
||||
end
|
||||
resources :menu_categories, only: [:new, :create, :edit, :delete]
|
||||
end
|
||||
|
||||
get '/menus/:id/export' => 'menus#export'
|
||||
|
||||
@@ -505,6 +523,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :receipt_no_detail
|
||||
resources :dailysale, :only => [:index, :show]
|
||||
resources :saleitem, :only => [:index, :show]
|
||||
resources :hourly_saleitem, :only => [:index, :show]
|
||||
resources :shiftsale, :only => [:index, :show]
|
||||
resources :credit_payment, :only => [:index, :show]
|
||||
resources :void_sale, :only => [:index, :show]
|
||||
@@ -519,10 +538,14 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :card_settle_tran
|
||||
|
||||
get "saleitem/get_shift_by_date", to: "saleitem#show", as: "get_shift_by_sale_item"
|
||||
get "hourly_saleitem/get_shift_by_date", to: "hourly_saleitem#show", as: "get_shift_by_hourly_saleitem"
|
||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||
get "order_reservation/get_shift_by_date", to: "order_reservation#show", as: "get_shift_by_order_reservation"
|
||||
get "induty/get_shift_by_date", to: "induty#show", as: "get_shift_by_induty"
|
||||
|
||||
get "shiftsale_print/:id" , to: "shiftsale#print_close_receipt", as: "get_shift_id"
|
||||
get "receipt_reprint/:sale_id" , to: "receipt_no#reprint", as: "receipt_reprint"
|
||||
post "print_sale_items", to: "saleitem#print_sale_items", as: "print_sale_items"
|
||||
get "sync_data", to:'receipt_no#sync_data', as:'sync_data'
|
||||
end
|
||||
|
||||
# ----------- Inventory ---------------------------
|
||||
|
||||
@@ -11,21 +11,20 @@
|
||||
# if you're sharing your code publicly.
|
||||
|
||||
development:
|
||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||
sx_provision_url: connect.smartsales.asia/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||
sx_provision_url: connect.smartsales.asia/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
|
||||
test:
|
||||
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
||||
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||
sx_provision_url: connect.smartsales.asia/api #192.168.1.147:3002/api
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
|
||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||
sx_provision_url: connect.smartsales.asia/api #192.168.1.147:3002/api
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
|
||||
Reference in New Issue
Block a user