on two different ubuntu docker hosts. but most of the time i am the problem. it try getting db connection right.
i ran: git clone https://github.com/stackernews/stacker.news.git sn && cd sn maybe that is the issue.
Okay, I'm trying to compose them fresh again and see if maybe something got mangled. But your error suggests, the web app isn't picking up the .env.sample file.
reply
cool. i am more a tester. reading up code is fun but takes me a long time. let me know i can debug here. i was in the sn app shell and nano checked the .env.sample it was fine.
5ccxxxxxxx42 sn_app "docker-entrypoint.s…" 18 minutes ago Up 18 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp app 402xxxxxxxxb9a postgres "docker-entrypoint.s…" 18 minutes ago Up 18 minutes 0.0.0.0:5431->5432/tcp, :::5431->5432/tcp
reply
Doing it clean again on Mac worked for me.
Can you change the references of .env.sample in docker-compose.yml to ./.env.sample and tell me if that works? I suspect there's some implementation difference in docker across OS's but it might also be silently failing while parsing the file like @spraveenitpro is experiencing.
reply
sorry i only edited one line and missed the db one. still testing
reply
i still get the same: ######################## yml ############## nano docker-compose.yml GNU nano 4.8 docker-compose.yml version: "3" services: db: container_name: db image: postgres restart: always expose: - "5432" ports: - "5431:5432" env_file: - ./.env.sample app: container_name: app build: ./ depends_on: - db env_file: - ./.env.sample ports: - "3000:3000" volumes: - ./:/app links: - db
############ end yml ############# ############## compose shell ################ app | npm WARN @babel/plugin-syntax-jsx@7.14.5 requires a peer of @babel/core@^7.0.0-0 but none is installed. You must ins tall peer dependencies yourself. app | npm WARN babel-plugin-inline-react-svg@2.0.1 requires a peer of @babel/core@^7.0.0 but none is installed. You must i nstall peer dependencies yourself. app | npm WARN bootstrap@4.6.0 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependenci es yourself. app | npm WARN bootstrap@4.6.0 requires a peer of popper.js@^1.16.1 but none is installed. You must install peer dependenc ies yourself. app | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-darwin-x64@11.1.2 (node_modules/@next/swc-darwin-x64): app | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-darwin-x64@11.1.2: wanted {"os":"da rwin","arch":"x64"} (current: {"os":"linux","arch":"x64"}) app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: x64 app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64 app | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents): app | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch": "any"} (current: {"os":"linux","arch":"x64"}) app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64 app | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-darwin-arm64@11.1.2 (node_modules/@next/swc-darwin-arm64): app | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-darwin-arm64@11.1.2: wanted {"os":" darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"}) app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: arm64 app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64 app | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-x64-msvc@11.1.2 (node_modules/@next/swc-win32-x64-ms vc): app | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-x64-msvc@11.1.2: wanted {"os" :"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"}) app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: win32 app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: x64 app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux app | npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64 app | app | audited 1100 packages in 16.272s app | app | 173 packages are looking for funding app | run npm fund for details app | app | found 11 vulnerabilities (1 low, 4 moderate, 5 high, 1 critical) app | run npm audit fix to fix them, or npm audit for details app | npm verb exit [ 0, true ] app | npm timing npm Completed in 17968ms app | npm info ok app | Prisma schema loaded from prisma/schema.prisma app | Error: Get config: Schema Parsing P1012 app | app | error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://. app | --> schema.prisma:6 app | | app | 5 | provider = "postgresql" app | 6 | url = env("DATABASE_URL") app | | app | app | Validation Error Count: 1 app | app | app | > stackernews@0.1.0 dev /app app | > NODE_OPTIONS='--trace-warnings' next dev app | app | ready - started server on 0.0.0.0:3000, url: http://localhost:3000 app | info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 app | event - compiled successfully app | event - build page: / app | wait - compiling... app | event - compiled successfully app | event - build page: /api/auth/[...nextauth] app | wait - compiling... app | event - build page: /api/auth/[...nextauth] app | prisma:error app | error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://. app | --> schema.prisma:6 app | | app | 5 | provider = "postgresql" app | 6 | url = env("DATABASE_URL") app | | app | app | Validation Error Count: 1 app | event - build page: /next/dist/pages/_error app | event - build page: /next/dist/pages/_error app | event - compiled successfully app | wait - compiling... app | error - ApolloError: app | Invalid prisma.queryRaw() invocation: app | app | app | error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://. app | --> schema.prisma:6 app | | app | 5 | provider = "postgresql" app | 6 | url = env("DATABASE_URL") app | | app | app | Validation Error Count: 1 app | at new ApolloError (/app/node_modules/@apollo/client/errors/errors.cjs.js:34:28) app | at /app/node_modules/@apollo/client/core/core.cjs.js:1575:47 app | at both (/app/node_modules/@apollo/client/utilities/utilities.cjs.js:981:53) app | at /app/node_modules/@apollo/client/utilities/utilities.cjs.js:974:72 app | at new Promise (<anonymous>) app | at Object.then (/app/node_modules/@apollo/client/utilities/utilities.cjs.js:974:24) app | at Object.next (/app/node_modules/@apollo/client/utilities/utilities.cjs.js:982:49) app | at notifySubscription (/app/node_modules/zen-observable/lib/Observable.js:135:18) app | at onNotify (/app/node_modules/zen-observable/lib/Observable.js:179:3) app | at SubscriptionObserver.next (/app/node_modules/zen-observable/lib/Observable.js:235:7) { app | graphQLErrors: [ app | Error: app | Invalid prisma.queryRaw() invocation: app |
reply
I think i need some more packages in package.json i tried adding babel-core but i think i need more?
reply
No, those are just warnings. For some reason docker-compose isn't picking up the .env.sample file. You are running docker-compose aren't you?
reply
i run: docker-compose up --build i have: ~/sn$ docker version Client: Docker Engine - Community Version: 20.10.9 API version: 1.41 Go version: go1.16.8 Git commit: c2ea9bc Built: Mon Oct 4 16:08:29 2021 OS/Arch: linux/amd64 Context: default Experimental: true
Server: Docker Engine - Community Engine: Version: 20.10.9 API version: 1.41 (minimum version 1.12) Go version: go1.16.8 Git commit: 79ea9d3 Built: Mon Oct 4 16:06:37 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.11 GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8 runc: Version: 1.0.2 GitCommit: v1.0.2-0-g52b36a2 docker-init: Version: 0.19.0 GitCommit: de40ad0
~/sn$ docker-compose version docker-compose version 1.25.0, build unknown docker-py version: 4.1.0 CPython version: 3.8.10 OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
i am using a different command before compose: git clone https://github.com/stackernews/stacker.news.git sn && cd sn because your command gives me:
:~$ git clone git@github.com:stackernews/stacker.news.git sn && cd sn Cloning into 'sn'... The authenticity of host 'github.com (140.82.121.4)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'github.com,140.82.121.4' (RSA) to the list of known hosts. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
i run several dockers on this machine for tests. with most containers there is a litte hickup here and there but i really like docker for testing now.
reply
It’s not obvious to me what’s going wrong.