Adding localtunnel support
This commit is contained in:
parent
21dc07026a
commit
a0cc46cfc0
|
@ -18,8 +18,8 @@ PIPER_VOICE_NAME="en_US-lessac-medium.onnx"
|
|||
|
||||
# If SERVER_START, this is where we'll serve the server.
|
||||
# If CLIENT_START, this is where the client expects the server to be.
|
||||
# SERVER_CONNECTION_URL=wss://localhost:8000/
|
||||
SERVER_CONNECTION_URL=wss://localhost:8000/
|
||||
# SERVER_CONNECTION_URL=ws://localhost:8000/
|
||||
SERVER_CONNECTION_URL=ws://localhost:8000/
|
||||
SERVER_START=True
|
||||
CLIENT_START=True
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ if __name__ == "__main__":
|
|||
asyncio.create_task(put_kernel_messages_into_queue(from_computer))
|
||||
|
||||
# Start the server
|
||||
logger.info("Starting `server.py`... on wss://localhost:" + str(SERVER_LOCAL_PORT))
|
||||
logger.info("Starting `server.py`... on localhost:" + str(SERVER_LOCAL_PORT))
|
||||
|
||||
config = Config(app, host="localhost", port=SERVER_LOCAL_PORT, lifespan='on')
|
||||
server = Server(config)
|
||||
|
|
|
@ -11,6 +11,11 @@ pip install 01OS
|
|||
|
||||
**Expose an 01 server publically:**
|
||||
|
||||
We are currently using localtunnel to handle the creation of public tunnel endpoints.
|
||||
|
||||
Note: You will need to install Node and the localtunnel tool before this will work correctly:
|
||||
```npm install -g localtunnel```
|
||||
|
||||
```bash
|
||||
01 --server --expose # This will print a URL that a client can point to.
|
||||
```
|
||||
|
|
|
@ -56,7 +56,12 @@ fi
|
|||
|
||||
# Check if "--expose" is passed as an argument
|
||||
if [[ "$@" == *"--expose"* ]]; then
|
||||
export TUNNEL_START="True"
|
||||
if [[ "$SERVER_START" != "True" ]]; then
|
||||
echo "Error: Start script must be started with --serve for tunneling to work."
|
||||
exit 1
|
||||
else
|
||||
export TUNNEL_START="True"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if "--clear-local" is passed as an argument
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "Starting up localhost.run tunnel..."
|
||||
ssh -o StrictHostKeyChecking=no -R 80:localhost:8000 nokey@localhost.run 2>&1 | while IFS= read -r line; do
|
||||
if [[ "$line" =~ https://([a-zA-Z0-9]+\.lhr\.life) ]]; then
|
||||
echo "Your free localhost.run tunnel is now active. Please set your client SERVER_CONNECTION_URL env var to: \"wss://${BASH_REMATCH[1]}\""
|
||||
# Get the SERVER_PORT environment variable, but default to 8000
|
||||
SERVER_LOCAL_PORT=${SERVER_LOCAL_PORT:-8000}
|
||||
|
||||
echo "Starting up localtunnel service for port $SERVER_LOCAL_PORT on localhost..."
|
||||
|
||||
npx localtunnel --port $SERVER_LOCAL_PORT | while IFS= read -r line; do
|
||||
if [[ "$line" == "your url is: https://"* ]]; then
|
||||
echo "Tunnel is up!"
|
||||
echo "Please set your client env variable for SERVER_CONNECTION_URL=wss://${line:21}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue