Skip to content

Commit 8249846

Browse files
committed
Fixed compose environments
1 parent a649e80 commit 8249846

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

client/src/StaticTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Select from "react-select";
33
import UploadCsv from "./UploadCsv";
44

55
const API_BASE = (process.env.REACT_APP_API_URL || "").replace(/\/$/, "");
6-
const EV_URL = process.env.REACT_APP_EV_URL || "http://localhost:8000/ev/";
6+
const EV_URL = `http://${process.env.HOST}:8000/ev/`;
77

88
export default function StaticTab() {
99
const [csvList, setCsvList] = useState([]);

client/src/UploadBag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function UploadBag({ onUploadComplete, loading }) {
2121
console.log("Uploading file:", file);
2222
}
2323

24-
const response = await fetch("http://localhost:5000/upload-folder", {
24+
const response = await fetch(`http://${process.env.HOST}:5000/upload-folder`, {
2525
method: "POST",
2626
body: formData,
2727
});

client/src/UploadCsv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function UploadCSV({ onUploadComplete, loading }) {
1919

2020
console.log("Uploading CSV file:", file.name);
2121

22-
const response = await fetch("http://localhost:5000/upload-csv", {
22+
const response = await fetch(`http://${process.env.HOST}:5000/upload-csv`, {
2323
method: "POST",
2424
body: formData,
2525
});

docker-compose.prod.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
image: ghcr.io/cornellev/viz-client:latest
2323
networks: [internal]
2424
environment:
25-
REACT_APP_EV_URL: ${REACT_APP_EV_URL}
25+
HOST: ${HOST}
2626

2727
server:
2828
image: ghcr.io/cornellev/viz-server:latest
@@ -41,8 +41,7 @@ services:
4141

4242
pyworker:
4343
build: ./pyworker
44-
ports:
45-
- "8000:8000"
44+
networks: [internal]
4645
image: ghcr.io/cornellev/viz-worker:latest
4746
environment:
4847
DB_HOST: db

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- CHOKIDAR_USEPOLLING=true
1212
- WATCHPACK_POLLING=true
1313
- WDS_SOCKET_PORT=3000
14+
- HOST=${HOST}
1415
volumes:
1516
- ./client:/app
1617
- /app/node_modules

nginx/default.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ map $http_upgrade $connection_upgrade {
33
'' close;
44
}
55

6+
upstream pyworker {
7+
server pyworker:8000;
8+
}
9+
610
server {
711
listen 80;
812
server_name visualization_toolbox; # set to your domain in prod
@@ -67,10 +71,16 @@ server {
6771
proxy_set_header Upgrade $http_upgrade;
6872
proxy_set_header Connection $connection_upgrade;
6973
proxy_set_header Host $host;
74+
proxy_set_header X-Real-IP $remote_addr;
75+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
76+
proxy_set_header X-Forwarded-Proto $scheme;
7077
}
7178
location = /ev {
7279
proxy_pass http://pyworker:8000/ev;
7380
proxy_http_version 1.1;
7481
proxy_set_header Host $host;
82+
proxy_set_header X-Real-IP $remote_addr;
83+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
84+
proxy_set_header X-Forwarded-Proto $scheme;
7585
}
7686
}

0 commit comments

Comments
 (0)