Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker_compose: Add script to start the server on debug mode. #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cernopendata/modules/records/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def file_download_ui(pid, record, _record_file_factory=None, **kwargs):

fileobj = _record_file_factory(pid, record, filename)
if not fileobj:
for index in record.file_indices:
for index in record.get("_file_indices", []):
for file in index["files"]:
if file["key"] == filename:
obj = ObjectResource.get_object(
Expand Down Expand Up @@ -162,8 +162,8 @@ def record_file_page(pid, record, page=1, **kwargs):
except Exception:
items_per_page = 5

_files = record.files
index_files = record._file_indices
_files = record.get("files", [])
index_files = record.get("_file_indices", [])
if request.args.get("group"):
grouped_files = {
"index_files": {
Expand Down
24 changes: 24 additions & 0 deletions scripts/start-server-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
echo "Ready to start the web server in debug mode"
cd /code
export INVENIO_SECRET_KEY=$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-' | fold -w 10 | head -n 1)
if [ -d "/opt/invenio/var/instance/python/lib/python3.9/site-packages/cernopendata" ]; then
echo "The installation directory is still there... let's overwrite it"
cp /code/cernopendata/setup.py /code/setup.py
pip install -e .

if [ -d "/cold" ]; then
cd /cold
pip install -e .
fi
fi

if [ "$1" == "worker" ]; then
echo "Starting the celery worker"
celery -A cernopendata.celery worker --beat --loglevel=INFO --concurrency=1
else
echo "Starting the web server"
cernopendata run -h 0.0.0.0 --reload;
fi
echo "THE WEB SERVICE DIED!!! Let's sleep for a bit to give some time to debug"
sleep 60
Loading