Pyrrha-Platform / Pyrrha-Database

This repository contains the Pyrrha (created by Prometeo) solution application database that manages sensor readings over time. It targets MariaDB.
Apache License 2.0
2 stars 3 forks source link

Commands not running in MacOS #29

Open Filosss opened 1 year ago

Filosss commented 1 year ago

Hello.

I am trying to deploy the solution to test it in the my laptop, a MACbookPro, but looks like after following all the steps I can not start the containers due in the deploy scrip there are commands which don't run on mac. "failed to solve: executor failed running [/bin/sh -c pip install --upgrade pip && pip install --upgrade pipenv && apt-get update && apt install -y build-essential && apt install -y libmariadb3 libmariadb-dev && pip install --upgrade -r /app/requirements.txt]: exit code: 1" I guess I am close, most of the containers are completed: docker images | grep pyrrha pyrrha-rulesdecision latest 76e4f428edee About an hour ago 333MB pyrrha-dashboard latest 21d85a10f0a3 2 hours ago 1.24GB pyrrha-mqttclient latest 152c2fbc940f 2 hours ago 128MB pyrrha-api-auth latest 1789bd869f1b 2 hours ago 781MB pyrrha-simulator latest 1451b01156f2 2 hours ago 121MB pyrrha-wss latest 0d0e3f5ca50a 2 hours ago 108MB pyrrha-mariadb latest 8057693aceba 4 hours ago 389MB

imagen

I guess the solution should be around modifying this commands, like apt-get for brew, removing the -y, etc.

In fact I have tried to run it manually removing all these "non mac" commands, and with success. But when I run again the scrip for deploy fails.

Any options about updating these lines? Thank you for the support.

hawk4031 commented 1 year ago

Can you provide some details about which instructions you're using?

When running containers, those commands run inside the container, not on the host macOS system. The container base images are based on Debian or Ubuntu, so apt-get is the correct way to do this.

Also, can you provide the kind of Macbook Pro (whether it's Intel or Apple Silicon) and what version of macOS.

Filosss commented 1 year ago

Hello @hawk4031 . Thank you for the quick answer. You are totally right. I guess I was tired and after reading the output "failed to solve: executor failed running [/bin/sh -c pip install --upgrade pip && pip install --upgrade pipenv && apt-get update && apt install -y build-essential && apt install -y libmariadb3 libmariadb-dev && pip install --upgrade -r /app/requirements.txt]: exit code: 1" I was trying to fix it manually. But these commands are running inside the container so...

I was just following the instructions to deploy Pyrrha on my local machina from here: https://github.com/Pyrrha-Platform/Pyrrha-Deployment-Configurations/blob/main/DOCKER_COMPOSE.md#pyrrha-mqttclient I have done all the steps one by one and the outcome I have shared comes from running the command "docker-compose build".

The error appears here: => [pyrrha-api-main 1/5] FROM docker.io/library/python:3.7.7-slim@sha256:5b25848c082804c500e8cadce6d1b344791aa39d82cb9d56285c65e3e937f0c2 0.0s => CACHED [pyrrha-api-main 2/5] WORKDIR /app 0.0s => CACHED [pyrrha-api-main 3/5] COPY requirements.txt /app 0.0s => ERROR [pyrrha-api-main 4/5] RUN pip install --upgrade pip && pip install --upgrade pipenv && apt-get update && apt install -y build-essential && apt install -y 173.6s => [pyrrha-mariadb internal] load build context 0.0s => => transferring context: 72B

I am trying to deploy it in my Macbook Pro with an i7 Intel Processor and the Big Sur 11.6.8 version running.

Filosss commented 1 year ago

Hello @hawk4031.

Any ideas around this? I have reviewed all the steps and nothing changes.

Thank you

hawk4031 commented 1 year ago

I'll have a look and get back to you @Filosss

hawk4031 commented 1 year ago

The problem appears to be with the MariaDB package that pip is installing in that container (api-main specifically). Since it's not locked to a version in requirements.txt, it's trying to install the latest version, which is 1.1.4. This requires a certain version of MariaDB Connector/C, which the base container image (based on Debian Buster) doesn't have (it has an older version). The same is true for a newer version of this base container image, which is based on Debian Bullseye. The MariaDB Connector/C version that is installed with mariadb==1.1.4 is 3.2.4, but Buster and Bullseye only have 3.1.x.

One thing you can do for now is to set a specific version of the mariadb package in requirements.txt to a compatible version. The newest version of that package that I could get installed in the container is mariadb==1.0.11.

This also means we should make that change and put in a PR to lock it in.