Skip to content

Commit 253352b

Browse files
forrestbaoli-xin-yi
authored andcommitted
Add dual-stack in README
1 parent 839d227 commit 253352b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,46 @@ cd ./api/
154154
yarn
155155
```
156156

157+
## Starting two stacks simultaneously
158+
159+
It might be necessary to create two Docker stacks for two verions of CodePod, respectively. For example, you might want to test the new version of CodePod while keeping the old version running.
160+
161+
Because Docker uses the folder name as the default suffix in container names, these two stacks may conflict with each other. To avoid this, you can use the `COMPOSE_PROJECT_NAME` environment variable to set a prefix for the container names. For example, you can set `COMPOSE_PROJECT_NAME=codepod-v2` in the `CODEPOD_ROOT/compose/dev/.env` file of the new stack, and then [start](#starting-the-stack) the new stack.
162+
163+
The two stacks also may share the same network ports due to the same configuration files used. To set the ports, search for the following lines in `CODEPOD_ROOT/compose/dev/nginx.conf` (two occurences of the two lines in the file) file of the new stack:
164+
165+
```yaml
166+
listen 80;
167+
listen [::]:80;
168+
```
169+
170+
and the following section in the `CODEPOD_ROOT/compose/dev/compose.yml` file of the new stack:
171+
172+
```
173+
nginx:
174+
image: nginx:alpine
175+
ports:
176+
- 80:80
177+
volumes:
178+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
179+
```
180+
181+
and replace the default port number 80 to a new port number. For example, you can set the port number to 8080 for all occurences of 80.
182+
183+
Also, comment out the port section of the `ui` container in `CODEPOD_ROOT/compose/dev/compose.yml` as:
184+
185+
```
186+
ui:
187+
image: node:18
188+
working_dir: /app
189+
# ports:
190+
# For react hot-reloading in development.
191+
# - 3000:3000
192+
```
193+
194+
195+
Then, you can access the new stack at `http://localhost:8080`.
196+
157197

158198
# Citation
159199

0 commit comments

Comments
 (0)