Skip to content

Commit f2eed89

Browse files
author
Jose Hernandez
committed
exposing backend ports
1 parent 44aadb5 commit f2eed89

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

Diff for: Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ COPY . /app
1313
RUN cd backend && ./setup-sigma-versions.sh
1414

1515
# launch front- and backend
16+
# Expose frontend port
1617
EXPOSE 8000
18+
# Expose backend ports (for Sigma versions)
19+
EXPOSE 8100-8199
1720
ENTRYPOINT ["./entrypoint.sh"]

Diff for: README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ poetry run ./run.py
2222
### With Docker:
2323

2424
```bash
25+
# Build the image
2526
docker build -t sigconverter.io .
26-
docker run -d -p 8000:8000 sigconverter.io
27+
28+
# Run the container
29+
# Note: We need to expose both the frontend port (8000) and backend ports (8100-8199)
30+
docker run -d \
31+
-p 8000:8000 \
32+
-p 8100-8199:8100-8199 \
33+
sigconverter.io
2734
```
2835

2936
Visit the live instance at [https://sigconverter.io](https://sigconverter.io) or locally at [http://localhost:8000](http://localhost:8000).

Diff for: backend/launch-backends.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
#!/bin/bash
22

3-
# Specify the directory to search in (or use the current directory)
3+
# Specify the directory to search in
44
directory="./"
55

66
# Iterate over all subdirectories
77
for dir in "$directory"/*/; do
88
if [ -d "$dir" ]; then
99
version=$(basename $dir)
1010
echo "Launching sigconverter backend for sigma version: $version"
11+
# Add timeout to ensure previous instance has time to start
12+
sleep 2
1113
./$version/.venv/bin/python ./backend.py &
14+
15+
# Check if launch was successful
16+
if [ $? -ne 0 ]; then
17+
echo "Failed to launch backend for version $version"
18+
fi
1219
fi
1320
done
21+
22+
# Wait for all backends to be ready
23+
sleep 5

Diff for: frontend/frontend.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ def version_key(version):
1818
def get_port_from_version(version):
1919
pattern = r"^\d+\.\d+\.\d+$"
2020
if re.match(pattern, version):
21-
return int(f'8{version.replace(".", "")}')
22-
else:
23-
return None
21+
try:
22+
return int(f'8{version.replace(".", "")}')
23+
except ValueError:
24+
return None
25+
return None
2426

2527

2628
@app.route("/")

0 commit comments

Comments
 (0)