JaneJeon / blink

Modern, lightweight, planet-scale link shortener for teams 🎉
https://docs.blink.rest
GNU Affero General Public License v3.0
279 stars 27 forks source link

Issue with Docker Deployment #810

Closed ShadowPeo closed 4 months ago

ShadowPeo commented 4 months ago

Disclaimers

Issue Description

Describe the bug Upon startup, simply get errors stating that an error has occurred in relation to an invalid URL, however best I can see is that all URL's are valid and entered

Error from startup is: 2024/05/14 01:39PM 50 | pid=6 hostname=c4f286bb3599 err={"type":"TypeError","message":"Invalid URL","stack":"TypeError [ERR_INVALID_URL]: Invalid URL\n at new NodeError (node:internal/errors:405:5)\n at new URL (node:internal/url:611:13)\n at Object. (/home/node/models/link.js:10:16)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:121:18)\n at Object. (/home/node/routes/api/links.js:3:14)","input":"","code":"ERR_INVALID_URL"} msg=uncaughtException

There is an error in the install when running db:migrate that may or may not be related as it also complains about a newer version

The NPM Error is as follows:

db:migrate knex migrate:latest

getaddrinfo EAI_AGAIN postgres_blink Error: getaddrinfo EAI_AGAIN postgres_blink at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) npm notice npm notice New major version of npm available! 9.6.7 -> 10.7.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.7.0 npm notice Run npm install -g npm@10.7.0 to update! npm notice

Utilising a straight busybox image to inspect the network behind it does show that postgres_blink is available as a URL

The environment files apart from the BASE_URL and OAUTH2_ENABLED which has been disabled for testing is an exact copy of the example in the Repo as I was trying to troubleshoot the issue

Deployment Method Docker with docker-compose.yml and .env files on Ubuntu 22.04 LTS

To Reproduce Steps to reproduce the behavior: Download the docker-compose.yml and .env files. Set Base URL and the OAUTH_ENABLED=false

docker compose create docker start postgres_blink docker start redis_blink docker run --env-file ./.env ghcr.io/janejeon/blink:latest npm run db:migrate

ERROR 2 gets dumped here

docker start blink

ERROR 1 Here in logs

JaneJeon commented 4 months ago

The error message during automatic migration is pretty clear on the issue:

getaddrinfo EAI_AGAIN postgres_blink Error: getaddrinfo EAI_AGAIN postgres_blink

The container cannot contact the postgres container under the postgres_blink address. You'll need to check your postgres container and see which hostname it has. Chances are, you've mixed up the root-level docker-compose (which is only for development) and the docker-compose under deploy/. In particular, the docker run --env-file ./.env is highly suspect, as the deploy version of docker compose file already has its own .env that is configured within the directory (and you may be pointing to the root-level .env file, which, again, is only for development).

As this is an issue with trying to use docker compose and not with the actual software, I will close this.