#Dev
1 messages · Page 1 of 1 (latest)
PS C:\Users\Richard\Documents\CSE stuff\paimon\paimon-moe-api> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
PORTS NAMES
4ddad1f27a07 redis:6.2.4-alpine "docker-entrypoint.s…" About an hour ago Up 19 minutes 6379/tcp paimon-moe-api-redis-1
bcf2b17a76b2 postgres:13.3-alpine "docker-entrypoint.s…" About an hour ago Up 19 minutes 5432/tcp paimon-moe-api-postgres-1
766e72ecc473 ghcr.io/madebaruna/paimon-moe-api:latest "docker-entrypoint.s…" About an hour ago Restarting (1) 39 seconds ago paimon-moe-api-api-1
cant really use the docker-compose for local dev, you need to run another redis and postgres manually
like redis-server?
you can make another redis container, redis-server also works
i got another container inside docker with docker run --name redis -d -p 6379:6379 redis:6.2.4
i don't think windows supports redis directly
man it's too late i gotta go to sleep
i ran postgres in cmd using
docker run --name basic-postgres --restart always -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e PGDATA=paimonmoe -e DB_HOST=127.0.0.1 -p 5432:5432 -v db_data:/var/lib/postgresql/data -it postgres:13.3-alpine
but still get the error
Error: getaddrinfo ENOTFOUND postgres
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'postgres'
}
have you canged the env to localhost ?
changed env to
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=paimonmoe
DB_USERNAME=postgres
DB_PASSWORD=password
XXHASH_SEED=1234
GOOGLE_APPLICATION_CREDENTIALS=/service_account/google-service-account.json
REDIS_URL=redis://localhost:6379
TALLY_QUEUE_CONCURRENCY=2
PLAUSIBLE_URL=
PLAUSIBLE_TOKEN=
HEADER_SECRET=password
PROXY_LOCATION=/proxies/proxies.txt
and postgres command to this (POSTGRES_DB was the right one)
docker run --name basic-postgres --restart always -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=paimonmoe -e DB_HOST=127.0.0.1 -p 5432:5432 -v db_data:/var/lib/postgresql/data -it postgres:13.3-alpine
and it gets through!
do we need to populate the db with data from somewhere?
2022-02-19 10:02:15.145 UTC [56] ERROR: relation "wish_total" does not exist at character 35
2022-02-19 10:02:15.145 UTC [56] STATEMENT: SELECT total, count(*) count FROM "wish_total" "WishTotal" WHERE "WishTotal"."bannerType" = $1 GROUP BY total
2022-02-19 10:02:15.188 UTC [57] ERROR: relation "banner" does not exist at character 178
2022-02-19 10:02:15.188 UTC [57] STATEMENT: SELECT "Banner"."id" AS "Banner_id", "Banner"."name" AS "Banner_name", "Banner"."type" AS "Banner_type", "Banner"."start" AS "Banner_start", "Banner"."end" AS "Banner_end" FROM "banner" "Banner" WHERE "Banner"."id" = $1 LIMIT 1
also sorry for bothering you with all these questions, i'm not used to setting up a new environment
you need to run the migration command
what's the migration command?
Pnpm run migrate
query failed: DROP INDEX "wish_uniqueId_idx"
error: error: index "wish_uniqueId_idx" does not exist
I found UpdateWishTotalTable1639306605998 has this query in the up method
I also ran into a lot of issues trying to run this on my windows laptop, gonna try with macbook
ok a lot fewer problems on macbook. i was able to get postgres and redis running on docker-compose but the pnpm migrate is failing because of this error
Error during migration run:
Error: connect ECONNREFUSED 23.217.138.110:5432
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '23.217.138.110',
port: 5432
}
.env looks like this:
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=paimonmoe
DB_USERNAME=postgres
DB_PASSWORD=password
XXHASH_SEED=1234
GOOGLE_APPLICATION_CREDENTIALS=/service_account/google-service-account.json
REDIS_URL=redis://redis:6379
TALLY_QUEUE_CONCURRENCY=2
PLAUSIBLE_URL=
PLAUSIBLE_TOKEN=
HEADER_SECRET=password
PROXY_LOCATION=/proxies/proxies.txt
are the postgres settings correct?
@brazen hound has leveled up to LEVEL 1 
fwiw docker says
```
but i changed .env to `DB_HOST=0.0.0.0` and get the same error
if you use docker-compose up -d it should be working tho, dunno the problem here