Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Jan 25, 2023
2 parents 0da1fb1 + bb56f52 commit 89c6318
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion 4cat-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def start():
with daemon.DaemonContext(
working_directory=os.path.abspath(os.path.dirname(__file__)),
umask=0x002,
stderr=open("4cat.stderr", "w+"),
stderr=open(Path(config.get('PATH_ROOT'), config.get('PATH_LOGS'), "4cat.stderr"), "w+"),
detach_process=True
) as context:
import backend.bootstrap as bootstrap
Expand Down
3 changes: 2 additions & 1 deletion backend/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ def run(as_daemon=True):

# load everything
if config.get("USING_DOCKER"):
as_daemon = True
# Rename log if Docker setup
log = Logger(output=not as_daemon, filename='backend_4cat.log')
log = Logger(output=True, filename='backend_4cat.log')
else:
log = Logger(output=not as_daemon)

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
backend:
image: digitalmethodsinitiative/4cat:${DOCKER_TAG}
container_name: 4cat_backend
init: true
restart: unless-stopped
env_file:
- .env
Expand Down
1 change: 1 addition & 0 deletions docker-compose_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
context: .
dockerfile: docker/Dockerfile
container_name: 4cat_backend
init: true
env_file:
- .env
depends_on:
Expand Down
1 change: 1 addition & 0 deletions docker-compose_public_ip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
backend:
image: digitalmethodsinitiative/4cat:${DOCKER_TAG}
container_name: 4cat_backend
init: true
restart: unless-stopped
env_file:
- .env
Expand Down
15 changes: 1 addition & 14 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#!/bin/sh
set -e

exit_backend() {
echo "Exiting backend"
python3 4cat-daemon.py stop
exit 0
}

trap exit_backend INT TERM

# Handle any options
while test $# != 0
do
Expand Down Expand Up @@ -56,9 +48,4 @@ echo "http://$SERVER_NAME:$PUBLIC_PORT"
echo ''

# Start 4CAT backend
python3 4cat-daemon.py start

# Hang out until SIGTERM received
while true; do
sleep 1
done
exec python3 -u 4cat-daemon.py -i start
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"PyTumblr==0.1.0",
"requests~=2.27",
"requests_futures",
"scikit-learn",
"scenedetect==0.6.0.3",
"spacy==3.4.3",
"svgwrite~=1.4.0",
Expand Down

0 comments on commit 89c6318

Please sign in to comment.