ECONNREFUSED - Unable To Connect To Database
Hi, I've been trying to set up immich for a few hours now but can't get past this error. I'm happy to post logs, I'm using the recommended docker compose setup however I have adapted the compose file for my own setup. Please see below for my compose file. This is a completely new install and I've already tried a couple fixes such as switching the postgres container, deleting all postgres files and restarting my entire stack multiple times.
Any help is hugely appreciated, I'm at a complete loss with this and after reading multiple reddit and github posts I thought it was best to just post here.
Thank you!
16 Replies
:wave: Hey @molemanx,
Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:.
References
- Container Logs:
docker compose logs
docs
- Container Status: docker ps -a
docs
- Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
- Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA
Checklist
I have...
1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time).
2. :blue_square: read applicable release notes.
3. :blue_square: reviewed the FAQs for known issues.
4. :blue_square: reviewed Github for known issues.
5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
6. :blue_square: uploaded the relevant information (see below).
7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable
(an item can be marked as "complete" by reacting with the appropriate number)
Information
In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:
- Your docker-compose.yml and .env files.
- Logs from all the containers and their status (see above).
- All the troubleshooting steps you've tried so far.
- Any recent changes you've made to Immich or your system.
- Details about your system (both software/OS and hardware).
- Details about your storage (filesystems, type of disks, output of commands like fdisk -l
and df -h
).
- The version of the Immich server, mobile app, and other relevant pieces.
- Any other information that you think might be relevant.
Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)
If this ticket can be closed you can use the /close
command, and re-open it later if needed.please post the postgres container logs, you might need to go into the postgres folder to find thme
Above is from a fresh install, after that no signs of any errors
Then it creates the database as expected:
This is the error I get on the main immich container
um what is this:
192.168.2.5
please post your env
wait how are your passing the database info into immich..?I modified it so I'm not using a .env file, since I already have a .env file and I didn't want to overload it with variables
192.168.2.5 should be socket proxy
But I can remove that if it's not needed, I was just trying to make sure the containers could talk to eachother
how are you telling immich what database to connect to??
Please review our docs:
https://immich.app/docs/install/environment-variables/
You MUST pass the DB_ urls into immich somehow. how you do this is up to you
Is that within the setup here somewhere? https://immich.app/docs/install/docker-compose
That's what I've been looking at, is that still correct?
I've added the URL, but I don't understand why? The documentation states that it makes all the dbpasswords, DBusername, DBname and DBport redundant.
I've added the url to the environment variable of postgres, still no luck sadly
I now get the below error:
Please start with just the default setup, then once that's working you can adapt it to whatever custom stuff you wanna do
Alright, I'll try again tomorrow
I didn't think I was doing anything too crazy, I had just replaced all the variables so they didn't have to sit in my env file, but oh well.
I'm hopefully okay to use my existing env file? The reason I ended up doing it this way was because I had an env file already but it looked like the compose file was unable to reference above wherever the file sat for some reason
What do you mean have an env file already?
I have a 'master' docker compose file that pulls in all my docker compose files from one place. This sits next to an env file that contains domains, hostnames, directories for important data etc. It's already got a fair bit in it, so I just didn't want to clutter it further
I'm sure I can work it out tomorrow, all good
Thanks for your time
There's... not really a good reason to do that, I think. It just mixes everything unnecessarily when half the point of compose is it gives you nice separation
You should look at this PR to understand exactly what you need to do to remove the env_file. you did it poorly. #14889