Could not connect to db: parse "postgres://vikunja:s": invalid port ":s" after host. Weird error when using with Postgresql #1303

Closed
opened 2022-10-30 14:43:27 +00:00 by mnskewal · 4 comments

docker-compose.yml:

version: '3'

networks:
  vikunja:
    external: false

services:
  api:
    image: vikunja/api
    container_name: vikunja_api
    environment:
      VIKUNJA_DATABASE_HOST: host.docker.internal:5432
      #VIKUNJA_DATABASE_HOST: 172.17.0.1:5432
      VIKUNJA_DATABASE_PASSWORD: mydbpassword
      VIKUNJA_DATABASE_TYPE: postgres
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      # VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret>
      VIKUNJA_SERVICE_FRONTENDURL: https://my.domain.tld
    volumes: 
      - /home/myuser/vikunja/files:/app/vikunja/files
    extra_hosts:
        - "host.docker.internal:host-gateway"
    networks:
      - vikunja
    ports:
      - "15356:3456"
    restart: unless-stopped

  frontend:
    image: vikunja/frontend
    container_name: vikunja_frontend
    extra_hosts:
        - "host.docker.internal:host-gateway"
    networks:
      - vikunja
    ports:
      - "15300:80"
    restart: unless-stopped

sudo docker logs vikunja_api:

usermod: no changes
2022/10/30 14:03:41 No config file found, using default or config from environment variables.
2022-10-30T14:03:41.397446891Z: CRITICAL	▶ migration/initMigration 001 Could not connect to db: parse "postgres://vikunja:s": invalid port ":s" after host
--REPEAT THE ABOVE 3 LINES 20 TIMES--

Things I tried: Removing the colon and port number from the db host env variable. Same errors

I don't understand what I am doing wrong. I am pulling my hair out for an hour because of this
The only thing is, I didn't generate a JWT token because I can't figure out how. And the docs said it will be automatically generated on startup

Regarding Postgres: It works fine for my other containers wired in a similar fashion. I created the vikunja database and user with the proper password. And allowed the particular docker network to access the vikunja database. This shouldn't matter here, because it couldn't figure out the port in the first place

docker-compose.yml: ``` version: '3' networks: vikunja: external: false services: api: image: vikunja/api container_name: vikunja_api environment: VIKUNJA_DATABASE_HOST: host.docker.internal:5432 #VIKUNJA_DATABASE_HOST: 172.17.0.1:5432 VIKUNJA_DATABASE_PASSWORD: mydbpassword VIKUNJA_DATABASE_TYPE: postgres VIKUNJA_DATABASE_USER: vikunja VIKUNJA_DATABASE_DATABASE: vikunja # VIKUNJA_SERVICE_JWTSECRET: <a super secure random secret> VIKUNJA_SERVICE_FRONTENDURL: https://my.domain.tld volumes: - /home/myuser/vikunja/files:/app/vikunja/files extra_hosts: - "host.docker.internal:host-gateway" networks: - vikunja ports: - "15356:3456" restart: unless-stopped frontend: image: vikunja/frontend container_name: vikunja_frontend extra_hosts: - "host.docker.internal:host-gateway" networks: - vikunja ports: - "15300:80" restart: unless-stopped ``` sudo docker logs vikunja_api: ``` usermod: no changes 2022/10/30 14:03:41 No config file found, using default or config from environment variables. 2022-10-30T14:03:41.397446891Z: CRITICAL ▶ migration/initMigration 001 Could not connect to db: parse "postgres://vikunja:s": invalid port ":s" after host --REPEAT THE ABOVE 3 LINES 20 TIMES-- ``` Things I tried: Removing the colon and port number from the db host env variable. Same errors I don't understand what I am doing wrong. I am pulling my hair out for an hour because of this The only thing is, I didn't generate a JWT token because I can't figure out how. And the docs said it will be automatically generated on startup Regarding Postgres: It works fine for my other containers wired in a similar fashion. I created the vikunja database and user with the proper password. And allowed the particular docker network to access the vikunja database. This shouldn't matter here, because it couldn't figure out the port in the first place
Author

Tried with a JWT secret generated with openssl rand 256 | base64. No success

Tried with a JWT secret generated with `openssl rand 256 | base64`. No success
Owner

Are there any special characters in the db password?

Are there any special characters in the db password?
Owner

The jwt secret is irrelevant for this problem. It will be generated on startup if you don't provide one. You can provide any string as a secret.

The jwt secret is irrelevant for this problem. It will be generated on startup if you don't provide one. You can provide any string as a secret.
Author

Yes. Regenerated a password without special characters. It's all working now! Thanks. Please close the issue

Yes. Regenerated a password without special characters. It's all working now! Thanks. Please close the issue
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#1303
No description provided.