pull down to refresh

sndevsndev

After our recent hiring trial (which I plan to write something about soon), a few years of having folks struggle getting setup contributing to SN's open source project, and asking what stackers' preferred local dev setups are, we developed sndev which allows you to run a fully featured SN developer environment locally in a single command.

Special thanks to @elvismercury for his expert, careful, repeated nudges of "I'm really curious how easy getting started on something like SN can be." Of course, never ending thanks to all of SN's open source contributors too.

The single command:

./sndev start

The sndev environment provides all the services we run in production but locally for development, spinning up an auto-mining auto-channel-forming lightning regtest network (you don't need polar anymore), database, search engine, image proxy, and mock s3, and populates the database and search engine with a big production-shaped 45-day seed.

sndev allows SN open source contributors to do things like login to local accounts with a single command:

./sndev login <some nym>

Fund their account paying a bolt11 regtest invoice:

./sndev fund <bolt11>

And much more as seen by issuing ./sndev help

                            888
                            888
                            888
      .d8888b  88888b.  .d88888  .d88b.  888  888
     88K      888 '88b d88' 888 d8P  Y8b 888  888
     'Y8888b. 888  888 888  888 88888888 Y88  88P
          X88 888  888 Y88b 888 Y8b.      Y8bd8P
      88888P' 888  888  'Y88888  'Y8888    Y88P

manages a docker based stacker news development environment

USAGE
  $ sndev [COMMAND]
  $ sndev help [COMMAND]

COMMANDS
  help            show help

  env:
    start         start env
    stop          stop env
    restart       restart env
    status        status of env
    delete        delete env

  sn:
    login         login as a nym

  lnd:
    fund          pay a bolt11 for funding
    withdraw      create a bolt11 for withdrawal

  db:
    psql          open psql on db
    prisma        run prisma commands

  dev:
    pr            fetch and checkout a pr
    lint          run linters

  other:
    compose       docker compose passthrough
    sn_lncli      lncli passthrough on sn_lnd
    stacker_lncli lncli passthrough on stacker_lnd

We'll be regularly refining and adding things to sndev. It's good enough I'll be using it exclusively for development myself now and @ek said he probably will too.

contribution awardscontribution awards

Contribution awards are live. I published the draft of these earlier this week, which haven't been changed, and they are now found in SN's Github README. The reward structure is definitely experimental still, and will require a lot of adjustment, but it's ready to begin running I think.

We also rewrote our README so that it mostly appears as a single page and elaborates on things more.


We're hoping these help stackers continue to make SN more of what they want it to be, begin FOSSing, and stack sats.

This had a few bugs in it when it was announced that I didn’t initially see because of reasons. So if you tried it and had trouble running it, pull and give it another shot.

reply

What an amazing platform

Thanks Koob!

reply

Please stop being so awesome. I have other things to do and you guys keep distracting me.

reply

I have found some free time and am taking sndev for a test drive now!

reply

The first piece of feedback I have is that it would be nice to be able to opt-out of certain docker services when you run ./sndev start. I have a pretty dated dev machine and it has just absolutely ground to a near-halt when trying to run all these services.

I imagine one could get away without:

  • imgproxy
  • s3
  • opensearch
  • os-dashboard
  • sn_lnd
  • stacker_lnd
  • channdler

depending on what kind of changes they're making. It would be nice to be able to do this without hacking the docker-compose.yml. Probably not a high priority though, I imagine most developers are working on a more powerful machine.

reply

Agreed it's very needy as is. I thought about this but didn't get to it.

You can start specific services by name sndev start app (which isn't documented very well) but it will also start all the depends_on which might be over-specified.

Should I create the issue or should you?

reply

Hehe I can create it :)

reply

Here it is. I gave a few implementation options based on our conversation here, while trying not to be too prescriptive.

reply

Modify your .env.sample and restart it. I made it copy/merge into .env.development (untracked) based on your feedback.

Meaning you can put secrets in .env.development and still keep it up to date if upstream changes.

Dang are rewards retroactive for issues I’ve recently opened? :P

reply

So long as they haven't been merged yet, it will apply :)

The hardest part of this that I'd like to figure out is all the bookkeeping. For a single PR being merged I could need to make 5 payments. It's going to be lame for a stretch until I get a system and some kind of automation.

reply

Cool, sounds good!

That does seem like a lot of process, but I’m sure you’ll get it sorted and streamlined.

reply

Thanks for writing this so even I could understand it. Haha

reply

Congrats and really well done! Keep it up

reply

It looks like SN is finally taking off, which will bring more help and cooperation. Well done!

reply
The site is written in javascript (not typescript 😱)

Another nice easter egg LOL

reply

Holy shit that readme is a beast lol

reply

I recommend using the ToC. I personally prefer single page READMEs, because I can cmd-f to things, but we could probably rework the order.

reply

I agree with your perspective, being able to cmd+f within one file is nice. Though, if I have it cloned (which I do), I can easily search the whole project pretty quickly, too (cmd+shift+f in VSCode)

reply

Ah yeah I'm a total boomer and prefer to read docs in the browser.

reply

cmd+shift+v in VSCode gives a nice preview of the current markdown file. I recommend trying it out if you haven't already :)

ETA: This is actually how I draft all my SN posts - markdown in VSCode, then preview in VSCode too.

reply

I use it a lot for the newsletter but it's not as pretty.

This is further complicated by me preferring to code in light/grey mode but preferring to read in dark mode lol.

reply

Gave DDEV some inspiration or new insights? This is really cool imo 😎🚀 I would to spin up a env now 😜

reply

Very nice! That’s the real OSS spirit sir🫡 Can't wait to try this out?!

reply

Why the question mark?!

reply

typo 😅

reply

Wow this looks bullish af

reply

Cool shell script!

reply

This is so badass. Nice job boys.

reply