Skip to content

Commit d4a8c55

Browse files
committed
Fixed some Ngrok tunnel issues
1 parent 3c2f1da commit d4a8c55

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

locallab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
LocalLab - A lightweight AI inference server for running LLMs locally
33
"""
44

5-
__version__ = "0.4.39"
5+
__version__ = "0.4.40"
66

77
# Only import what's necessary initially, lazy-load the rest
88
from .logger import get_logger

locallab/core/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ async def startup_event():
9898
if use_ngrok:
9999
from ..utils.networking import setup_ngrok
100100
port = int(os.environ.get("LOCALLAB_PORT", SERVER_PORT)) # Use SERVER_PORT as fallback
101-
ngrok_url = await setup_ngrok(port)
101+
102+
# Handle ngrok setup synchronously since it's not async
103+
ngrok_url = setup_ngrok(port)
102104
if ngrok_url:
103105
logger.info(f"{Fore.GREEN}Ngrok tunnel established successfully{Style.RESET_ALL}")
106+
else:
107+
logger.warning("Failed to establish ngrok tunnel. Server will run locally only.")
104108

105109
# Initialize cache if available
106110
if FASTAPI_CACHE_AVAILABLE:

locallab/utils/networking.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,11 @@ def setup_ngrok(port: int) -> Optional[str]:
3737
ngrok.set_auth_token(auth_token)
3838
conf.get_default().auth_token = auth_token
3939

40-
# Start tunnel with improved configuration
40+
# Start tunnel with simplified configuration
4141
tunnel = ngrok.connect(
42-
port,
43-
"http",
44-
options={
45-
"bind_tls": True, # Enable HTTPS
46-
"inspect": False, # Disable inspection for better performance
47-
}
42+
addr=port,
43+
proto="http",
44+
bind_tls=True # Enable HTTPS
4845
)
4946

5047
public_url = tunnel.public_url

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="locallab",
8-
version="0.4.39",
8+
version="0.4.40",
99
packages=find_packages(include=["locallab", "locallab.*"]),
1010
install_requires=[
1111
"fastapi>=0.95.0,<1.0.0",

0 commit comments

Comments
 (0)