pushkin-consortium / pushkin

A customizable, scalable ecosystem for massive online psychological experiments
https://pushkin-consortium.github.io/pushkin/
MIT License
24 stars 11 forks source link

"test_db" does not exist, despite it existing #226

Closed ayang21 closed 8 months ago

ayang21 commented 1 year ago

Using:

While running pushkin prep, I reach the error:

Waiting for transaction database to start... Problem running migrations. Failed to set up databases: error: database "test_db" does not exist /home/ayang25/.config/yarn/global/node_modules/pg-protocol/dist/parser.js:287 const message = name === 'notice' ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name); ^

error: database "test_db" does not exist at Parser.parseErrorMessage (/home/ayang25/.config/yarn/global/node_modules/pg-protocol/dist/parser.js:287:98) at Parser.handlePacket (/home/ayang25/.config/yarn/global/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/home/ayang25/.config/yarn/global/node_modules/pg-protocol/dist/parser.js:39:38) at Socket. (/home/ayang25/.config/yarn/global/node_modules/pg-protocol/dist/index.js:11:42) at Socket.emit (node:events:511:28) at addChunk (node:internal/streams/readable:332:12) at readableAddChunk (node:internal/streams/readable:305:9) at Readable.push (node:internal/streams/readable:242:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { length: 85, severity: 'FATAL', code: '3D000', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'postinit.c', line: '826', routine: 'InitPostgres' } Node.js v20.2.0

The error continues despite confirming with docker that "test_db" exists and after pushkin kill, pushkin armageddon, and docker login.

ayang21 commented 1 year ago

After running pushkin prep again after the error above, the old error seemed to have been fixed, however a new error arose:

3 [internal] load metadata for docker.io/library/node:20.2 3 ERROR: no match for platform in manifest sha256:14f0471d0478fbb9177d0f9e8c146dc872273dcdcfc7fea93a27ed81fc6b0e96: not found

[internal] load metadata for docker.io/library/node:20.2:

Dockerfile:1

1 | >>> FROM node:20.2 2 | 3 | COPY ./public /usr/src/app/public

ERROR: failed to solve: node:20.2: no match for platform in manifest sha256:14f0471d0478fbb9177d0f9e8c146dc872273dcdcfc7fea93a27ed81fc6b0e96: not found

at ChildProcess.exithandler (node:child_process:419:12)
at ChildProcess.emit (node:events:511:28)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5) {

code: 1, killed: false, signal: null, cmd: 'docker buildx build --platform linux/x64 -t server:latest pushkin/front-end', stdout: '', stderr: '#0 building with "default" instance using docker driver\n' + '\n' + '#1 [internal] load .dockerignore\n' + '#1 transferring context: 59B done\n' + '#1 DONE 0.0s\n' + '\n' + '#2 [internal] load build definition from Dockerfile\n' + '#2 transferring dockerfile: 367B done\n' + '#2 DONE 0.0s\n' + '\n' + '#3 [internal] load metadata for docker.io/library/node:20.2\n' + '#3 ERROR: no match for platform in manifest sha256:14f0471d0478fbb9177d0f9e8c146dc872273dcdcfc7fea93a27ed81fc6b0e96: not found\n' + '------\n' + ' > [internal] load metadata for docker.io/library/node:20.2:\n' + '------\n' + 'Dockerfile:1\n' + '--------------------\n' + ' 1 | >>> FROM node:20.2\n' + ' 2 | \n' + ' 3 | COPY ./public /usr/src/app/public\n' + '--------------------\n' + 'ERROR: failed to solve: node:20.2: no match for platform in manifest sha256:14f0471d0478fbb9177d0f9e8c146dc872273dcdcfc7fea93a27ed81fc6b0e96: not found\n' }

Which is resolved by pico pushkin/front-end/Dockerfile, and changing the line FROM node20.2 to FROM amd64/node20.2. This seemed to have resolved the command docker buildx build --platform linux/x64 -t server:latest pushkin/front-end, however the same error appears for docker buildx build --platform linux/x64 -t api:latest pushkin/api

jkhartshorne commented 1 year ago

Try the updates described here and lmk what happens: https://github.com/pushkin-consortium/pushkin/issues/230

ayang21 commented 1 year ago

@jkhartshorne -- I am still getting the same errors

jkhartshorne commented 1 year ago

@ayang21 can you take screenshots of the images and containers you have in Docker and post them here?

ayang21 commented 1 year ago

