Infrastructure and add removeListNeedsHelp to users
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/bterkuile/cmtool.git
|
remote: https://github.com/bterkuile/cmtool.git
|
||||||
revision: 69a0291ab7097fa9a1f4ce6f605b89962a9caa76
|
revision: 1a1edf675bf25303184977ad809a1d7a57419660
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
cmtool (3.0.0)
|
cmtool (3.0.0)
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ cd ~/projects/couchdb/couchdb
|
|||||||
./dev/run --admin=admin:admin
|
./dev/run --admin=admin:admin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Did not work the last time. The docker version did.
|
||||||
|
|
||||||
### Start rails
|
### Start rails
|
||||||
Note that the couchdb admin password can be changed for better security:
|
Note that the couchdb admin password can be changed for better security:
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -59,6 +59,14 @@ module Users
|
|||||||
render json: @list
|
render json: @list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# POST /user/remove_list_needs_payment.json
|
||||||
|
def remove_needs_payment
|
||||||
|
@list = active_list
|
||||||
|
render json: json_alert('messages.no_active_list', list_active: false) and return unless @list.try(:id).to_s == params[:id]
|
||||||
|
@list.remove_needs_payment!
|
||||||
|
render json: @list
|
||||||
|
end
|
||||||
|
|
||||||
# POST /user/lists/:id/move_table.json?table_id=....
|
# POST /user/lists/:id/move_table.json?table_id=....
|
||||||
# used to move the table
|
# used to move the table
|
||||||
# TODO wrap logic of actions
|
# TODO wrap logic of actions
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ Mozo::Application.routes.draw do
|
|||||||
get :orders
|
get :orders
|
||||||
get :users
|
get :users
|
||||||
post :needs_payment
|
post :needs_payment
|
||||||
|
post :remove_needs_payment
|
||||||
post :move_to_table
|
post :move_to_table
|
||||||
post :order_products
|
post :order_products
|
||||||
post :reject_join_request
|
post :reject_join_request
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem "couchrest"
|
gem "couchrest"
|
||||||
gem "pry"
|
#gem "pry"
|
||||||
|
|||||||
+10
-12
@@ -1,27 +1,25 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
coderay (1.1.2)
|
|
||||||
couchrest (2.0.1)
|
couchrest (2.0.1)
|
||||||
httpclient (~> 2.8)
|
httpclient (~> 2.8)
|
||||||
mime-types (>= 1.15)
|
mime-types (>= 1.15)
|
||||||
multi_json (~> 1.7)
|
multi_json (~> 1.7)
|
||||||
httpclient (2.8.3)
|
httpclient (2.9.0)
|
||||||
method_source (0.9.2)
|
mutex_m
|
||||||
mime-types (3.3.1)
|
logger (1.7.0)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types (3.7.0)
|
||||||
mime-types-data (3.2019.1009)
|
logger
|
||||||
multi_json (1.14.1)
|
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
||||||
pry (0.12.2)
|
mime-types-data (3.2026.0203)
|
||||||
coderay (~> 1.1.0)
|
multi_json (1.19.1)
|
||||||
method_source (~> 0.9.0)
|
mutex_m (0.3.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
couchrest
|
couchrest
|
||||||
pry
|
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.17.3
|
2.7.2
|
||||||
|
|||||||
@@ -65,12 +65,13 @@ class InMemoryQCounter
|
|||||||
def reload_stats!
|
def reload_stats!
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'couchrest'
|
require 'couchrest'
|
||||||
require 'pry'
|
#require 'pry'
|
||||||
couch_settings_path = 'config/couchdb.yml'
|
couch_settings_path = 'config/couchdb.yml'
|
||||||
puts "Couch settings path: #{couch_settings_path}"
|
puts "Couch settings path: #{couch_settings_path}"
|
||||||
puts "Environment: #{environment.inspect}"
|
puts "Environment: #{environment.inspect}"
|
||||||
#couch_settings = YAML.load_file(couch_settings_path)[environment]
|
#couch_settings = YAML.load_file(couch_settings_path)[environment]
|
||||||
couch_settings = YAML.safe_load(ERB.new(File.read(couch_settings_path)).result, permitted_classes: [Symbol])[environment]
|
couch_settings = YAML.safe_load(ERB.new(File.read(couch_settings_path)).result, permitted_classes: [Symbol])[environment]
|
||||||
|
puts "Couch-Settings: \n#{couch_settings.to_yaml}"
|
||||||
database = couch_settings['database']
|
database = couch_settings['database']
|
||||||
#database = database.sub 'localhost', 'host.docker.internal' unless environment == 'development'
|
#database = database.sub 'localhost', 'host.docker.internal' unless environment == 'development'
|
||||||
#database = couch_settings['database']
|
#database = couch_settings['database']
|
||||||
|
|||||||
@@ -6,10 +6,18 @@ pwd_dirname=$(basename $(pwd));
|
|||||||
script_dirname="drb_counter";
|
script_dirname="drb_counter";
|
||||||
arch=$(uname)
|
arch=$(uname)
|
||||||
environment="${1:-production}"
|
environment="${1:-production}"
|
||||||
if [ "$pwd_dirname" == "$script_dirname" ]; then
|
|
||||||
echo "PWD DIRNAME: "$pwd_dirname;
|
# Check for sanity, was debugging database mismatch
|
||||||
echo "You must run this script from the project's root dir (../) for the Dockerfile to have access to the configs to COPY";
|
if [ "$#" -lt 1 ]; then
|
||||||
exit 1;
|
nodename=$(uname -n)
|
||||||
|
known_development_machines=("fedorasahi" "blackview")
|
||||||
|
for item in "${known_development_machines[@]}"; do
|
||||||
|
if [[ "$item" == "$nodename" ]]; then
|
||||||
|
echo "Stupid Error: You are on a known development device: $nodename. As a developer, always explicitly supply the environment as the first argument" >&2
|
||||||
|
echo "Usage: ./drb_counter/rebuild-docker.sh development"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 2. stop and remove all running/existing containers
|
# 2. stop and remove all running/existing containers
|
||||||
@@ -31,6 +39,7 @@ if [ $arch == "Darwin" ]; then
|
|||||||
else
|
else
|
||||||
# docker run --network=host --env DRB_ENV=production --env COUCHDB_ADMIN_PASSWORD=$COUCHDB_ADMIN_PASSWORD --add-host=host.docker.internal:host-gateway --restart unless-stopped --detach --name=mozo_drb_counter mozo_drb_counter
|
# docker run --network=host --env DRB_ENV=production --env COUCHDB_ADMIN_PASSWORD=$COUCHDB_ADMIN_PASSWORD --add-host=host.docker.internal:host-gateway --restart unless-stopped --detach --name=mozo_drb_counter mozo_drb_counter
|
||||||
docker run --network=host --env DRB_ENV=$environment --env COUCHDB_ADMIN_PASSWORD=$COUCHDB_ADMIN_PASSWORD --restart unless-stopped --detach --name=mozo_drb_counter mozo_drb_counter
|
docker run --network=host --env DRB_ENV=$environment --env COUCHDB_ADMIN_PASSWORD=$COUCHDB_ADMIN_PASSWORD --restart unless-stopped --detach --name=mozo_drb_counter mozo_drb_counter
|
||||||
|
#docker run -p 9022:9022 --env DRB_ENV=$environment --env COUCHDB_ADMIN_PASSWORD=$COUCHDB_ADMIN_PASSWORD --restart unless-stopped --detach --name=mozo_drb_counter mozo_drb_counter
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# To just start the container created through al these steps without rebuilding them:
|
# To just start the container created through al these steps without rebuilding them:
|
||||||
|
|||||||
@@ -4,5 +4,10 @@ module Mozo
|
|||||||
require 'drb'
|
require 'drb'
|
||||||
DRbObject.new_with_uri('druby://localhost:9022')
|
DRbObject.new_with_uri('druby://localhost:9022')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# propagation method. Might save some searching. Hint: drb_counter/drb_counter.rb
|
||||||
|
def self.reload_stats!
|
||||||
|
object.reload_stats!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user