Skip to content

Commit db76426

Browse files
Merge pull request #12 from IlliaStrelsov/main
Add configurable --port for Web UI and update docs
2 parents fc56f7d + ba66b80 commit db76426

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,15 @@ If you see lines like the above, it means Docker is not running, or you do not h
112112

113113
## Bind for 0.0.0.0:3000 failed: port is already allocated
114114

115-
This occurs when there is already a Docker container running that uses port 3000. If you're running RL Swarm on the same machine, you will have to stop RL Swarm to use CodeAssist.
115+
This occurs when there is already a Docker container running that uses port 3000.
116+
You have two options:
117+
1. Stop the other service that is using the port (e.g., if you are running RL Swarm).
118+
2. Run CodeAssist on a different port using the `--port` argument:
119+
120+
```bash
121+
uv run run.py --port 3001
122+
```
123+
> **Note:** When choosing a new port, please avoid `8000`, `8080`, `8001`, `8008`, `3003`, and `11434`, as they are reserved for other CodeAssist services.
116124
117125
# Contributing
118126

run.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class Config:
8080
training_config_path: str
8181
no_sc: bool
8282
train_only: bool
83+
port: int
8384

8485

8586
def detect_docker():
@@ -315,7 +316,7 @@ def setup_web_ui(config: Config) -> docker.models.containers.Container:
315316
auto_remove=False,
316317
name="codeassist-web-ui",
317318
ports={
318-
"3000/tcp": 3000, # Expose Web UI port
319+
"3000/tcp": config.port, # Expose Web UI port
319320
},
320321
volumes={
321322
f"{os.getcwd()}/persistent-data": {
@@ -1068,10 +1069,11 @@ def main(config: Config):
10681069
CONSOLE.print(Markdown("# CodeAssist Started"), style=HEADER_COLOR)
10691070

10701071
if not config.train_only:
1071-
browser.open("http://localhost:3000")
1072+
url = f"http://localhost:{config.port}"
1073+
browser.open(url)
10721074

10731075
CONSOLE.print(
1074-
"A browser should have opened to http://localhost:3000. You can now start coding!",
1076+
f"A browser should have opened to {url}. You can now start coding!",
10751077
style=INFO_COLOR,
10761078
)
10771079

@@ -1203,6 +1205,10 @@ def main(config: Config):
12031205
"--no-sc", action="store_true", help="Disable smart contract calls"
12041206
)
12051207

1208+
parser.add_argument(
1209+
"-p", "--port", type=int, help="Port to expose the Web UI on", default=3000,
1210+
)
1211+
12061212
args = parser.parse_args()
12071213

12081214
config = Config(**args.__dict__)

0 commit comments

Comments
 (0)