-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kthoden
committed
Jul 14, 2021
1 parent
7039b3d
commit a57418b
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from utils.settings import BASE_DIR, load_config | ||
from utils.functions import run | ||
|
||
import subprocess | ||
import shlex | ||
import os | ||
from time import sleep | ||
|
||
|
||
def stop( env ): | ||
# run application | ||
subprocess.call( | ||
"docker-compose down", | ||
shell=True, | ||
env=env | ||
) | ||
|
||
if __name__ == '__main__': | ||
|
||
from argparse import ArgumentParser | ||
|
||
config = load_config() | ||
|
||
parser = ArgumentParser( | ||
description="restart the webserver" | ||
) | ||
parser.add_argument( | ||
"--build", | ||
action = "store_true" | ||
) | ||
parser.add_argument( | ||
"CMD", | ||
nargs="*" | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
stop( config ) | ||
|
||
|
||
CMD= \ | ||
(vars(args)['CMD']) | ||
run( | ||
env=config, | ||
build = args.build, | ||
cmd=CMD | ||
) | ||
|
||
print("\n------------------------------\n") | ||
print("You can view the tail of container log output with 'docker-compose logs -f' (ctrl + c to stop).") |