Infrastructure connection updates
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
# Ignore bundler config
|
# Ignore bundler config
|
||||||
.bundle
|
.bundle
|
||||||
|
faye/ssl
|
||||||
|
|
||||||
# Ignore the default SQLite database.
|
# Ignore the default SQLite database.
|
||||||
/db/*.sqlite3
|
/db/*.sqlite3
|
||||||
|
|||||||
@@ -7,4 +7,6 @@
|
|||||||
#counters: drb_counter/drb_counter.rb development
|
#counters: drb_counter/drb_counter.rb development
|
||||||
#faye: thin start -R faye/config.ru -p 9296
|
#faye: thin start -R faye/config.ru -p 9296
|
||||||
web: bundle exec rails s -p 3000 -b 0.0.0.0
|
web: bundle exec rails s -p 3000 -b 0.0.0.0
|
||||||
|
user: cd $MOZO_PATH_USER && ember server
|
||||||
|
supplier: cd $MOZO_PATH_SUPPLIER && ember server
|
||||||
#server: bundle exec rails s -e production
|
#server: bundle exec rails s -e production
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class ApplicationController < ActionController::Base
|
|||||||
private
|
private
|
||||||
|
|
||||||
def authenticate_employee!
|
def authenticate_employee!
|
||||||
if auth_token = params[:auth_token].presence
|
if auth_token = params[:auth_token].presence || request.headers['HTTP_AUTH_TOKEN'].presence
|
||||||
raise CanCan::AccessDenied unless employee = Employee.find_by_authentication_token(auth_token)
|
raise CanCan::AccessDenied unless employee = Employee.find_by_authentication_token(auth_token)
|
||||||
bypass_sign_in employee
|
bypass_sign_in employee
|
||||||
else
|
else
|
||||||
@@ -125,9 +125,9 @@ private
|
|||||||
end
|
end
|
||||||
alias json_notice js_notice
|
alias json_notice js_notice
|
||||||
|
|
||||||
def show_404
|
def show_404(options = {})
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render 'dashboard/404', layout: true, status: 404}
|
format.html { render 'dashboard/404', options.reverse_merge(layout: true, status: 404)}
|
||||||
format.json { render json: {ok: false}, status: 404 }
|
format.json { render json: {ok: false}, status: 404 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
class SupplierController < Suppliers::ApplicationController
|
class SupplierController < Suppliers::ApplicationController
|
||||||
def home
|
def home
|
||||||
if Rails.env.development?
|
if Rails.env.development?
|
||||||
binding.pry
|
redirect_to "http://localhost:4202/supplier/#{params[:other]}"
|
||||||
redirecto_to "http://localhost:4202/supplier#{params[:other]}"
|
|
||||||
else
|
else
|
||||||
render html: File.read(Rails.root.join('public/supplier/index.html'))
|
render html: File.read(Rails.root.join('public/supplier/index.html'))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def failure(env = {})
|
def failure(env = {})
|
||||||
#binding.pry
|
show_404 alert: "There was a problem authorizing and identifier the user"
|
||||||
show_404
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+6
-4
@@ -26,16 +26,18 @@ class User
|
|||||||
validates_uniqueness_of :email
|
validates_uniqueness_of :email
|
||||||
before_save :ensure_authentication_token
|
before_save :ensure_authentication_token
|
||||||
|
|
||||||
has_many :error_logs
|
#has_many :error_logs
|
||||||
has_many :user_feedbacks
|
has_many :user_feedbacks
|
||||||
|
|
||||||
view :by_authentication_token, key: :authentication_token
|
view :by_authentication_token, key: :authentication_token
|
||||||
view :by_email, key: :email
|
view :by_email, key: :email
|
||||||
view :by_facebook, key: [:provider, :uid] #DEPRICATE on successful change to by_provider
|
#view :by_facebook, key: [:provider, :uid] #DEPRICATE on successful change to by_provider
|
||||||
view :by_provider, key: [:provider, :uid]
|
#view :by_provider, key: [:provider, :uid]
|
||||||
|
view :by_provider_and_uid, key: [:provider, :uid]
|
||||||
|
|
||||||
def self.find_for_oauth(auth_data, user)
|
def self.find_for_oauth(auth_data, user)
|
||||||
user = database.view(self.by_provider(key: [auth_data.provider, auth_data.uid], limit: 1)).first
|
#user = database.view(self.by_provider(key: [auth_data.provider, auth_data.uid], limit: 1)).first
|
||||||
|
user = find_by_provider_and_uid(auth_data.provider, auth_data.uid)
|
||||||
|
|
||||||
user || create(
|
user || create(
|
||||||
provider: auth_data.provider,
|
provider: auth_data.provider,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
h1 QR Scan landing page
|
||||||
|
p |
|
||||||
|
You are
|
||||||
@@ -11,4 +11,6 @@
|
|||||||
'
|
'
|
||||||
= link_to 'contact', main_app.page_path('contact', locale: 'en')
|
= link_to 'contact', main_app.page_path('contact', locale: 'en')
|
||||||
.clearfix
|
.clearfix
|
||||||
.footer-bottom © mozo.bar 2019
|
.footer-bottom
|
||||||
|
span © mozo.bar
|
||||||
|
span= Date.today.year
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ module Qwaiter
|
|||||||
|
|
||||||
config.middleware.insert_before 0, Rack::Cors do
|
config.middleware.insert_before 0, Rack::Cors do
|
||||||
allow do
|
allow do
|
||||||
origins '*'
|
origins 'localhost', 'supplier.mozo.local', 'user.mozo.local'
|
||||||
#resource '/user/*', :headers => '*', :methods => '*' #[:get, :post, :options]
|
#resource '/user/*', :headers => '*', :methods => '*' #[:get, :post, :options]
|
||||||
resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options]
|
resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -252,11 +252,13 @@ Devise.setup do |config|
|
|||||||
# config.omniauth :facebook, "505160086210072", "fcc474a3fb13c6bcc0f7c83a92ad1b17",
|
# config.omniauth :facebook, "505160086210072", "fcc474a3fb13c6bcc0f7c83a92ad1b17",
|
||||||
# scope: 'email,user_birthday,publish_actions'
|
# scope: 'email,user_birthday,publish_actions'
|
||||||
config.omniauth :facebook, "653729178057509", "d4cea86f70803f1b75ed03c506a4d78e",
|
config.omniauth :facebook, "653729178057509", "d4cea86f70803f1b75ed03c506a4d78e",
|
||||||
scope: 'email,user_birthday,user_gender,user_hometown,user_link,user_location'
|
scope: 'email,user_birthday,user_gender,user_hometown,user_link,user_location',
|
||||||
|
provider_ignores_state: true
|
||||||
config.omniauth :instagram, "cd7bdfbee825499b94fb3783d1bc143b", "6b4f9ecf251c462993a696eebc0189be"
|
config.omniauth :instagram, "cd7bdfbee825499b94fb3783d1bc143b", "6b4f9ecf251c462993a696eebc0189be"
|
||||||
else
|
else
|
||||||
config.omniauth :facebook, "168928633304849", "22bc53e1a390c1e62d004195c55fe336",
|
config.omniauth :facebook, "168928633304849", "22bc53e1a390c1e62d004195c55fe336",
|
||||||
scope: 'email,user_birthday,user_gender,user_hometown,user_link,user_location'
|
scope: 'email,user_birthday,user_gender,user_hometown,user_link,user_location',
|
||||||
|
provider_ignores_state: true
|
||||||
config.omniauth :instagram, "81c78b969a7046d6b6b5b5fe3f30929c", "3697c16762ad4f1ca088e829efbaddde"
|
config.omniauth :instagram, "81c78b969a7046d6b6b5b5fe3f30929c", "3697c16762ad4f1ca088e829efbaddde"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
Qwaiter.event_host = "http://#{(Rails.env.development? or Rails.env.test?) ? ENV['MOZO_LOCAL_IP'] || 'localhost' : 'events.mozo.bar'}:9296/faye"
|
if Rails.env.development?
|
||||||
|
Qwaiter.event_host = "https://events.mozo.local:9296/faye"
|
||||||
|
else
|
||||||
|
Qwaiter.event_host = "https://events.mozo.bar:9296/faye"
|
||||||
|
end
|
||||||
|
|
||||||
Qwaiter.broadcaster = Qwaiter::Broadcaster::Faye.new
|
Qwaiter.broadcaster = Qwaiter::Broadcaster::Faye.new
|
||||||
|
|
||||||
# use the connection from couchbase-structures/documents
|
# use the connection from couchbase-structures/documents
|
||||||
|
|||||||
+5
-2
@@ -108,7 +108,7 @@ Qwaiter::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#get '/s' => 'dashboard#scan', as: :scan
|
get '/s' => 'dashboard#scan', as: :scan
|
||||||
|
|
||||||
# DEVELOPMENT ONLY
|
# DEVELOPMENT ONLY
|
||||||
get '/qr' => 'dashboard#qr'
|
get '/qr' => 'dashboard#qr'
|
||||||
@@ -203,13 +203,16 @@ Qwaiter::Application.routes.draw do
|
|||||||
|
|
||||||
mount Cmtool::Engine => '/cmtool'
|
mount Cmtool::Engine => '/cmtool'
|
||||||
|
|
||||||
|
# NOTE: tried to do the following 2 matchers in 1 like get '/supplier*other', but did not work, so better safe then sorry and use 2
|
||||||
|
get '/supplier' => 'supplier#home', as: :supplier_root
|
||||||
|
get '/supplier/*other' => 'supplier#home'
|
||||||
|
|
||||||
# /nl is not matched to pages#home with locale => nl
|
# /nl is not matched to pages#home with locale => nl
|
||||||
get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}, as: :go_to_locale
|
get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}, as: :go_to_locale
|
||||||
get '/sitemap(.:format)' => 'pages#sitemap'
|
get '/sitemap(.:format)' => 'pages#sitemap'
|
||||||
#devise_scope :supplier do
|
#devise_scope :supplier do
|
||||||
#get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES}
|
#get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES}
|
||||||
#end
|
#end
|
||||||
get '/supplier*other' => 'supplier#home', as: :supplier_root
|
|
||||||
scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: Rails.application.config.i18n.default_locale.to_s } do
|
scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: Rails.application.config.i18n.default_locale.to_s } do
|
||||||
root to: 'pages#home'
|
root to: 'pages#home'
|
||||||
resources :contact_forms, only: [:create]
|
resources :contact_forms, only: [:create]
|
||||||
|
|||||||
+2
-1
@@ -36,5 +36,6 @@ COPY ./faye /usr/src/app
|
|||||||
|
|
||||||
ENV FAYE_PORT=9296
|
ENV FAYE_PORT=9296
|
||||||
EXPOSE $FAYE_PORT
|
EXPOSE $FAYE_PORT
|
||||||
CMD thin start -R config.ru -p $FAYE_PORT
|
#CMD thin start -R config.ru -p $FAYE_PORT
|
||||||
|
CMD thin start -R config.ru -p $FAYE_PORT --ssl --ssl-key-file=ssl/privkey.pem --ssl-cert-file=ssl/fullchain.pem
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -2,14 +2,22 @@
|
|||||||
# This script rebuilds the whole environment and starts a new container
|
# This script rebuilds the whole environment and starts a new container
|
||||||
|
|
||||||
# 1. ensure this script is run from the project's root, not the faye directory
|
# 1. ensure this script is run from the project's root, not the faye directory
|
||||||
pwd_dirname=$(basename $(pwd));
|
pwd_dirname=$(basename $(pwd))
|
||||||
script_dirname="faye";
|
script_dirname="faye"
|
||||||
|
certs_dir="/etc/letsencrypt/live/mozo.bar"
|
||||||
|
#certs_dir="/home/benjamin/mozo/mozo-user/ssl"
|
||||||
if [ "$pwd_dirname" == "$script_dirname" ]; then
|
if [ "$pwd_dirname" == "$script_dirname" ]; then
|
||||||
echo "PWD DIRNAME: "$pwd_dirname;
|
echo "PWD DIRNAME: "$pwd_dirname;
|
||||||
echo "You must run this script from the project's root dir (../) for the Dockerfile to have access to the configs to COPY";
|
echo "You must run this script from the project's root dir (../) for the Dockerfile to have access to the configs to COPY";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "$certs_dir" ]; then
|
||||||
|
echo "Found certificates directory, copy it to local for inclusion in the docker build"
|
||||||
|
rm -rf $script_dirname/ssl
|
||||||
|
cp -r $certs_dir $script_dirname/ssl
|
||||||
|
fi
|
||||||
|
|
||||||
# 2. stop and remove all running/existing containers
|
# 2. stop and remove all running/existing containers
|
||||||
docker rm $(docker stop $(docker ps -a -q --filter ancestor=mozo_faye))
|
docker rm $(docker stop $(docker ps -a -q --filter ancestor=mozo_faye))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user