Containers: image Images: image Volumes: image

ayang21 commented 1 year ago

This is the database activity in pgAdmin:

/pga4dash/ SELECT pid, datname, usename, application_name, client_addr, pg_catalog.to_char(backend_start, 'YYYY-MM-DD HH24:MI:SS TZ') AS backend_start, state, wait_event_type || ': ' || wait_event AS wait_event, array_to_string(pg_catalog.pg_blocking_pids(pid), ', ') AS blocking_pids, query, pg_catalog.to_char(state_change, 'YYYY-MM-DD HH24:MI:SS TZ') AS state_change, pg_catalog.to_char(query_start, 'YYYY-MM-DD HH24:MI:SS TZ') AS query_start, pg_catalog.to_char(xact_start, 'YYYY-MM-DD HH24:MI:SS TZ') AS xact_start, backend_type, CASE WHEN state = 'active' THEN ROUND((extract(epoch from now() - query_start) / 60)::numeric, 2) ELSE 0 END AS active_since FROM pg_catalog.pg_stat_activity WHERE datname = (SELECT datname FROM pg_catalog.pg_database WHERE oid = 13067)ORDER BY pid

jkhartshorne commented 1 year ago

What does

docker images

output?

If it doesn't show the existence of a Node 20.2 image, try running

docker pull node:20.2

and tell me what happens.

ayang21 commented 1 year ago

docker images outputted image

While running docker pull node:20.2 image

After running docker pull node:20.2, image

ayang21 commented 1 year ago

I ran armageddon and then prep again, and now this is the new docker images: image

jkhartshorne commented 1 year ago

Quick Q: Did you remember to run yarn build in the pushkin-cli before using the local version?

Also, check the Dockerfiles in your local pushkin project and make sure they don't specify an architecture (just 'FROM Docker:20.2).

ayang21 commented 1 year ago

Yeah, I cloned and checked the pushkin-cli branch, and then I ran yarn install and yarn build in the pushkin-cli folder.

The Dockerfile says FROM node:20.2 instead.

Could there possibly be something with conflicts with the dockerfile.yml file?

jkhartshorne commented 1 year ago

I think the question right now is why his install calls it pushkin_test instead of test_db.

@ayang21 can you check what it's called on @Halogen7A 's computer?

jkhartshorne commented 1 year ago

@ayang21 -- I published a new version of the cli. Can you try using that and see if it addresses this problem?

jkhartshorne commented 1 year ago

@ayang21 -- bumping this.

jkhartshorne commented 1 year ago

@ayang21 -- bumping again. Maybe @hunterschep can take a look as well to see if this comes up for others.

ayang21 commented 1 year ago

Yeah, the error still persists. I am using pushkin-cli version 3.4.0 but I get the same exact error message

hunterschep commented 1 year ago

@ayang21 @jkhartshorne

This may be wrong but If you're encountering the same error when building the image for the api service, could the Dockerfile for the api service also have a similar issue?

   pico pushkin/api/Dockerfile

Just as you did for the front-end service, maybe change the line from:

   FROM node:20.2

to:

   FROM amd64/node:20.2

Re-run the Docker build command for the API service**:

   docker buildx build --platform linux/x64 -t api:latest pushkin/api

This could help in resolving the immediate error? Also I am also using the same CLI and am unable to replicate the error

ayang21 commented 1 year ago

I changed all lines of FROM node:20.2 to FROM amd64/node:20.2, and there is one more Dockerfile that has this as its contents:



USER root

RUN apt-get update -qqy \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
  && rm /bin/sh && ln -s /bin/bash /bin/sh \
  && chown seluser /usr/local

ENV NVM_DIR /usr/local/nvm
RUN mkdir -p $NVM_DIR \
  && wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash \
  && source $NVM_DIR/nvm.sh \
  && nvm install v12

ENV CHROME_BIN /opt/google/chrome/chrome
ENV INSIDE_DOCKER=1

WORKDIR /usr/src
ENTRYPOINT source $NVM_DIR/nvm.sh && npm i && npm test```.

Perhaps this has something to do with nvm install v12? I'm not too sure
hunterschep commented 1 year ago

Weird, I can't say I really recognize what is happening there, did changing things to FROM amd64/node:20.2 have any positive effect?

jessestorbeck commented 8 months ago

This hasn't come up for a while. If this was a Windows-only issue, I think we can close it based on the new recommendation for Windows users to use Codespaces.