chiefwigms / picobrew_pico

MIT License
149 stars 63 forks source link

Trouble using Docker-compose version on QNAP server #338

Open trmong opened 2 years ago

trmong commented 2 years ago

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.

Intecpsp commented 2 years ago

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 commented 2 years ago

@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:

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

trmong commented 2 years ago

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:

trmong commented 2 years ago

@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 commented 2 years ago

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.

chiefwigms commented 2 years ago

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

tmack8001 commented 2 years ago

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

Intecpsp commented 2 years ago

https://picobrew.com/multibrew

trmong commented 2 years ago

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

chiefwigms commented 2 years ago

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

tmack8001 commented 2 years ago

@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.