Skip to content

Commit

Permalink
#24: Replace use of "docker-compose" with "docker compose" for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kenmeacham committed Aug 28, 2024
1 parent e5b81cb commit 4f9bff9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ the Spyderisk GUI first loads in your browser, you will be directed to load in
a new knowledgebase manually.

1. `$ cd system-modeller`
2. `$ docker-compose up -d`
3. `$ docker-compose exec ssm bash`
2. `$ docker compose up -d`
3. `$ docker compose exec ssm bash`
4. `$ ./gradlew assemble bootTest`
5. Go to <http://localhost:8089> in your browser.
6. Login in using `testuser` or `testadmin` with password `password`.
Expand Down Expand Up @@ -134,11 +134,11 @@ container is stopped (`SIGTERM` then `SIGKILL`) then the memory state is lost.
Commands:

* List containers that relate to the local `docker-compose.yml` file with
`docker-compose ps`
`docker compose ps`
* List running containers with `docker container ls` or just `docker ps`
* List all containers with `docker container ls -a` or just `docker ps -a`
* Remove the containers that relate to the local `docker-compose.yml` file with
`docker-compose rm`
`docker compose rm`
* Remove a container with `docker container rm <container ID>`
* Remove containers that are not running with `docker container prune` (be
careful!)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is automatically overlaid on the base `docker-compose.yml` file.
# To use it, just do `docker-compose up`.
# To use it, just do `docker compose up`.
# This docker-compose file is intended for developers and so leaves the source code on the host and adds various volume optimisations.
# Port-mappings to the host are read by default from the `.env` file.

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is an overlay for the base `docker-compose.yml` file.
# To use it, do `docker-compose -f docker-compose.yml -f docker-compose.test.yml --env-file .env.template up`.
# To use it, do `docker compose -f docker-compose.yml -f docker-compose.test.yml --env-file .env.template up`.
# This docker-compose file is used by the CI pipeline to execute the test.
# The tests can be executed using e.g. `docker-compose exec -T ssm sh -c 'cd /system-modeller && gradle test'`
# The tests can be executed using e.g. `docker compose exec -T ssm sh -c 'cd /system-modeller && gradle test'`

version: '3.7'

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file provides the base orchestration.
# The `docker-compose up` command will read this and automatically overlay the contents of the `docker-compose.override.yml` file.
# The `docker compose up` command will read this and automatically overlay the contents of the `docker-compose.override.yml` file.

services:
proxy:
Expand Down
46 changes: 23 additions & 23 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ To bring the containers (ssm, mongo, keycloak) up and leave the terminal
attached with the log files tailed:

```shell
docker-compose up
docker compose up
```

Alternatively, to bring the containers up and background (detach) the process:

```shell
docker-compose up -d
docker compose up -d
```

The `docker-compose.yml` file does not set the `container_name` property for
Expand All @@ -122,15 +122,15 @@ directory containing the `docker-compose.yml` file will, by default, be called
Compose picks up this name and uses it as the "project name". If more than one
instance of the SSM is required on one host, an alternative project name is
needed: either by renaming the `system-modeller` folder (recommended) or by
using the `-p` flag in `docker-compose` (e.g. `docker-compose -p <project name>
using the `-p` flag in `docker compose` (e.g. `docker compose -p <project name>
up -d`) but you must remember to use this flag every time.

## Getting a Shell

To get a shell in the `ssm` container:

```shell
docker-compose exec ssm bash
docker compose exec ssm bash
```

The equivalent `docker` command requires the full container name and also the
Expand All @@ -146,7 +146,7 @@ To see the logs from a service and `tail` the log so that it updates, the
command is:

```shell
docker-compose logs -f <SERVICE>
docker compose logs -f <SERVICE>
```

Where `<SERVICE>` could be e.g. `ssm`.
Expand All @@ -168,11 +168,11 @@ The Nginx reverse proxy forwards requests to the appropriate container and also

*The rest of this document assumes the default port mapping.*

To see the containers created by the `docker-compose` command along with their
To see the containers created by the `docker compose` command along with their
ports:

```shell
$ docker-compose ps
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
system-modeller-proxy-1 nginx:stable-alpine3.17 "/tmp/import/entrypo…" proxy 23 minutes ago Up 23 minutes 0.0.0.0:8089->80/tcp
system-modeller-keycloak-1 keycloak/keycloak:21.0 "/tmp/import/entrypo…" keycloak 23 minutes ago Up 23 minutes 0.0.0.0:8080->8080/tcp, 8443/tcp
Expand Down Expand Up @@ -268,7 +268,7 @@ in `.env` and is admin/password.
start the backend server on port 8081 <http://localhost:8081/system-modeller/>:

```shell
docker-compose exec ssm bash
docker compose exec ssm bash
cd /code
./gradlew build
./gradlew bootDev
Expand All @@ -294,7 +294,7 @@ frontend server on port 3000 (which will be used by e.g. the dashboard and
modeller pages):

```shell
docker-compose exec ssm bash
docker compose exec ssm bash
cd /code
./gradlew start
```
Expand Down Expand Up @@ -359,7 +359,7 @@ Get a shell on the ssm container (see above).
Build the code and start the backend server:

```shell
docker-compose exec ssm bash
docker compose exec ssm bash
cd /code
./gradlew build
./gradlew bootTest
Expand Down Expand Up @@ -411,27 +411,27 @@ The containers can be paused (and unpaused) which pauses the processes inside
the container and thus releases host resources but does not lose process state:

```shell
docker-compose pause
docker-compose unpause
docker compose pause
docker compose unpause
```

The containers can be stopped (and started) which will kill all the processes
running in the container but leave the container present:

```shell
docker-compose stop
docker-compose start
docker compose stop
docker compose start
```

If you originally used `docker-compose up` to start the containers without
detaching (with `-d`) then `Ctrl-C` is the same as `docker-compose stop`.
If you originally used `docker compose up` to start the containers without
detaching (with `-d`) then `Ctrl-C` is the same as `docker compose stop`.

The `docker-compose down` command stops the containers, removes them and
The `docker compose down` command stops the containers, removes them and
removes the networks they were using. There are also optional parameters to
remove the volumes and images:

```shell
docker-compose down
docker compose down
```

In all these cases, the (Docker disk) volumes are persisted and named volumes
Expand All @@ -443,21 +443,21 @@ persisted after restarting the containers.
If the intention is to recreate the databases or reinstall the default
knowledgebases, this may be done in the following ways:

a) Use `docker-compose down -v`, then restart containers and Spyderisk as
a) Use `docker compose down -v`, then restart containers and Spyderisk as
normal, e.g.

```shell
docker-compose down -v
docker-compose up -d
docker-compose exec ssm bash
docker compose down -v
docker compose up -d
docker compose exec ssm bash
./gradlew assemble bootTest
```

b) Leave containers running, but set `reset.on.start=true` in your
`application.properties` file, then restart Spyderisk, e.g.

```shell
docker-compose exec ssm bash
docker compose exec ssm bash
./gradlew assemble bootTest
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void run(String... args) {
production = false;
}
logger.warn("No domain models currently installed! Options include:");
String restartMsg = production ? "restart Spyderisk (docker-compose down -v; docker-compose up -d)"
String restartMsg = production ? "restart Spyderisk (docker compose down -v; docker compose up -d)"
: "restart Spyderisk (ensure RESET_ON_START=true in your .env file)";

logger.warn("1) Copy required domain model zip bundles into {} then " + restartMsg, kbSourceFolder);
Expand Down

0 comments on commit 4f9bff9

Please sign in to comment.