ledgersmb / LedgerSMB

Double-entry accounting & ERP for the web
https://ledgersmb.org
Other
419 stars 151 forks source link

Problems with my docker config #8416

Open EBS-DarkD opened 1 week ago

EBS-DarkD commented 1 week ago

Version: 1.11.17 Browser: chrome and firefox What happened?

I am running this in a portainer docker stack which already has an active postgres 16 container running

  lsmb:
    image: ledgersmb/ledgersmb:latest
    container_name: lsmb
    networks:
      t2_proxy:
        ipv4_address: 192.168.101.41 
    ports:
      - "5762:5762"
    environment:
      POSTGRES_HOST: 192.168.101.230
      POSTGRES_PORT: 5432
      LSMB_WORKERS: ${LSMB_WORKERS:-5}
    volumes:
      - ./ledgersmb/conf:/srv/ledgersmb/local/conf:rw

When I go into the setup.pl and add the database credentials for the account I've setup in the postfix container to create a new database, I get the following error

Error!

Could not connect to database: could not translate host name "localhost" to address: Temporary failure in name resolution at lib/LedgerSMB/Scripts/setup.pm line 1123.

dbversion: 1.11.17, company:

Note: For the POSTGRES_HOST I've tried the IP address, and the container name with no difference. The database server is up and has several other containers using it

I am also facing an issue with the permissions on the volume /srv/ledgersmb/local/conf The logs show

/usr/local/bin/start.sh: line 71: ./local/conf/ledgersmb.yaml: Permission denied
/usr/local/bin/start.sh: line 113: ./local/conf/ledgersmb.000.yaml: Permission denied
--------- LEDGERSMB CONFIGURATION:  ledgersmb.conf
cat: ./local/conf/ledgersmb.yaml: No such file or directory
--------- LEDGERSMB CONFIGURATION --- END

when I open a console and check the permissions and ownership of the files and folders in /srv/ledgersmb ownership of all files and folders is 1000:1000 except local which is www-data:root

How can I change the ownership of the mounted volume?

I'm a bit stumped with this setup and hope that someone can help!

ehuelsmann commented 3 days ago

Hi!

There are several problems going on here, I think. Let's tackle them one by one. First of all, I'd like to verify that I'm correctly understanding your setup. Could you please confirm that your database is running on the host on which the container is also running?

If so, I can say from experience: Running PostgreSQL on the host while running LedgerSMB in the container poses an extra challenge: PosgreSQL binds to network interfaces it finds at application startup. If your container isn't running when Pg starts up, Pg isn't listening on the interface that's attached to your container. I'm running a system with this setup myself: Pg is configured to listen on the main IP of the docker default network (172.17.0.1). In the container the POSTGRES_HOST=172.17.0.1 variable is then set.

As far as the YAML is concerned that you provided, I'm not familiar with portainer: is that a snippet of portainer configuration? Or is it a snippet of docker-compose configuration? If the latter, I'm not aware that docker compose allows the specification of IP addresses. Are you sure the container has been assigned this ip address?

Then last but not least: the process in the container runs as uid=33 (which is www-data). In order to share data between the container and the host, you need to either set the permissions in such a way that the files can be read by a process running in the same user or group (44x) or open them for reading by everybody (xx4). In this case, you probably want to set directories to 755 and files to 644 perms. That should allow the processes in the container to read the config files.

Hope this helps!

Regards,

Erik.