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_lndWe'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.
What an amazing platform
Thanks Koob!
Please stop being so awesome. I have other things to do and you guys keep distracting me.
I have found some free time and am taking
sndevfor a test drive now!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:
imgproxys3opensearchos-dashboardsn_lndstacker_lndchanndlerdepending 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.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 thedepends_onwhich might be over-specified.Should I create the issue or should you?
Hehe I can create it :)
Here it is. I gave a few implementation options based on our conversation here, while trying not to be too prescriptive.
Modify your
.env.sampleand restart it. I made it copy/merge into.env.development(untracked) based on your feedback.Meaning you can put secrets in
.env.developmentand still keep it up to date if upstream changes.Dang are rewards retroactive for issues I’ve recently opened? :P
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.
Cool, sounds good!
That does seem like a lot of process, but I’m sure you’ll get it sorted and streamlined.
Thanks for writing this so even I could understand it. Haha
Congrats and really well done! Keep it up
It looks like SN is finally taking off, which will bring more help and cooperation. Well done!
Another nice easter egg LOL
Holy shit that readme is a beast lol
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.
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)
Ah yeah I'm a total boomer and prefer to read docs in the browser.
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.
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.
Gave DDEV some inspiration or new insights? This is really cool imo 😎🚀 I would to spin up a env now 😜
Very nice! That’s the real OSS spirit sir🫡 Can't wait to try this out?!
Why the question mark?!
typo 😅
Wow this looks bullish af
Cool shell script!
This is so badass. Nice job boys.
Hi
Hi