Skip to content

Commit

Permalink
Revert docker-compose.yaml changes based on feedback
Browse files Browse the repository at this point in the history
Also a small update to readme (use of `docker-compose` is deprecated

- revert 'depends_on' change. This was a
  [docker bug in 2.24](docker/compose#11544)
- Remove unneeded comments
  • Loading branch information
sbliven committed Jun 27, 2024
1 parent d67aa98 commit 6048ac6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
20 changes: 10 additions & 10 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

Development can be done running local docker containers. First `docker-compose` is used
Development can be done running local docker containers. First `docker compose` is used
to launch containers for each service. Most containers do not start the service
directly, allowing this to be done manually from inside the container (eg using VS Code
Dev Containers). Commands for each service are given below.
Expand All @@ -17,13 +17,13 @@ git submodule update --init --recursive --remote
## Starting containers

### :warning: IMPORTANT
The docker-compose builds the containers from the Dockerfile of each submodule, thus
The `docker compose` builds the containers from the Dockerfile of each submodule, thus
using the submodule checked out to a particular commit. It is often the case that when
setting up the environment one wants the components to be checked out automatically to
the latest on main. The command above (`git submodule update --init --recursive
--remote`) does that but might break any component where a non-backwards compatible
change was applied. We reference in the config of each components the latest commit
(.git-commit-sha) of the submodule where the docker-compose was run and worked the last
(.git-commit-sha) of the submodule where `docker compose` was run and worked the last
time, whenever the submodule commit is different from the one referenced in the
scicat-ci repo.

Expand All @@ -35,11 +35,11 @@ Build the docker containers with the suitable

```bash
export COMPOSE_PROFILES=<MY_PROFILES>
docker-compose -f docker-compose.yaml up -d --force-recreate --build --no-deps
docker compose -f docker-compose.yaml up -d --force-recreate --build --no-deps
```

All the application containers (excluding the db -mongo- and the db_seeding
-mongo_seed-) are meant to be used for development so docker-compose starts, rather than
-mongo_seed-) are meant to be used for development so `docker compose` starts, rather than
the applications, environments where the development environment of each application is
set up. This means that, to run the application, one has to attach to the container and
start it.
Expand All @@ -55,9 +55,9 @@ backend and the frontend.
```bash
export COMPOSE_PROFILES=be,fe
```
2. run docker-compose:
2. run docker compose:
```bash
docker-compose -f docker-compose.yaml up --force-recreate --build --no-deps -d
docker compose -f docker-compose.yaml up --force-recreate --build --no-deps -d
```

This will start four containers: the be container, the fe one, the mongodb database and
Expand All @@ -70,9 +70,9 @@ mongo.
```bash
export COMPOSE_PROFILES=be_next,fe
```
2. run docker-compose:
2. run docker compose:
```bash
docker-compose -f docker-compose.yaml up --force-recreate --build --no-deps -d
docker compose -f docker-compose.yaml up --force-recreate --build --no-deps -d
```

As before, this will start four containers: the be_next container, the fe one, the mongo
Expand Down Expand Up @@ -191,7 +191,7 @@ This compose file creates a new docker volume with test data. Removing this requ
adding `--volumes` when shutting down the containers:

```bash
docker-compose -f docker-compose.yaml down --volumes
docker compose -f docker-compose.yaml down --volumes
```

If this is omitted it may eventually lead to your docker virtual disk filling up. If
Expand Down
10 changes: 2 additions & 8 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ services:
- be
- be_next
- oi
ports:
- 27017:27017

mongodb_seed:
image: mongo
Expand All @@ -22,6 +20,8 @@ services:
- "-c"
- "chmod u+x /mnt/mongo_import.sh && /mnt/mongo_import.sh"
user: "0:0"
depends_on:
- mongodb
restart: on-failure
profiles:
- never
Expand All @@ -32,17 +32,13 @@ services:
- DATABASE=be
profiles:
- be
depends_on:
- mongodb

mongodb_seed_be_next:
extends: mongodb_seed
environment:
- DATABASE=be_next
profiles:
- be_next
depends_on:
- mongodb

be:
build: ../backend/.
Expand Down Expand Up @@ -75,8 +71,6 @@ services:
- /frontend/dist
command: /bin/sh -c "while true; do sleep 600; done"
ports:
# Dev image with `node start` uses port 4200
# For the upstream dockerfile with nginx, use 4200:80
- 4200:4200
profiles:
- fe
Expand Down

0 comments on commit 6048ac6

Please sign in to comment.