From 96b50f635cb363ee433509a3178690ff0f41e35d Mon Sep 17 00:00:00 2001 From: Udi Date: Fri, 9 Mar 2018 14:46:20 +0000 Subject: [PATCH 1/2] Changes and typo changed spacecake and fixed strawberry typo --- .cloud66/services.yml | 4 ++-- .../middleman/source/index.html.slim | 4 ++-- bakery/chef/chef.rb | 6 +++--- bakery/counter/app/counter.rb | 14 +++++++------- bakery/docker-compose.yml | 4 ++-- bakery/minions/spacecake/Dockerfile | 4 ++-- bakery/minions/spacecake/docker-compose.yml | 2 +- bakery/minions/spacecake/spacecake_minion.php | 10 +++++----- bakery/minions/spacecake/start_spacecake_minion.sh | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.cloud66/services.yml b/.cloud66/services.yml index 296205f..602f2a5 100644 --- a/.cloud66/services.yml +++ b/.cloud66/services.yml @@ -30,11 +30,11 @@ services: env_vars: RACK_ENV: production build_root: bakery/counter - worker-baker-spacecake: + worker-baker-rainbowcake: git_url: http://github.com/cloud66-samples/microservices_101.git git_branch: master dockerfile_path: Dockerfile - build_root: bakery/minions/spacecake + build_root: bakery/minions/rainbowcake worker-baker-bagel: git_url: http://github.com/cloud66-samples/microservices_101.git git_branch: master diff --git a/bakery/bricksandmortar/middleman/source/index.html.slim b/bakery/bricksandmortar/middleman/source/index.html.slim index fe2a888..83734ce 100755 --- a/bakery/bricksandmortar/middleman/source/index.html.slim +++ b/bakery/bricksandmortar/middleman/source/index.html.slim @@ -11,14 +11,14 @@ label for="kind" kind select.form-control name='kind' id="kind" ng-init="order.kind='bagel'" ng-model='order.kind' option value="bagel" Bagel - option value="spacecake" Spacecake + option value="rainbowcake" Rainbowcake option value="donut" Donut .form-group label flavour select.form-control name='flavour' ng-init="order.flavour='cola'" ng-model='order.flavour' option value="cola" Cola - option value="stawberry" Stawberry + option value="strawberry" Strawberry option value="glitter" Glitter option value="rum" Rum diff --git a/bakery/chef/chef.rb b/bakery/chef/chef.rb index 1c090c4..7212409 100755 --- a/bakery/chef/chef.rb +++ b/bakery/chef/chef.rb @@ -11,7 +11,7 @@ ch = conn.create_channel work_queue = ch.queue("bakery.order", :durable => true) bagel_queue = ch.queue("bakery.bagel.order", :durable => true) -spacecake_queue = ch.queue("bakery.spacecake.order", :durable => true) +rainbowcake_queue = ch.queue("bakery.rainbowcake.order", :durable => true) donut_queue = ch.queue("bakery.donut.order", :durable => true) @@ -39,9 +39,9 @@ bagel_queue.publish(payload, :persistent => true) end end - if task['kind'] == 'spacecake' + if task['kind'] == 'rainbowcake' task['amount'].times do |count| - spacecake_queue.publish(payload, :persistent => true) + rainbowcake_queue.publish(payload, :persistent => true) end end if task['kind'] == 'donut' diff --git a/bakery/counter/app/counter.rb b/bakery/counter/app/counter.rb index 2fde95a..b36f615 100644 --- a/bakery/counter/app/counter.rb +++ b/bakery/counter/app/counter.rb @@ -4,7 +4,7 @@ module Counter class API < Grape::API version 'v1' format :json - + queue = MessageQueue.new @@ -18,9 +18,9 @@ class API < Grape::API # GET http://xxx/v1/orders - curl -X GET -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders # GET http://xxx/v1/orders/1 - curl -X GET -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders/1 - # POST http://xxx/v1/orders/1 - curl -X POST --data '{"amount": 1,"flavour": "cola","kind": "spacecake"}' -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders - # POST http://xxx/v1/orders/1/sweet/done - curl -X POST -H "Accept: application/json" http://192.168.99.100:8000/v1/orders/1/sweet/done - + # POST http://xxx/v1/orders/1 - curl -X POST --data '{"amount": 1,"flavour": "cola","kind": "rainbowcake"}' -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders + # POST http://xxx/v1/orders/1/sweet/done - curl -X POST -H "Accept: application/json" http://192.168.99.100:8000/v1/orders/1/sweet/done + resource :orders do @@ -47,8 +47,8 @@ class API < Grape::API desc 'Create a order.' params do - requires :kind, type: String, desc: 'The sweet goods', values: ['spacecake', 'bagel', 'donut'] - requires :flavour, type: String, desc: 'Your favorite sweet flavour', values: ['stawberry', 'cola', 'glitter', 'rum'] + requires :kind, type: String, desc: 'The sweet goods', values: ['rainbowcake', 'bagel', 'donut'] + requires :flavour, type: String, desc: 'Your favorite sweet flavour', values: ['strawberry', 'cola', 'glitter', 'rum'] requires :amount, type: Integer, desc: 'Amount of sweet stuff.' end post do @@ -66,4 +66,4 @@ class API < Grape::API end end -end \ No newline at end of file +end diff --git a/bakery/docker-compose.yml b/bakery/docker-compose.yml index d63e6d0..eb28b0c 100644 --- a/bakery/docker-compose.yml +++ b/bakery/docker-compose.yml @@ -64,8 +64,8 @@ services: ports: - "8000:80" - spacecake: - build: ./minions/spacecake + rainbowcake: + build: ./minions/rainbowcake stdin_open: true tty: true links: diff --git a/bakery/minions/spacecake/Dockerfile b/bakery/minions/spacecake/Dockerfile index cb221ad..bab7ffa 100644 --- a/bakery/minions/spacecake/Dockerfile +++ b/bakery/minions/spacecake/Dockerfile @@ -9,5 +9,5 @@ WORKDIR /home/app COPY . /home/app RUN docker-php-ext-install mbstring bcmath -#start the spacecake minion -CMD /home/app/start_spacecake_minion.sh \ No newline at end of file +#start the rainbowcake minion +CMD /home/app/start_rainbowcake_minion.sh \ No newline at end of file diff --git a/bakery/minions/spacecake/docker-compose.yml b/bakery/minions/spacecake/docker-compose.yml index 481f43b..8acafe6 100644 --- a/bakery/minions/spacecake/docker-compose.yml +++ b/bakery/minions/spacecake/docker-compose.yml @@ -1,6 +1,6 @@ version: '2' services: - spacecake: + rainbowcake: build: . stdin_open: true tty: true diff --git a/bakery/minions/spacecake/spacecake_minion.php b/bakery/minions/spacecake/spacecake_minion.php index 1f614da..e7f9a85 100644 --- a/bakery/minions/spacecake/spacecake_minion.php +++ b/bakery/minions/spacecake/spacecake_minion.php @@ -6,26 +6,26 @@ $connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST); $channel = $connection->channel(); -$channel->queue_declare('bakery.spacecake.order', false, true, false, false); +$channel->queue_declare('bakery.rainbowcake.order', false, true, false, false); $channel->queue_declare('bakery.sweet.done', false, true, false, false); echo '--------------------------------', "\n"; -echo 'bagel spacecake v1.0 ready to rock!', "\n"; +echo 'bagel rainbowcake v1.0 ready to rock!', "\n"; echo '--------------------------------', "\n"; echo $_ENV['HOSTNAME'] . ':-- [*] Waiting for bagel back orders (backing time = 7)', "\n"; function process_message($message) { global $channel; - echo $_ENV['HOSTNAME'] . ':-- [.] Start backing a spacecake', "\n"; + echo $_ENV['HOSTNAME'] . ':-- [.] Start backing a rainbowcake', "\n"; sleep(2); - echo $_ENV['HOSTNAME'] . ':-- [x] Backing a spacecake done', "\n"; + echo $_ENV['HOSTNAME'] . ':-- [x] Backing a rainbowcake done', "\n"; $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); $response_message = new AMQPMessage($message->body); $channel->basic_publish($response_message, '', 'bakery.sweet.done'); }; $channel->basic_qos(null, 1, null); -$channel->basic_consume('bakery.spacecake.order', 'consumer', false, false, false, false, 'process_message'); +$channel->basic_consume('bakery.rainbowcake.order', 'consumer', false, false, false, false, 'process_message'); while(count($channel->callbacks)) { $channel->wait(); diff --git a/bakery/minions/spacecake/start_spacecake_minion.sh b/bakery/minions/spacecake/start_spacecake_minion.sh index 0835811..c915f0a 100755 --- a/bakery/minions/spacecake/start_spacecake_minion.sh +++ b/bakery/minions/spacecake/start_spacecake_minion.sh @@ -19,4 +19,4 @@ function check_port() { } check_port "rabbitmq" "5672" -php spacecake_minion.php \ No newline at end of file +php rainbowcake_minion.php \ No newline at end of file From a6536e297de343b36026dc4b25eba6c4e024d5ff Mon Sep 17 00:00:00 2001 From: Udi Date: Fri, 9 Mar 2018 14:52:35 +0000 Subject: [PATCH 2/2] changes rainbow-space Changed back to spacecake --- .cloud66/services.yml | 4 ++-- .../bricksandmortar/middleman/source/index.html.slim | 2 +- bakery/chef/chef.rb | 6 +++--- bakery/counter/app/counter.rb | 4 ++-- bakery/docker-compose.yml | 4 ++-- bakery/minions/spacecake/Dockerfile | 4 ++-- bakery/minions/spacecake/docker-compose.yml | 2 +- bakery/minions/spacecake/spacecake_minion.php | 10 +++++----- bakery/minions/spacecake/start_spacecake_minion.sh | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.cloud66/services.yml b/.cloud66/services.yml index 602f2a5..296205f 100644 --- a/.cloud66/services.yml +++ b/.cloud66/services.yml @@ -30,11 +30,11 @@ services: env_vars: RACK_ENV: production build_root: bakery/counter - worker-baker-rainbowcake: + worker-baker-spacecake: git_url: http://github.com/cloud66-samples/microservices_101.git git_branch: master dockerfile_path: Dockerfile - build_root: bakery/minions/rainbowcake + build_root: bakery/minions/spacecake worker-baker-bagel: git_url: http://github.com/cloud66-samples/microservices_101.git git_branch: master diff --git a/bakery/bricksandmortar/middleman/source/index.html.slim b/bakery/bricksandmortar/middleman/source/index.html.slim index 83734ce..a40ab3a 100755 --- a/bakery/bricksandmortar/middleman/source/index.html.slim +++ b/bakery/bricksandmortar/middleman/source/index.html.slim @@ -11,7 +11,7 @@ label for="kind" kind select.form-control name='kind' id="kind" ng-init="order.kind='bagel'" ng-model='order.kind' option value="bagel" Bagel - option value="rainbowcake" Rainbowcake + option value="spacecake" Spacecake option value="donut" Donut .form-group diff --git a/bakery/chef/chef.rb b/bakery/chef/chef.rb index 7212409..1c090c4 100755 --- a/bakery/chef/chef.rb +++ b/bakery/chef/chef.rb @@ -11,7 +11,7 @@ ch = conn.create_channel work_queue = ch.queue("bakery.order", :durable => true) bagel_queue = ch.queue("bakery.bagel.order", :durable => true) -rainbowcake_queue = ch.queue("bakery.rainbowcake.order", :durable => true) +spacecake_queue = ch.queue("bakery.spacecake.order", :durable => true) donut_queue = ch.queue("bakery.donut.order", :durable => true) @@ -39,9 +39,9 @@ bagel_queue.publish(payload, :persistent => true) end end - if task['kind'] == 'rainbowcake' + if task['kind'] == 'spacecake' task['amount'].times do |count| - rainbowcake_queue.publish(payload, :persistent => true) + spacecake_queue.publish(payload, :persistent => true) end end if task['kind'] == 'donut' diff --git a/bakery/counter/app/counter.rb b/bakery/counter/app/counter.rb index b36f615..4e0d828 100644 --- a/bakery/counter/app/counter.rb +++ b/bakery/counter/app/counter.rb @@ -18,7 +18,7 @@ class API < Grape::API # GET http://xxx/v1/orders - curl -X GET -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders # GET http://xxx/v1/orders/1 - curl -X GET -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders/1 - # POST http://xxx/v1/orders/1 - curl -X POST --data '{"amount": 1,"flavour": "cola","kind": "rainbowcake"}' -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders + # POST http://xxx/v1/orders/1 - curl -X POST --data '{"amount": 1,"flavour": "cola","kind": "spacecake"}' -H "Content-type: application/json" -H "Accept: application/json" http://192.168.99.100:8000/v1/orders # POST http://xxx/v1/orders/1/sweet/done - curl -X POST -H "Accept: application/json" http://192.168.99.100:8000/v1/orders/1/sweet/done @@ -47,7 +47,7 @@ class API < Grape::API desc 'Create a order.' params do - requires :kind, type: String, desc: 'The sweet goods', values: ['rainbowcake', 'bagel', 'donut'] + requires :kind, type: String, desc: 'The sweet goods', values: ['spacecake', 'bagel', 'donut'] requires :flavour, type: String, desc: 'Your favorite sweet flavour', values: ['strawberry', 'cola', 'glitter', 'rum'] requires :amount, type: Integer, desc: 'Amount of sweet stuff.' end diff --git a/bakery/docker-compose.yml b/bakery/docker-compose.yml index eb28b0c..d63e6d0 100644 --- a/bakery/docker-compose.yml +++ b/bakery/docker-compose.yml @@ -64,8 +64,8 @@ services: ports: - "8000:80" - rainbowcake: - build: ./minions/rainbowcake + spacecake: + build: ./minions/spacecake stdin_open: true tty: true links: diff --git a/bakery/minions/spacecake/Dockerfile b/bakery/minions/spacecake/Dockerfile index bab7ffa..cb221ad 100644 --- a/bakery/minions/spacecake/Dockerfile +++ b/bakery/minions/spacecake/Dockerfile @@ -9,5 +9,5 @@ WORKDIR /home/app COPY . /home/app RUN docker-php-ext-install mbstring bcmath -#start the rainbowcake minion -CMD /home/app/start_rainbowcake_minion.sh \ No newline at end of file +#start the spacecake minion +CMD /home/app/start_spacecake_minion.sh \ No newline at end of file diff --git a/bakery/minions/spacecake/docker-compose.yml b/bakery/minions/spacecake/docker-compose.yml index 8acafe6..481f43b 100644 --- a/bakery/minions/spacecake/docker-compose.yml +++ b/bakery/minions/spacecake/docker-compose.yml @@ -1,6 +1,6 @@ version: '2' services: - rainbowcake: + spacecake: build: . stdin_open: true tty: true diff --git a/bakery/minions/spacecake/spacecake_minion.php b/bakery/minions/spacecake/spacecake_minion.php index e7f9a85..1f614da 100644 --- a/bakery/minions/spacecake/spacecake_minion.php +++ b/bakery/minions/spacecake/spacecake_minion.php @@ -6,26 +6,26 @@ $connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST); $channel = $connection->channel(); -$channel->queue_declare('bakery.rainbowcake.order', false, true, false, false); +$channel->queue_declare('bakery.spacecake.order', false, true, false, false); $channel->queue_declare('bakery.sweet.done', false, true, false, false); echo '--------------------------------', "\n"; -echo 'bagel rainbowcake v1.0 ready to rock!', "\n"; +echo 'bagel spacecake v1.0 ready to rock!', "\n"; echo '--------------------------------', "\n"; echo $_ENV['HOSTNAME'] . ':-- [*] Waiting for bagel back orders (backing time = 7)', "\n"; function process_message($message) { global $channel; - echo $_ENV['HOSTNAME'] . ':-- [.] Start backing a rainbowcake', "\n"; + echo $_ENV['HOSTNAME'] . ':-- [.] Start backing a spacecake', "\n"; sleep(2); - echo $_ENV['HOSTNAME'] . ':-- [x] Backing a rainbowcake done', "\n"; + echo $_ENV['HOSTNAME'] . ':-- [x] Backing a spacecake done', "\n"; $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); $response_message = new AMQPMessage($message->body); $channel->basic_publish($response_message, '', 'bakery.sweet.done'); }; $channel->basic_qos(null, 1, null); -$channel->basic_consume('bakery.rainbowcake.order', 'consumer', false, false, false, false, 'process_message'); +$channel->basic_consume('bakery.spacecake.order', 'consumer', false, false, false, false, 'process_message'); while(count($channel->callbacks)) { $channel->wait(); diff --git a/bakery/minions/spacecake/start_spacecake_minion.sh b/bakery/minions/spacecake/start_spacecake_minion.sh index c915f0a..0835811 100755 --- a/bakery/minions/spacecake/start_spacecake_minion.sh +++ b/bakery/minions/spacecake/start_spacecake_minion.sh @@ -19,4 +19,4 @@ function check_port() { } check_port "rabbitmq" "5672" -php rainbowcake_minion.php \ No newline at end of file +php spacecake_minion.php \ No newline at end of file