jetstream
jetstream copied to clipboard
How to set up for production using custom domain secured
I simply tried to host this app on my own server making it publicly accessible on port 80, then switching to HTTPS using LetsEncrypt. But i cant make it accessible on the web.
The readme does not explain how to expose it to the public and i cant see where to make it run on port 80 or 443. Is there some documentation explaining this?
If you want to run locally using HTTPS, you have a few options:
- Setup a reverse proxy which sits between the server and the open internet (E.x. ngnix)
- you may consider using a docker setup for this approach - could make it easier and there are likely a lot of tutorials you can find
- (Note: this is how Jetstream runs in production, but this is handled by the hosting provider render.com)
- Make some code changes to the server to have it run in HTTPS mode
- Docs: https://expressjs.com/en/api.html#app.listen
apps/api/src/main.ts- changehttpimport toimport { createServer } from 'https';- Line 26 - remove
IncomingMessageimport (can remove or change toreq: any) - You may need to import your keys: https://stackoverflow.com/questions/5998694/how-to-create-an-https-server-in-node-js (Note the example is using javascript, so need some minor adjustment to typescript)
Let me know how it goes - I haven't attempted to run the server in https directly, so not sure what other gotchas there might be.
Hi @paustint I am part of eesenibs team. Thanks for clarifying! To understand a bit better, could you elaborate options for the code?
Specifically, around line 26 apps/api/src/main.ts
import { blockBotHandler, healthCheck, uncaughtErrorHandler } from './app/utils/response.handlers';
- is this the line? and should https replace the http settings entirely?
Hi @paustint its working. I've configured a reverse proxy using nginx and implemented a docker installation with a minor adjustment to the docker-compose.yml. However, I encountered an issue where the page doesn't load correctly.
@azapradana -
- Make sure that you have properly run all the build commands (should just be
yarn build) - Open the network console in your browser and that should hopefully give some indication of the error - look at the requests for the CSS files (as I think that is what seems to have not loaded)
- On the network tab click "disable cache" and refresh and see if that resolves the issue
@paustint after I set up the ssl (https). it works perfectly thanks
@paustint, sorry to bother you with another question. I'm encountering an issue with the login button, displaying {"error":"There was an error processing the request","message":"Test user not enabled"}. In my .env file, I've set EXAMPLE_USER_OVERRIDE=false and configured my managed app in Salesforce.
If I want to allow users to sign up and use their own accounts with Jetstream, what additional steps should I take besides creating and connecting the managed app in Salesforce?
Additionally, when I try to sign up, it redirects me to localhost:3333."
You will need to change the URLs in your docker compose file as well as your environment files, the precedence in which docker evaluates them is mentioned here: https://docs.docker.com/compose/environment-variables/envvars-precedence/
@paustint okay, I replace all the localhost into my domain, but now if I turn on the
EXAMPLE_USER_OVERRIDE to true, it redirect me to error {"error":"There was an error processing the request","message":"Test user not enabled"}
if I turn the EXAMPLE_USER_OVERRIDE to false, I redirected to dev-ce6oji5b.us.auth0.com
do we need to have auth0 to run it for our server or can we bypass this?