Search code examples
postgresqldocker-composedockerfilewebclienttryton

Sao for tryton 4.6 and gnuhealth


I have managed to install tryton and gnuhealth in a docker container with a docker file.

After installing the web client sao I am able to log in but i get a repeating notification popup Calling method resources on is not allowed it keeps popping up making the usage of the web client impossible. Initially the popup message was Forbidden but i solved this by moving the postgres attach folder into the gnuhealth user space.

The message is get from debug console in the browser is POST http://localhost:8000/health/bus 404 NOT FOUND

Is there a specific version of sao that i need to install for it to work I have used sao from both
git clone https://github.com/tryton/sao.git and hg clone http://hg.tryton.org/sao

I am following https://en.wikibooks.org/wiki/GNU_Health/Installation The only difference is that i am using dockerfile and docker-compose

I am not sure what the problem is.

Dockerfile:

FROM python:3.7

RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_11.x  | bash -

RUN apt-get -y install sudo \
       nano \
       gcc \
       g++ \
       patch \
       vim

RUN adduser gnuhealth && \
    echo "gnuhealth ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/gnuhealth && \
    chmod 0440 /etc/sudoers.d/gnuhealth

USER gnuhealth
RUN sudo apt-get install nodejs
ENV PATH="/home/gnuhealth/.local/bin:/home/gnuhealth/gnuhealth/tryton/server/trytond-4.6.19/bin:${PATH}"
WORKDIR home/gnuhealth

RUN wget https://ftp.gnu.org/gnu/health/gnuhealth-latest.tar.gz
RUN wget https://ftp.gnu.org/gnu/health/gnuhealth-3.4.1.tar.gz.sig
RUN tar xzf gnuhealth-latest.tar.gz

WORKDIR ./gnuhealth-3.4.1

RUN wget -qO- https://ftp.gnu.org/gnu/health/gnuhealth-setup-latest.tar.gz | tar -xzvf -
RUN pip install --user --upgrade pip setuptools wheel
RUN ./gnuhealth-setup install

RUN echo '[database] \n\
uri = postgresql://database:5432 \n\
path = /home/gnuhealth/attach \n\
\n\
[web] \n\
listen = *:8000 \n\
root=/home/gnuhealth/sao \n\
\n\
[webdav] \n\
listen = *:8080 \n\
ssl_webdav = False\n' > ~/gnuhealth/tryton/server/config/trytond.conf

WORKDIR /home/gnuhealth
RUN hg clone http://hg.tryton.org/sao sao
WORKDIR ./sao
RUN sudo npm install -g grunt-cli
RUN npm install grunt --save-dev
RUN npm install --production
RUN npm audit fix
RUN grunt

Docker Compose file:

version: '3.7'

services:
  database:
    image: postgres
    ports:
      - 5432:5432
    volumes:
      - pgdata:/var/lib/postgresql/data


  gnuserver:
    build:
      context: .
      dockerfile: Dockerfile
    links:
     - database

    ports:
      - 8000:8000
    environment:
      - PGPASSWORD=postgres
      - PGUSER=postgres
      - PGDATABASE=postgres
      - PGHOST=database
      - PGPORT=5432
    depends_on:
      - database
    command: ./start_gnuhealth.sh

volumes:
  pgdata: {}

Solution

  • GNU Health 3.4 uses Tryton 4.6 series. So you must also use the series 4.6 of sao. You can find it under the name tryton-sao: https://downloads-cdn.tryton.org/4.6/

    But another easier way to setup GNU Health on Docker would be to use the Tryton docker image tryton/tryton:4.6 an install the GNU Health packages using pip. This image contains the trytond server and the right sao.