commit from production server

This commit is contained in:
git_code2lab
2019-11-15 14:17:50 +06:30
parent 1330422b60
commit 213644d8ef
18 changed files with 1154 additions and 69 deletions

View File

@@ -1 +1,2 @@
RAILS_ENV=production
SERVER_MODE=cloud

View File

@@ -1,15 +1,20 @@
FROM ruby:2.4.1
RUN apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev libcups2-dev libpq-dev nodejs
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y build-essential libmariadb-dev libcups2-dev libpq-dev nodejs tzdata
RUN mkdir /sxrestaurant
RUN mkdir -p /sxrestaurant/tmp/puma
ENV RAILS_ENV staging
ENV RACK_ENV staging
ENV RAILS_ENV production
ENV RACK_ENV production
WORKDIR /sxrestaurant
COPY Gemfile /sxrestaurant/Gemfile
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
RUN bundle install --without development test
#RUN gem install bundler
#COPY Gemfile /sxrestaurant/Gemfile
#COPY Gemfile.lock /sxrestaurant/Gemfile.lock
#RUN bundle install --without development test
RUN echo "Asia/Rangoon" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
RUN date
COPY . /sxrestaurant
RUN gem install bundler
#RUN bundle update --bundler
RUN bundle install --without development test
RUN bundle exec rake assets:precompile
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

19
Dockerfile.backup Normal file
View File

@@ -0,0 +1,19 @@
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev libcups2-dev libpq-dev nodejs
RUN mkdir /sxrestaurant
RUN mkdir -p /sxrestaurant/tmp/puma
ENV RAILS_ENV production
ENV RACK_ENV production
WORKDIR /sxrestaurant
#RUN gem install bundler
#COPY Gemfile /sxrestaurant/Gemfile
#COPY Gemfile.lock /sxrestaurant/Gemfile.lock
#RUN bundle install --without development test
RUN echo "Asia/Rangoon" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
COPY . /sxrestaurant
RUN gem install bundler
#RUN bundle update --bundler
RUN bundle install --without development test
RUN bundle exec rake assets:precompile
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

View File

@@ -1,5 +1,6 @@
source 'https://rubygems.org'
ruby '2.3.1'
#ruby '2.4.1'
ruby '2.5.7'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"

View File

