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

docker-compose.yml withPostgres doesn' t work. #8

Open
hrugani opened this issue Dec 7, 2024 · 4 comments
Open

docker-compose.yml withPostgres doesn' t work. #8

hrugani opened this issue Dec 7, 2024 · 4 comments

Comments

@hrugani
Copy link

hrugani commented Dec 7, 2024

I tried to create a self-hosting n8n using the docker-compose.yaml file for "WithPostgress".
I edited my .env file and changed the necessary values.
Positioning in the right directory for docker-compose/withPostgress and executing the command:

docker compose up -d

We tried both: docker compose subcommand present in the latest version of docker, and docker-compose cli as a direct command line. Both had the same behavior.
All seem to have been executed successfully. 2 containers appear up and running using the docker ps command.
But when I try to access the URL localhost:/5678 in any browser (Chrome, for example), the browser shows an error saying the URL isn't reachable. No service is listening in port 5678.

here are the logs from the n8n container:
log-n8n-container.log

I would appreciate any help with that subject.

@okayakdeniz
Copy link

Hello,

You may have run it with docker-compose up without changing the contents of the .env file at startup. When you fix the .env file and run it again, unfortunately, I guess it can't recover itself.

docker-compose down --volumes --remove-orphans
docker-compose up --build

you can run it again from the beginning.

If there are still problems,
Also, if you are running in Windows environment. It organises the file as CRLF to the .env file.

With Notepad ++ you can edit it as LF only and run it again.

I hope it will be useful for you.

@pentium10
Copy link

I had this issue myself, not sure why it doesn't work. I used the docker exec to run the command.

image

@dgruano
Copy link

dgruano commented Jan 3, 2025

I also encountered this problem. In case it helps anyone:

  • Make sure you have downloaded the init-data.sh script
  • Make sure your user follows the Postgres guidelines (e.g. I was using a username with uppercase characters that were converted to lowercase, so n8n could not access the DB with the uppercase credentials)

Otherwise, I agree with @okayakdeniz's suggestion on the cause and with @pentium10 with the potential solution.

@Fabio-Monti-02
Copy link

Fabio-Monti-02 commented Feb 3, 2025

postgres:
image: postgres:16
restart: always
env_file:
- .env
# environment:
# - POSTGRES_USER
# - POSTGRES_PASSWORD
# - POSTGRES_DB
# - POSTGRES_NON_ROOT_USER
# - POSTGRES_NON_ROOT_PASSWORD
volumes:
- db_storage:/var/lib/postgresql/data
- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 5s
timeout: 5s
retries: 10
Making this change worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants