david-loe / abrechnung

Reisekostenabrechnung inkl. automatischer Pauschalen Berechnung auch für internationale Reisen
GNU Affero General Public License v3.0
12 stars 2 forks source link

suspected CORS issue but ultimately an issue with openldap and docker ulimits. #1

Closed cocoonkid closed 1 year ago

cocoonkid commented 1 year ago

This is a really nice project but I tried to get it to work locally. I can get to the login screen but not past.. image

Also how can I set the password for the admin user?

My apology if the solutions are obvious but I really tried for a while now and also reset the mongosh admin user etc but did not help and I am not really versed with vue but want to learn :)

I know my docker setup is working so far.

david-loe commented 1 year ago

Can you post your .env file?

cocoonkid commented 1 year ago

thanks for the swift reply.

unchanged from repo default.

# To ignore .env: git update-index --assume-unchanged .env
# To not ignore:  git update-index --no-assume-unchanged .env

# development | production
NODE_ENV=development

# Adding admin rights to one user
ADMIN_UID=professor

# URL to reach the frontend and backend (without trailing slash)
VITE_FRONTEND_URL=http://localhost:5000
VITE_BACKEND_URL=http://localhost:8000

# Timezone - find yours here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=Etc/UTC

# Cookie Secret
COOKIE_SECRET=secret

# LDAP Settings
LDAP_URL=ldaps://ldap:636
LDAP_BINDDN=cn=admin,dc=planetexpress,dc=com
LDAP_BINDCREDENTIALS=GoodNewsEveryone
LDAP_SEARCHBASE=ou=people,dc=planetexpress,dc=com
LDAP_SEARCHFILTER=(uid={{username}})
LDAP_TLS_REQUESTCERT=TRUE
LDAP_TLS_REJECTUNAUTHORIZED=FALSE
# The Attributes that define the mail adress, uid and display name of an LDAP user
LDAP_MAIL_ATTRIBUTE=mail
LDAP_UID_ATTRIBUTE=uid
LDAP_DISPLAYNAME_ATTRIBUTE=displayName

# SMTP Settings
SMTP_HOST=inbucket
SMTP_PORT=2500
# true for 465, false for other ports
SMTP_SECURE=FALSE
SMTP_USER=username
SMTP_PASS=password
MAIL_SENDER_ADDRESS=info@reisekostenabrechnung.com

# Ports
FRONTEND_PORT=5000
BACKEND_PORT=8000
INBUCKET_UI_PORT=9000
MONGO_EXPRESS_PORT=8081

# URL of the data base
MONGO_URL=mongodb://db:27017/reisekostenabrechnung

# Set default Language
VITE_I18N_LOCALE=de
VITE_I18N_FALLBACK_LOCALE=de
david-loe commented 1 year ago

Also how can I set the password for the admin user?

This can not be set, it comes from the LDAP. You can login with professor:professor

Which URL are you using in the Browser? At the backend the VITE_FRONTEND_URL is defined as only valid origin. So you have to use localhost:5000

cocoonkid commented 1 year ago

Yes that's what I am using.

I also tried professor:professor

image

can I disable ldap and just use normal authentication for testing? image

Again, my apology if I am missing smth obivious.

cocoonkid commented 1 year ago

Now this is appearing too:

image

cocoonkid commented 1 year ago

I reset the volumes and restarted the project:

image

and then the ldap container exits.

everything else looks good.

only upon restarting the containers the above error from the previous comment shows up.

cocoonkid commented 1 year ago

I was able to fix the problem. Actually it has nothing to do with your project :)

docker run --ulimit nofile=1024:1024 --rm -p 10389:10389 -p 10636:10636 rroemhild/test-openldap

fixed it and I added these in the compose file:

  # Test LDAP only in development mode
  ldap:
    build:
      context: ./dev-tools/ldap
      dockerfile: Dockerfile-${NODE_ENV}
    environment:
      - DEBUG=false
    ulimits:
      nofile:
        soft: 1024
        hard: 1024
cocoonkid commented 1 year ago

Thank you for taking the time!