picobrew_pico icon indicating copy to clipboard operation
picobrew_pico copied to clipboard

Trouble using Docker-compose version on QNAP server

Open trmong opened this issue 2 years ago • 11 comments

I am trying to spin up the the docker compose version using container station on my QNAP server. I have the server running and it works except for two major issues. Having limited success debugging and would like some help on how to troubleshoot.

I was able to get the docker-compose working with some minor changes. There are directories that are missing in what needs to be created. Also QNAP uses port 8080 so I moved the sever to 5080. I have been able to get it running and can use the web interface with one issue. I cannot create new recipes in the PICO section. I can import and clone. I can also retrieve the pack info from picobrew.com. When I try to create a new recipe I fill in the data click, the green box, and I get the green checkboxes but no success bar at the top and the file is not saved. This only happens on the PICO tab the Zymatic and Zseries work fine.

I think this is related to not finding recipes for my Picobrew as described below....

I am also able to communicate to the Picobrew machine but none of the recipes will show up on the machine. I just get the error message about logging in to Picobrew to register the picopak. I know it is communicating as I have PCAP traces of the traffic. The server just sends back "##\r\n". Which I assume is the default for no paks associated. Even though I have two recipes in the library.

server net traffic

Any suggestions on how to debug would be appreciated.

Thanks.

trmong avatar Apr 14 '22 15:04 trmong

I've been meaning to update those docs with what I had to do, but keep forgetting. I am running on Docker on a Pi and not having issues creating or deleting recipes. Are you getting any error in the browser console?

Intecpsp avatar Apr 14 '22 19:04 Intecpsp

@trmong here is my docker-compose file for reference:

version: "3.8"

services: picobrew_pico: container_name: picobrew_pico image: chiefwigms/picobrew_pico:latest ports: - 80:80 volumes: - ./app/recipes/:/picobrew_pico/app/recipes/ - ./app/sessions/:/picobrew_pico/app/sessions/ - ./config.yaml:/picobrew_pico/config.yaml restart: unless-stopped

As well as the persistent folder structure that I had to create: Screen Shot 2022-04-14 at 3 45 10 PM

Intecpsp avatar Apr 14 '22 19:04 Intecpsp

Hi Cody,

No errors in the console. I started to add some logger info prints to try and find the issue but it seems like when you click the button it does the validation and never calls the click function...

$('#b_new_recipe').click(function () {
    var form = document.getElementById('f_new_recipe');

Here is the debug I added. One for the GET and one for the POST. POST never getting called so I started adding debug upstream.

app_1 | 172.29.0.1 - - [14/Apr/2022 19:46:12] "GET / HTTP/1.1" 200 9963 0.090815 app_1 | 192.168.168.179 - - [14/Apr/2022 19:46:33] "GET /new_zymatic_recipe HTTP/1.1" 200 8934 0.003041 app_1 | [2022-04-14 19:46:43,357] INFO in routes_frontend: INFO: GET: new pico recipe => return html

Last entry I see in the log. It is weird that zymatic and zseries work with no issue it is jut the Pico tab.

Here is my docker-compose file:

version: "3.8" services: nginx: image: nginx:1.15-alpine restart: unless-stopped command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'" volumes: - ./scripts/docker/nginx/conf:/etc/nginx/conf.d - ./scripts/docker/nginx/certs:/certs ports: - 580:80 - 5443:443 links: - app

app: build: context: . dockerfile: Dockerfile environment: FLASK_ENV: development PORT: 8080 volumes: - type: bind source: ./app/recipes target: /picobrew_pico/app/recipes - type: bind source: ./app/sessions target: /picobrew_pico/app/sessions - type: bind source: ./app/firmware target: /picobrew_pico/app/firmware ports: - 5080:8080

trmong avatar Apr 14 '22 19:04 trmong

@Intecpsp Thanks !!!

  • ./config.yaml:/picobrew_pico/config.yaml

The config.yaml docker-compose mapping fixed the recipes not showing up on the Picobrew. So one problem down.

Still baffled by the save button not working in the Pico new recipe creation page.

trmong avatar Apr 14 '22 22:04 trmong

Using the Chrome debugger to trace the button click in pico_recipe.js, I have found the validate form function is failing on the ABV check. The element.min value is set to 0 this will cause the AND condition to fail in the following logic...

function validate(form) { let valid = true; for (element of form.getElementsByTagName('input')) { const $feedback = $(element).siblings(".invalid-feedback", ".invalid-tooltip"); if (element.type == "text" && element.pattern) { const re = new RegExp(element.pattern) if (!re.test(element.value)) { $feedback.show(); valid = false; } }

    if (element.type == "number" && (element.min || element.max)) {
        if ((element.min && element.value < element.min) || (element.max && element.value > element.max)) {
            $feedback.show();
            valid = false;
        }
    }
};

Need to figure out how this is set now.

trmong avatar Apr 14 '22 23:04 trmong

why not just set an abv > 0? I think the only thing that it is used for is for display on the pico LCD

chiefwigms avatar Apr 21 '22 03:04 chiefwigms

Cause if you brew tea or malta there is no ABV 🤣. We should allow 0 ABV so folks can brew tea, kombucha, coffee and other strange beverages like horchata! You know be the single all purpose "counter top" brewer people use everyday.... #YouBrewU

tmack8001 avatar Apr 21 '22 12:04 tmack8001

https://picobrew.com/multibrew

Intecpsp avatar Apr 21 '22 18:04 Intecpsp

If you look issue #339 that was closed, the bug I was experiencing has been fixed. My suggestion for the fix is detailed in the second code block. It could easily be changed from element.min < to element.min <= to allow 0 values.

Thanks.

Tab

trmong avatar Apr 21 '22 20:04 trmong

Yep- appreciate it - I looked at it briefly, but closed it since its a duplicate issue to this. In the future, its easier to submit a PR instead of just pasting code into the comments. I'll try to fix it this weekend

chiefwigms avatar Apr 21 '22 20:04 chiefwigms

@trmong I just forced a change through that should fix the ABV and IBU checks to parse the html values as floating point numbers prior to doing a comparison.

See if that fixes your issues with recipe creation.

tmack8001 avatar May 24 '22 15:05 tmack8001