@@ -62,7 +62,7 @@ GEM
builder (3.2.3)
byebug (11.0.1)
cancancan (1.17.0)
capistrano (3.10.1)
capistrano (3.11.2)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
@@ -99,8 +99,8 @@ GEM
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
railties (>= 3.0.0)
faker (2.5.0)
i18n (~> 1.6.0)
faker (2.6.0)
i18n (>= 1.6, < 1.8)
ffi (1.11.1)
filterrific (5.2.1)
font-awesome-rails (4.7.0.5)
@@ -140,7 +140,7 @@ GEM
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.3.0)
loofah (2.3.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@@ -223,23 +223,23 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 0.1.0)
rqrcode_core (0.1.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.5)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.2)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-rails (3.9.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.3)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
ruby-ole (1.2.12.2)
rubyzip (1.0.0)
sass (3.7.4)
@@ -267,8 +267,7 @@ GEM
activemodel (>= 5.0)
spreadsheet (1.2.4)
ruby-ole (>= 1.0)
spring (2.0.2)
activesupport (>= 4.2)
spring (2.1.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
@@ -371,7 +370,7 @@ DEPENDENCIES
whenever
RUBY VERSION
ruby 2.3.1p112
ruby 2.4.1p111
BUNDLED WITH
2.0.2

View File

@@ -2,7 +2,8 @@ class Origami::DashboardController < BaseOrigamiController
def index
@shop = Shop.first
Rails.logger.info ENV["SERVER_MODE"]
Rails.logger.info "<><><><><><><><>>"
today = DateTime.now.strftime('%Y-%m-%d')
@display_type = Lookup.find_by_lookup_type("display_type")

View File

@@ -22,7 +22,7 @@ class Origami::PendingOrderController < BaseOrigamiController
else
redirect_to "/origami/#{params[:type]}" and return
end
elsif id.start_with?("BKI")
elsif (id.start_with?("BKI")|| id.start_with?("CBKI"))
@bookings = Booking.find(id)
@order = @bookings.orders.where(status: "new").first
@order_items = @bookings.order_items

View File

@@ -13,7 +13,8 @@ class License
def initialize(server = "", lookup = "")
#this code is hard-code to reflect server mode - Very important.
self.server_mode = ENV["SERVER_MODE"]
# self.server_mode = ENV["SERVER_MODE"]
self.server_mode = "cloud"
if (server != "")
self.class.base_uri server
@@ -41,11 +42,12 @@ class License
@params = { query: { lookup_type: self.server_mode, lookup: lookup, iv_key: aes_iv} }
response = self.class.get("/subdomain", @params)
@license = response.parsed_response
Rails.logger.info "License Response - " + response.parsed_response.to_s
if (@license["status"] == true)
assign(aes_key, aes_iv)
# Rails.logger.info "License - " + response.parsed_response.to_s
#Rails.logger.info "License - " + response.parsed_response.to_s
redis = Redis.new
redis.set(cache_key, Marshal.dump(@license))

View File

@@ -1,5 +1,5 @@
require 'net/http'
require 'cups'
#require 'cups'
class Printer::PrinterWorker
attr_accessor :print_settings

View File

@@ -7,8 +7,8 @@
<div class="form-inputs p-l-25">
<%= f.input :name,:input_html=>{:class=>"col-md-9"} %>
<%= f.input :is_active,:input_html=>{:class=>"col-md-9"} %>
<%= f.input :is_ordering,:input_html=>{:class=>"col-md-9"} %>
<%= f.input :is_active,:input_html=>{:class=>"col-md-9"}, as: :boolean %>
<%= f.input :is_ordering,:input_html=>{:class=>"col-md-9"}, as: :boolean %>
<div class="row checkboxes ">
<div class="col-md-2">
<label class="control-label"><abbr title="required">*</abbr> Valid Day</label>

BIN
config/.database.yml.swp Normal file

Binary file not shown.

View File

@@ -1,6 +1,6 @@
redis: &redis
adapter: redis
url: redis://localhost:6379/1
url: redis://172.17.0.1:6380/1
production: *redis
development: *redis

View File

@@ -3,4 +3,6 @@ if File.exist?("config/license.yml")
config.fetch(Rails.env, {}).each do |key, value|
ENV[key.upcase] = value.to_s
end
else
ENV["SERVER_MODE"] = "cloud"
end

View File

@@ -9,5 +9,5 @@ test:
<<: *default
production:
<<: *default
url: redis://127.0.0.1:6379
db: 0
url: redis://172.17.0.1:6380

View File

@@ -24,7 +24,7 @@ test:
# 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
sx_provision_url: 52.221.188.144:9292/api #connect.smartsales.asia/api #192.168.1.147:3002/api
server_mode: cloud
cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L

File diff suppressed because it is too large Load Diff

View File

@@ -8,12 +8,14 @@ services:
- redis
volumes:
- .:/sxrestaurant
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
env_file:
- .code2lab.env
ports:
- '8082:62158'
- '62160:62158'
environment:
- REDIS_URL=redis://redis:6379/0
- REDIS_URL=redis://172.17.0.1:6380/0
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
@@ -22,7 +24,7 @@ services:
volumes:
- .:/sxrestaurant
environment:
- REDIS_URL=redis://redis:6379/0
- REDIS_URL=redis://172.17.0.1:6380/0
redis:
image: redis
ports:

31
docker-compose.yml.back Normal file
View File

@@ -0,0 +1,31 @@
version: '3'
services:
code2lab:
build:
context: .
dockerfile: ./Dockerfile
links:
- redis
volumes:
- .:/sxrestaurant
env_file:
- .code2lab.env
ports:
- '8082:62158'
environment:
- REDIS_URL=redis://redis:6379/0
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
links:
- redis
volumes:
- .:/sxrestaurant
environment:
- REDIS_URL=redis://redis:6379/0
redis:
image: redis
ports:
- '6380:6379'
volumes:
- ../data/redis:/data