nostream
nostream copied to clipboard
Add reverse proxy for local dev
Includes locally-trusted TLS certs via mkcert and uses a hostname that already points to 127.0.0.1 without having to modify the hosts file.
Description
This change makes it easy to spin up a local environment for development, both for enhancements to the relay and for use while developing a nostr client. It uses Caddy as the reverse-proxy, mkcert to generate certs for the hostname that are trusted on the developer's machine, and a localtest.me subdomain for the hostname to avoid requiring a change to the machine's host file.
Related Issue
#117
Motivation and Context
Quickly overcomes the barrier to getting the relay working in a local environment. Anything that makes the relay easier to use will help boost adoption and contributions to the project.
How Has This Been Tested?
I was able to reliably spin up the relay from zero state, connect to wss://nostream.localtest.me with WebSocket King, and receive test events from astral.ninja configured to only use wss://nostream.localtest.me.
@Cameri I haven't updated docs or run tests yet because I'm considering this PR a draft. I wanted to check with you on expectations. Is the existing Docker Compose configuration meant for local or prod use? I made changes to it assuming that it was meant for local, but I can easily split these changes off to a dedicated local version if you'd like.
Types of changes
- [ ] Non-functional change (docs, style, minor refactor)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [ ] I have added tests to cover my code changes.
- [ ] All new and existing tests passed.
Thanks!
I think we should split the docker compose for local and prod. Current one was meant for prod.
Will review the code later today.
Alright, made some adjustments so that local is a new, distinct environment that doesn't affect any existing code. All that should be required for local dev in Docker is to run ./scripts/start_local.
I'm not 100% in love with where this code all lives, mostly because there wasn't yet a distinct pattern to follow. I submitted #120 to address it.
Alright, made some adjustments so that local is a new, distinct environment that doesn't affect any existing code. All that should be required for local dev in Docker is to run
./scripts/start_local.I'm not 100% in love with where this code all lives, mostly because there wasn't yet a distinct pattern to follow. I submitted #120 to address it.
It's fine. It just needs to work first, then we can iterate and get it to where it needs to be.
Could you please update the README.md to include the mkcert requirement for local development only?
Yup, I'll push a docs update here in a bit.
@Cameri Those readme changes look good to you?
@Cameri Those readme changes look good to you?
Yup, tried them and worked well on my local machine
:tada: This PR is included in version 1.16.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:







