pull down to refresh

It was relatively complicated to get a local dev environment up and running so I was asked to dockerize it. I've updated the README on the repo but the important bits:

  1. Install docker-compose and deps if you don't already have it installed
  2. git clone git@github.com:stackernews/stacker.news.git sn && cd sn
  3. docker-compose up --build

You should then be able to access the site at localhost:3000 and any changes you make will hot reload. If you want to login locally or use lnd you'll need to modify .env.sample appropriately. If you have trouble please open an issue so I can help and update the README for everyone else.

I'd really like to help with the dev, but I've never codded JS before, mostly because I've never had the need. I've some C experience (not much) and I'm beyond the basics with Python (I'd class myself as reasonably competent). I've also built a website and CMS using PHP, HTML and CSS.

If you think that I'd be able to make a contribution, I'd like to try. Aside from W3Schools (which is one of my 'go-to's), are there any sites that you'd recommend, for learning JS?
If you'd prefer to use only experienced coders, just say as much, I'll not be offended: I much prefer honesty, over B.S.

reply

It’s hard to tell what your potential is without knowing more about you. But if there’s something you want to do, why not try and see how far you can get? Experience doesn’t matter here - just the quality of the result.

reply

Cool, thank you.
I'll set up a dev machine and get to it.

reply

best plan ever setting up a dev machine!

reply

For sure! Experience has taught me that, least ways.

reply

i ran this docker on my live docker vm machine and was like uuups docker space low. so i rememberd my docker ubuntu dev machine a old imac hardware from 2014. 40W but alwas ready to serve.

reply

I've much to learn, as I've only ever run a local webserver for website dev.
Yes, older HW can still be of value (although I've a bunch of 32 bit machines that I feel I need to dump; I just hate doing so).
I'll reconfigure my Lenovo E73 (SFF) which I got off of ebay, some time back. It's very nice: Quad Core i5 4th Gen, 16 GB Ram, 500 MB HDD.
By today's standards, it's not going to make a splash, but it's more than good enough for my projects.

Any info or tips you have, would be cool.

reply

top hardware. long time i went with raspberrys. it was fun to learn gpio and do some python. then stuff always took ages. low capacity bigger projects. i would run 4 vm on your hardware for developing purpose no problem. 32 bit can be used for kids with emmabuntus.org - i have kept all my hardware - somtimes i need spare parts. even old ide cable make a perfect match with arduino projects. yes that needs a lot of space.

i get:
Error:
Invalid prisma.queryRaw() invocation:

error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://.
--> schema.prisma:6
|
5 | provider = "postgresql"
6 | url = env("DATABASE_URL")
|

Validation Error Count: 1

maybe i need to fix the db path somewhere?

reply

You used docker and got this error?

reply

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.

reply

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?

This is great! I am getting the below error, any idea what could be happening:

https://d.pr/i/UnoWTg+
Direct Link

reply

can you try:
git clone https://github.com/stackernews/stacker.news.git sn && cd sn

reply

Whether it’s http or ssh won’t matter. It’s something with the environment not getting picked up.

reply

Can you try enclosing all the bracketed variables in quotes. e.g.

GITHUB_SECRET="<YOUR GITHUB SECRET>"

and see if that works?

reply

Thanks! What OS are you running?

reply