Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoiceshelf cannot configure db connection after container is restarted Part 2 #25

Open
joem569 opened this issue Nov 11, 2024 · 1 comment

Comments

@joem569
Copy link

joem569 commented Nov 11, 2024

Hello! I found a problem with my install and I see that Lulu had the same issue a little while ago, though I'm running the MariaDB config and he was running the Postgres Same issue, though. Invoiceshelf runs fine, until I stop or restart the container, then it loses connection to the DB. To get it working again, I have to delete the DB files and restart from scratch. It will then run until the containers restart, then it loses connection again. I've tried the latetst and nightly tags, both yield the same.

Screen Shot 2024-11-11 at 11 42 48 AM
Here's the log file.

services:
  invoiceshelf_db:
    container_name: invoiceshelf_db
    image: mariadb:10
    environment:
      - MYSQL_DATABASE=invoiceshelf
      - MYSQL_USER=invoiceshelf
      - MYSQL_PASSWORD=mypassword
      - MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=true
    ports:
      - 13306:3306
    volumes:
      - /var/snap/docker/invoiceshelf/mysql:/var/lib/mysql
    networks:
      - invoiceshelf
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "mariadb-admin" ,"ping", "-h", "localhost"]
      timeout: 20s
      retries: 10

  invoiceshelf:
    image: invoiceshelf/invoiceshelf:nightly
    container_name: invoiceshelf_app
    ports:
      - 1080:80
    volumes:
      - /var/snap/docker/invoiceshelf/invoiceshelf_mysql/data:/data
      - /var/snap/docker/invoiceshelf/invoiceshelf_mysql/conf:/conf
    networks:
      - invoiceshelf
    environment:
      - PHP_TZ=America/New_York
      - TZ=America/New_York
      - APP_NAME=Laravel
      - APP_ENV=local
      - APP_DEBUG=true
      - APP_URL=https://my.domain.net
      - DB_CONNECTION=mysql
      - DB_HOST=invoiceshelf_db
      - DB_PORT=13306
      - DB_DATABASE=invoiceshelf
      - DB_USERNAME=invoiceshelf
      - DB_PASSWORD=mypassword
      - CACHE_STORE=file
      - SESSION_DRIVER=file
      - SESSION_LIFETIME=120
      - SESSION_ENCRYPT=false
      - SESSION_PATH=/
      - SESSION_DOMAIN=my.domain.net
      - SANCTUM_STATEFUL_DOMAINS=my.domain.net
      - STARTUP_DELAY=2
#      - MAIL_DRIVER=
#      - MAIL_HOST=smtp.gmail.com
#      - MAIL_PORT=465
#      - MAIL_USERNAME=
#      - MAIL_PASSWORD=
#      - MAIL_ENCRYPTION=startls
    restart: unless-stopped
    depends_on:
      - invoiceshelf_db

networks:
  invoiceshelf:

And here's my compose file. I've replaced usernames, passwords, and domains for privacy. Edited for formatting.

What more can I share?

@joem569
Copy link
Author

joem569 commented Nov 11, 2024

So I got it to work by plugging and chugging. What fixed it was setting DB_HOST to the IP address of the machine plus the port. For some reason it is not happy with just calling the invoiceshelf_db service. Not a big deal for my setup, I have static IP addressing. But I'm curious to figure it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant