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

500 error upon login with docker-compose-standalone #159

Open
RCdeWit opened this issue Jun 11, 2024 · 8 comments
Open

500 error upon login with docker-compose-standalone #159

RCdeWit opened this issue Jun 11, 2024 · 8 comments
Assignees
Labels
bug Something isn't working question A question about Davis and how it works stale This issue or PR hasn't been updated in a while

Comments

@RCdeWit
Copy link

RCdeWit commented Jun 11, 2024

I am trying to get Davis to run on my Synology NAS. I use Portainer to manage my Docker stacks.

I have a reverse proxy hosted elsewhere that connects to my NAS over Tailscale, so I think I need to use the standalone version.

I have adapted the docker-compose-standalone to the following:

version: "3.7"
name: "davis"

services:

  mysql:
    image: mariadb:10.6.10
    container_name: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MYSQL_DATABASE=${DB_DATABASE}
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASSWORD}
    volumes:
      - /volume1/docker/davis/database:/var/lib/mysql

  davis:
    build:
      context: ../
      dockerfile: ./docker/Dockerfile-standalone
    # image: davis:latest
    # If you want to use a prebuilt image from Github
    image: ghcr.io/tchapi/davis-standalone:edge
    container_name: davis-standalone
    environment:
      - APP_ENV=prod
      - DATABASE_DRIVER=mysql
      - DATABASE_URL=mysql://${DB_USER}:${DB_PASSWORD}@mysql:3306/${DB_DATABASE}?serverVersion=mariadb-10.6.10&charset=utf8mb4
      - MAILER_DSN=smtp://${MAIL_USERNAME}:${MAIL_PASSWORD}@${MAIL_HOST}:${MAIL_PORT}
      - ADMIN_LOGIN=${ADMIN_LOGIN}
      - ADMIN_PASSWORD=${ADMIN_PASSWORD}
      - AUTH_REALM=${AUTH_REALM}
      - AUTH_METHOD=${AUTH_METHOD}
      - CALDAV_ENABLED=${CALDAV_ENABLED}
      - CARDDAV_ENABLED=${CARDDAV_ENABLED}
      - WEBDAV_ENABLED=${WEBDAV_ENABLED}
      - WEBDAV_TMP_DIR=${WEBDAV_TMP_DIR}
      - WEBDAV_PUBLIC_DIR=${WEBDAV_PUBLIC_DIR}
      - INVITE_FROM_ADDRESS=${INVITE_FROM_ADDRESS}
      - APP_TIMEZONE=${TIMEZONE}
    depends_on:
      - mysql
    ports:
      - 8444:9000

volumes:
  database:
    name: database

Basically, I have changed the port because Portainer uses :9000 and the volume to match a directory on my NAS. I have also executed bin/console doctrine:migrations:migrate through the console of the docker-standalone container, although I can't see whether it succeeded.

I can access :8444/dashboard and get a login page. Whenever I try to log in with the ADMIN_LOGIN/ADMIN_PASSWORD credentials, I am redirected to a 500 page.

The logs of the davis-standalone container don't show anything off, although Portainer does give it the Unhealthy label.

Any help would be much appreciated!

@tchapi
Copy link
Owner

tchapi commented Jun 11, 2024

Hi @RCdeWit 👋🏼

  • Did bin/console doctrine:migrations:migrate output any log at all when you ran it? You can check whether the migrations were correctly executed by connection to the database and looking for the tables: there should be around 15 of them, like calendars, principals, etc

  • Being redirected to a 500 page upon login tends to indicate that it cannot find the DB somehow, I'd say, or that some file permissions are not correct

  • Can you have a look in /var/www/davis/var/log: there should be a prod.log file here that should contain more info on the 500 in the PHP realm

Keep me posted!

@tchapi tchapi added the bug Something isn't working label Jun 11, 2024
@tchapi tchapi self-assigned this Jun 11, 2024
@tchapi tchapi added the question A question about Davis and how it works label Jun 11, 2024
@lambolighting
Copy link

I believe i'm getting the same error on fresh install of the standalone version.
It returns an HTTP 500 Internal Server Error.
Screenshot 2024-06-14 124230

@tchapi
Copy link
Owner

tchapi commented Jun 15, 2024

@lambolighting this is very likely different — you seem to be missing the APP_ENV=prod variable?

@tchapi tchapi added the stale This issue or PR hasn't been updated in a while label Jun 22, 2024
@paul-m-koch
Copy link

I get the same error with the ghcr.io/tchapi/davis:latest image.
bin/console doctrine:migrations:migrate produces:

In StreamHandler.php line 149:

  The stream or file "/var/www/davis/var/log/prod.log" could not be opened in
   append mode: Failed to open stream: Permission denied
  The exception occurred while attempting to log: Error thrown while running
  command "doctrine:migrations:migrate". Message: "An exception occurred in t
  he driver: SQLSTATE[HY000] [2002] Connection refused"
  Context: {"exception":{},"command":"doctrine:migrations:migrate","message":
  "An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection ref
  used"}

And in /var/www/davis/var/log are no logs, but the folder is owned by root

@tchapi
Copy link
Owner

tchapi commented Jun 28, 2024

Interesting @paul-m-koch, thanks for the details

  • it seems the container can't connect to the database in your case, when you run the migrations
  • on top of that, there is a permission problem with the log folder → I'll have a look quickly!

@IngwiePhoenix
Copy link

Hello!

Just wrote a k3s deployment for the 5.0.2 container, standalone as well. I do get to the login, but the login does not work - so I am trying to manually put the migrations in to see if that helps. However, whenever I visit the front page, I see the following:

image

Any ideas as to what this could be? Thanks!

@IngwiePhoenix
Copy link

Running the DB migrations through the CLI was the trick - they had never been applied, so the app didn't work. I had also forgot to set APP_ENV.

Since the standalone container uses supervised, it'd be nice if it would optionally try to run migrations.

@tchapi
Copy link
Owner

tchapi commented Dec 1, 2024

it'd be nice if it would optionally try to run migrations.

I would happily review a PR if you find some time to propose a way to do it :)

note: Fixed the deprecation warning in the screenshot you shared in 19b2fde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question A question about Davis and how it works stale This issue or PR hasn't been updated in a while
Projects
None yet
Development

No branches or pull requests

5 participants