You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DOCKER.md
+53-8Lines changed: 53 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
1
# Docker Build and Run Guide
2
2
3
-
This guide explains how to build and run the In the Loop frontend using Docker.
3
+
This guide explains how to build and run In the Loop services using Docker.
4
4
5
5
## Overview
6
6
7
-
The Docker image builds the production frontend and serves it using Vite's preview server.
7
+
In the Loop consists of three Docker services:
8
+
9
+
-**web**: Production frontend served via nginx
10
+
-**sync**: Backend API and WebSocket sync service (Cloudflare Worker)
11
+
-**iframe-outputs**: Sandboxed output rendering service
8
12
9
13
## Prerequisites
10
14
@@ -51,9 +55,7 @@ The services communicate via the `intheloop-network` Docker network:
51
55
52
56
## Testing Images Individually
53
57
54
-
The main issue is the `web` Docker image needing access to `localhost:8787`. Docker won't be able to access ports on the host machine. If you want to run it, the easiest way is to also run the `sync` image in Docker.
55
-
56
-
Otherwise, you can test these images individually to make sure they're working.
58
+
You can build and run individual services for testing. The `web` service requires the `sync` service to be accessible.
The web service automatically connects to the `sync` service via Docker network DNS:
69
73
70
74
```shell
71
-
docker run -p 5173:5173 intheloop-web:latest
75
+
docker compose up web
72
76
```
73
77
74
-
The web service will be available at `http://localhost:5173`. Note that it expects the sync service to be available at `http://sync:8787` (when running in docker-compose) or you'll need to configure the `VITE_API_TARGET` environment variable.
78
+
**Running standalone:**
79
+
80
+
When running standalone, you need to specify where the sync service is located using the `SYNC_HOST` environment variable:
81
+
82
+
```shell
83
+
# If sync is running on host machine (Mac/Windows)
84
+
docker run -p 5173:5173 -e SYNC_HOST=host.docker.internal intheloop-web:latest
85
+
86
+
# If sync is running on host machine (Linux)
87
+
docker run -p 5173:5173 -e SYNC_HOST=172.17.0.1 intheloop-web:latest
88
+
89
+
# If sync is running in another Docker container with a known IP
90
+
docker run -p 5173:5173 -e SYNC_HOST=<container-ip> intheloop-web:latest
91
+
```
92
+
93
+
The web service will be available at `http://localhost:5173`. By default, `SYNC_HOST` is set to `sync` (for docker-compose usage).
75
94
76
95
#### Iframe Outputs Service
77
96
@@ -104,3 +123,29 @@ docker run -p 8787:8787 intheloop-sync:latest
104
123
```
105
124
106
125
The sync service will be available at `http://localhost:8787`.
126
+
127
+
## Environment Variables
128
+
129
+
### Web Service
130
+
131
+
-`SYNC_HOST` (default: `sync`): Hostname or IP address of the sync service. Used by nginx to proxy API requests. Set to `sync` for docker-compose, or override for standalone runs.
132
+
133
+
### Sync Service
134
+
135
+
The sync service uses environment variables from `.dev.vars` file. See `.dev.vars.example` for configuration options.
136
+
137
+
## Troubleshooting
138
+
139
+
### "host not found in upstream 'sync'"
140
+
141
+
This error occurs when running the web container standalone without setting `SYNC_HOST`. Either:
142
+
143
+
1. Use docker-compose to run all services together, or
144
+
2. Set `SYNC_HOST` environment variable when running the web container standalone
145
+
146
+
### Web service can't connect to sync service
147
+
148
+
- Verify the sync service is running and accessible
149
+
- Check that `SYNC_HOST` is set correctly for your environment
150
+
- On Linux, you may need to use the Docker bridge IP (`172.17.0.1`) instead of `host.docker.internal`
151
+
- Ensure both containers are on the same Docker network if running separately
0 commit comments