Update test to use docker compose.

This commit is contained in:
Ben Rog-Wilhelm 2024-08-08 07:55:09 -05:00
parent 553dd6756d
commit fc6a0e7a32
2 changed files with 11 additions and 9 deletions

View file

@ -24,7 +24,7 @@ cd rDrama
4 - Run the following command to start the site:
```sh
docker-compose up --build
docker compose up --build
```
The first time you do this, it will take a while. It'll be (much) faster next time.
@ -35,7 +35,7 @@ The first time you do this, it will take a while. It'll be (much) faster next ti
6 - That's it!
Most code edits will be reflected (almost) immediately. If you make any setup changes or database changes, you'll need to ctrl-C the docker-compose status log and run `docker-compose up --build` again.
Most code edits will be reflected (almost) immediately. If you make any setup changes or database changes, you'll need to ctrl-C the docker status log and run `docker compose up --build` again.
Chat-related code edits will take a minute to update (if it's in Python) or won't be reflected automatically at all (if it's in React). Improvements welcome! But almost nobody touches these systems, so it hasn't been a priority.
@ -99,7 +99,7 @@ def downgrade():
4. Restart the Docker container to make sure it works.
```sh
docker-compose up --build
docker compose up --build
```
## So what's up with original-schema.sql, can I just change that?

View file

@ -54,7 +54,8 @@ def _execute(command,**kwargs):
def _docker(command, **kwargs):
return _execute([
"docker-compose",
"docker",
"compose",
"exec", '-T',
"site",
] + command,
@ -64,7 +65,8 @@ def _start():
print("Starting containers in operation mode . . .")
print(" If this takes a while, it's probably building the container.")
command = [
'docker-compose',
'docker',
'compose',
'-f', 'docker-compose.yml',
'-f', 'docker-compose-operation.yml',
'up',
@ -83,16 +85,16 @@ def _start():
# previous versions of this code also had a check to see if the containers started up properly
# but this is surprisingly annoying to do if we don't know the containers' names
# docker-compose *can* do it, but you either have to use very new features that aren't supported on Ubuntu 22.04, or you have to go through a bunch of parsing pain
# docker compose *can* do it, but you either have to use very new features that aren't supported on Ubuntu 22.04, or you have to go through a bunch of parsing pain
# and it kind of doesn't seem necessary
# see, docker-compose in this form *will* wait until it's *attempted* to start each container.
# see, docker compose in this form *will* wait until it's *attempted* to start each container.
# so at this point in execution, either the containers are running, or they're crashed
# if they're running, hey, problem solved, we're good
# if they're crashed, y'know what, problem still solved! because our next command will fail
# maybe there's still a race condition? I dunno! Keep an eye on this.
# If there is a race condition then you're stuck doing something gnarly with `docker-compose ps`. Good luck!
# If there is a race condition then you're stuck doing something gnarly with `docker compose ps`. Good luck!
print(" Containers started!")
@ -100,7 +102,7 @@ def _start():
def _stop():
# use "stop" instead of "down" to avoid killing all stored data
command = ['docker-compose','stop']
command = ['docker', 'compose', 'stop']
print("Stopping containers . . .")
result = _execute(command)
return result