Automounting luks drive on startup

Hi, I am trying to mount my luks encrypted ext4 harddrive to /mnt/mediadata
my /etc/fstab entrance is:
/dev/mapper/mediadata /mnt/mediadata ext4 defaults,noatime,nofail 0 0

my /etc/crypttab entrance is:
mediadata UUID=[...] /lukskey luks

at /lukskey I have stored the password in a text file, since the system is also on an encrypted drive.
Now when I boot up I still get promted to enter the password. I am trying to get it mounted automatically, without me needing to enter a lengthy password every time.
I have read through many articles, but couldn’t find one that explains my problem in language understandable to me.

Thanks for helping!

I managed to do it by creating a random file according to these instructions.

Not allowed to link it, but still for the credit.
community.infosecinstitute dot com/discussion/115918/possible-to-setup-open-luks-without-entering-a-password-at-boot-time

I am not sure why this works but the password in the same named file didn’t work. But at least it works.