OpenOlitor / openolitor-docker-compose

Running OpenOlitor on local machines or in a cloud environment made easy
https://openolitor.org
GNU Affero General Public License v3.0
1 stars 2 forks source link

Getting error in Frontend when running locally #5

Closed bummzack closed 3 years ago

bummzack commented 3 years ago

I've just run the software as described here: https://github.com/OpenOlitor/openolitor-docker-compose#run-on-localhost

When trying to log in to the Client or Admin-Interface, the request to http://localhost:8080/api-csa1/auth/login fails with a 405 Error.

In the frontend I get the following error message:

{"cause":"","message":"HTTP method not allowed, supported methods: OPTIONS"}

This happens on both http://localhost:8080/#/login and http://localhost:8080/admin/#/login

Could this be a CORS configuration error?

mcmpp commented 3 years ago

Hi @bummzack ,

that's nice to have you around here! I would say the problem is not in the cors configuration but some of the images might not have being correctly loaded. I have made a video that you can check. Make sure to remove all the images first to be sure you start on a clean environment. In order to do this run : docker-compose down --rmi all -v. Make sure that all images are "up" as you can see in the last step. You will see on the video an error popping up at some point. This is due to my poor connection at the moment and you should not have it.

https://user-images.githubusercontent.com/13901369/105632316-bad85100-5e52-11eb-9d38-19ed7a1090d0.mp4

Please, let me know of you have any other difficulty

bummzack commented 3 years ago

Hi @mcmpp. Thanks for your reply! Sadly, I still get the issue, even after removing and recreating the docker-images. Seems unlikely, but maybe it's related to me using Mac OS X?

When listing the images using docker-compose ps, all of them are running, but the server is labeled unhealthy:

openolitor-docker-compose_client-admin_1          /docker-entrypoint.sh ngin ...   Up               80/tcp
openolitor-docker-compose_client-kundenportal_1   /docker-entrypoint.sh ngin ...   Up               80/tcp
openolitor-docker-compose_db_1                    docker-entrypoint.sh mysqld      Up               0.0.0.0:3306->3306/tcp
openolitor-docker-compose_nginx_1                 /docker-entrypoint.sh ngin ...   Up               80/tcp, 0.0.0.0:8080->9000/tcp
openolitor-docker-compose_pdf-tool_1              /docker-entrypoint.sh --sp ...   Up               0.0.0.0:9040->8080/tcp
openolitor-docker-compose_s3_1                    /usr/bin/docker-entrypoint ...   Up (healthy)     0.0.0.0:9050->9000/tcp
openolitor-docker-compose_server_1                /opt/docker/bin/openolitor ...   Up (unhealthy)   0.0.0.0:9003->9003/tcp
openolitor-docker-compose_smtp-proxy_1            MailHog                          Up               0.0.0.0:1025->1025/tcp, 0.0.0.0:8025->8025/tcp

Here are two screenshots of the login screens, displaying the error message. I've also checked different browsers, but it happens in all browsers I tested:

Screenshot 2021-01-24 at 17 03 16 Screenshot 2021-01-24 at 17 03 34
mcmpp commented 3 years ago

Hi @bummzack

great, that means that the issue is while starting the server. You can try to stop and start the server again. The server depends on some other components as the db and the s3. In case the server tries to connect to these components and they are not available, it will fail. This is we tried to avoid making the startup in 2 steps but sometimes it can still have troubles. Could you try

docker-compose stop server docker-compose up -d server

in case this does not work, you can get the logs doing this: docker-compose logs server

You can share the result here.

bummzack commented 3 years ago

Yeah no luck with stopping and starting the server. According to the logs, some SQL statements fail because of a missing table?

ERROR scalikejdbc.ActiveSession  - Failed preparing the statement (Reason: Error preparing query: Table 'csa1.arbeitsangebot' doesn't exist):

Here's the server-log.txt. The db-log.txt looks fine.

mcmpp commented 3 years ago

Hi @bummzack,

I was trying to reproduce your issue but I was not able. According to the log, there was an issue trying to apply the db scripts (but only some of them). It seems that there was some interruption on the startup phase. When you restart the server, you still go to this unstable state and it cannot start correctly. I would try to remove all and start from scratch again. So, remove all the images : docker-compose down --rmi all -v remove the folder (db will persist in a subfolder, we want to make sure we start with a clean db), clone it again, and run it according to the video.

Could you try this?

bummzack commented 3 years ago

I've tried the whole procedure again, based on a fresh git clone of the repository. Sadly, it didn't help.

I think this is an issue with Mac OS X and using bind mounts for the DB data. I also found this issue, which is probably what I'm facing here: https://github.com/docker-library/mysql/issues/99

Using a docker-volume instead of a bind mount solves the problems. Example:

version: '2.4'

services:
  db:
    image: mariadb
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=ofCourseThisIsTrueForTheRootPasswordToo
    volumes:
      # Using a docker volume
      - db-data:/var/lib/mysql
      - ./config/db/db_schema.sql:/docker-entrypoint-initdb.d/db_schema.sql
    ports:
      - "3306:3306"
  # … Rest of services omitted
volumes:
  db-data:

This solves the issue for me, so feel free to close this! I don't need persistence of the DB data directly in my filesystem… if need be, I can use sql-dumps. Thanks a lot for your help, not I can try your awesome application ❤️

mcmpp commented 3 years ago

Hi @bummzack ,

Nice that you found a way to make it work and share it with us!

Please, let us know if you have questions or we can assist somehow