Run a local Sourcegraph instance behind ngrok
Sometimes it's useful to have the Sourcegraph instance you're running on your local machine to be reachable over the internet. If you're testing webhooks, for example, where a code host needs to be able to send requests to your instances.
One way to do that is to use ngrok, a reverse proxy that allows you to expose your instance to the internet.
- Install
ngrok
:brew install ngrok
- Authenticate the
ngrok
if this is your first time running it (the token can be obtained from Ngrok dashboard):ngrok config add-authtoken <Your token>
- Start your Sourcegraph instance:
sg start
- Start
ngrok
and point it at Sourcegraph:ngrok http --host-header=rewrite 3080
- Copy the
Forwarding
URLngrok
displays. e.g.:https://630b-87-170-68-206.eu.ngrok.io
- Edit your site-config (i.e.
../dev-private/enterprise/dev/site-config.json
) and update the"externalURL"
to point to your ngrok:"externalURL": "https://630b-87-170-68-206.eu.ngrok.io"
- Open the ngrok URL in browser to make sure you see your instance
- Done