Infrastructure and add removeListNeedsHelp to users
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ GIT
|
||||
|
||||
GIT
|
||||
remote: https://github.com/bterkuile/cmtool.git
|
||||
revision: 69a0291ab7097fa9a1f4ce6f605b89962a9caa76
|
||||
revision: 1a1edf675bf25303184977ad809a1d7a57419660
|
||||
branch: master
|
||||
specs:
|
||||
cmtool (3.0.0)
|
||||
|
||||
@@ -10,6 +10,8 @@ cd ~/projects/couchdb/couchdb
|
||||
./dev/run --admin=admin:admin
|
||||
```
|
||||
|
||||
Did not work the last time. The docker version did.
|
||||
|
||||
### Start rails
|
||||
Note that the couchdb admin password can be changed for better security:
|
||||
```
|
||||
|
||||
@@ -59,6 +59,14 @@ module Users
|
||||
render json: @list
|
||||
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=....
|
||||
# used to move the table
|
||||
# TODO wrap logic of actions
|
||||
|
||||
@@ -92,6 +92,7 @@ Mozo::Application.routes.draw do
|
||||
get :orders
|
||||
get :users
|
||||
post :needs_payment
|
||||
post :remove_needs_payment
|
||||
post :move_to_table
|
||||
post :order_products
|
||||
post :reject_join_request
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem "couchrest"
|
||||
gem "pry"
|
||||
#gem "pry"
|
||||
|
||||
+10
-12
@@ -1,27 +1,25 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
coderay (1.1.2)
|
||||
couchrest (2.0.1)
|
||||
httpclient (~> 2.8)
|
||||
mime-types (>= 1.15)
|
||||
multi_json (~> 1.7)
|
||||
httpclient (2.8.3)
|
||||
method_source (0.9.2)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2019.1009)
|
||||
multi_json (1.14.1)
|
||||
pry (0.12.2)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
httpclient (2.9.0)
|
||||
mutex_m
|
||||
logger (1.7.0)
|
||||
mime-types (3.7.0)
|
||||
logger
|
||||
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
||||
mime-types-data (3.2026.0203)
|
||||
multi_json (1.19.1)
|
||||
mutex_m (0.3.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
couchrest
|
||||
pry
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
2.7.2
|
||||
|
||||
@@ -65,12 +65,13 @@ class InMemoryQCounter
|
||||
def reload_stats!
|
||||
require 'yaml'
|
||||
require 'couchrest'
|
||||
require 'pry'
|
||||
#require 'pry'
|
||||
couch_settings_path = 'config/couchdb.yml'
|
||||
puts "Couch settings path: #{couch_settings_path}"
|
||||
puts "Environment: #{environment.inspect}"
|
||||
#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]
|
||||
puts "Couch-Settings: \n#{couch_settings.to_yaml}"
|
||||
database = couch_settings['database']
|
||||
#database = database.sub 'localhost', 'host.docker.internal' unless environment == 'development'
|
||||
#database = couch_settings['database']
|
||||
|
||||
@@ -6,10 +6,18 @@ pwd_dirname=$(basename $(pwd));
|
||||
script_dirname="drb_counter";
|
||||
arch=$(uname)
|
||||
environment="${1:-production}"
|
||||
if [ "$pwd_dirname" == "$script_dirname" ]; then
|
||||
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";
|
||||
exit 1;
|
||||
|
||||
# Check for sanity, was debugging database mismatch
|
||||
if [ "$#" -lt 1 ]; then
|
||||
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
|
||||
|
||||
# 2. stop and remove all running/existing containers
|
||||
@@ -31,6 +39,7 @@ if [ $arch == "Darwin" ]; then
|
||||
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=$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
|
||||
|
||||
# To just start the container created through al these steps without rebuilding them:
|
||||
|
||||
@@ -4,5 +4,10 @@ module Mozo
|
||||
require 'drb'
|
||||
DRbObject.new_with_uri('druby://localhost:9022')
|
||||
end
|
||||
|
||||
# propagation method. Might save some searching. Hint: drb_counter/drb_counter.rb
|
||||
def self.reload_stats!
|
||||
object.reload_stats!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user