forked from ome/omero_search_engine
-
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
Showing
25 changed files
with
1,337 additions
and
153 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
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
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
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
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
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,3 @@ | ||
Dockerfile | ||
.git | ||
.gitignore |
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,23 @@ | ||
#docker build . -t searchengine | ||
# docker build . -f deployment/docker/rockylinux/Dockerfile -t searchengine | ||
FROM rockylinux/rockylinux:9.0 | ||
USER root | ||
RUN dnf update -y | ||
RUN dnf groupinstall "Development Tools" -y | ||
RUN dnf install libpq-devel -y | ||
RUN dnf install python3-pip -y | ||
RUN dnf install -y python3-devel.x86_64 | ||
RUN dnf clean all && rm -rf /var/cache/yum | ||
RUN mkdir /searchengine | ||
ADD deployment/docker/rockylinux/start_gunicorn_serch_engine.sh /searchengine | ||
ADD deployment/docker/rockylinux/run_app.sh /searchengine | ||
ADD . /searchengine | ||
RUN cd /searchengine | ||
RUN mkdir /etc/searchengine | ||
RUN mkdir /etc/searchengine/chachedata | ||
RUN mkdir /etc/searchengine/logs | ||
WORKDIR /searchengine | ||
RUN pip3 install -r requirements.txt | ||
RUN pip3 install gunicorn | ||
EXPOSE 5577 | ||
ENTRYPOINT ["bash", "run_app.sh"] |
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,18 @@ | ||
#!/bin/bash | ||
echo "$@" | ||
|
||
#test if the configuration file exists, if not it will copy it from the app configuration folder | ||
test -f /etc/searchengine/.app_config.yml || cp /searchengine/configurations/app_config.yml /etc/searchengine/.app_config.yml | ||
|
||
#Check the script input | ||
if [[ $@ == run_app* ]] ; then | ||
url_perfix=${@/run_app/} | ||
echo using prefix: $url_perfix | ||
bash start_gunicorn_serch_engine.sh $url_perfix | ||
elif [ -z "$@" ] || [ "$@" = "run_app" ]; then | ||
echo "Starting the app" | ||
bash start_gunicorn_serch_engine.sh | ||
else | ||
echo "$@" | ||
python3 manage.py "$@" | ||
fi |
26 changes: 26 additions & 0 deletions
26
deployment/docker/rockylinux/start_gunicorn_serch_engine.sh
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,26 @@ | ||
#!/bin/sh | ||
NAME="omero_search_engine" | ||
USER root | ||
APPPATH=/searchengine | ||
SOCKFILE=/etc/searchengine/sock3 #change this to project_dir/sock (new file will be created) | ||
echo "Starting $NAME as `whoami`" | ||
export PATH="$APPPATH:$PATH" | ||
echo "staring the app" | ||
# Create the run directory if it doesn't exist | ||
RUNDIR=$(dirname $SOCKFILE) | ||
echo "$RUNDIR" | ||
test -d $RUNDIR || mkdir -p $RUNDIR | ||
LOGS=/etc/searchengine/logs | ||
LOGSDIR=$(dirname $LOGS) | ||
test -d $LOGSDIR || mkdir -p $LOGSDIR | ||
user=$USER | ||
echo "Start Gunicorn ...." | ||
echo "$HOME" | ||
echo pwd | ||
cd $APPPATH | ||
if [ -z "$@" ]; then | ||
exec gunicorn "omero_search_engine:create_app('production')" -b 0.0.0.0:5577 --timeout 0 --name "$NAME" --bind=unix:$SOCKFILE --log-file=$LOGSDIR/logs/engine_gunilog.log --access-logfile=$LOGSDIR/logs/engine_access.log -error-logfile=$LOGSDIR/logs/engine_logs/engine_error.log --workers 4 | ||
else | ||
echo Run with SCRIPT_NAME=$@ | ||
SCRIPT_NAME=/"$@"/ exec gunicorn "omero_search_engine:create_app('production')" -b 0.0.0.0:5577 --timeout 0 --name "$NAME" --bind=unix:$SOCKFILE --log-file=$LOGSDIR/logs/engine_gunilog.log --access-logfile=$LOGSDIR/logs/engine_access.log -error-logfile=$LOGSDIR/logs/engine_logs/engine_error.log --workers 4 | ||
fi |
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
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,42 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright (C) 2024 University of Dundee & Open Microscopy Environment. | ||
# All rights reserved. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
from utils import query_the_search_ending, logging | ||
|
||
# It is similar to use the 'in' operator in a sql statement, | ||
# rather than having multiple 'or' conditions, | ||
# it will only use a single condition. | ||
|
||
# The following example will search for the images which have any of the 'Gene Symbol' | ||
# values in this list ["Duoxa2", "Bach2", "Cxcr2", "Mysm1"] | ||
|
||
# and filters | ||
|
||
logging.info("Example of using in operator") | ||
|
||
|
||
values_in = ["Duoxa2", "Bach2", "Cxcr2", "Mysm1"] | ||
logging.info("Searching for 'Gene Symbol' with values in [%s]" % (",".join(values_in))) | ||
and_filters = [{"name": "Gene Symbol", "value": values_in, "operator": "in"}] | ||
|
||
main_attributes = [] | ||
query = {"and_filters": and_filters} | ||
# | ||
recieved_results_data = query_the_search_ending(query, main_attributes) |
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,48 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright (C) 2024 University of Dundee & Open Microscopy Environment. | ||
# All rights reserved. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
from utils import query_the_search_ending, logging | ||
|
||
# It is similar to use the 'not in' operator in a sql statement, | ||
# rather than having multiple 'or' conditions with not_equals operators, | ||
# it will only use a single condition. | ||
|
||
# The following example will search for the images which have met any of the 'Organism' | ||
# values in this list | ||
# ["homo sapiens","mus musculus","mus musculus x mus spretus","human adenovirus 2"] | ||
|
||
# and filters | ||
|
||
logging.info("Example of using not_in operator") | ||
|
||
|
||
values_not_in = [ | ||
"homo sapiens", | ||
"mus musculus", | ||
"mus musculus x mus spretus", | ||
"human adenovirus 2", | ||
] | ||
logging.info("Searching for 'Organism' with values in [%s]" % (",".join(values_not_in))) | ||
and_filters = [{"name": "Organism", "value": values_not_in, "operator": "not_in"}] | ||
|
||
main_attributes = [] | ||
query = {"and_filters": and_filters} | ||
# | ||
received_results_data = query_the_search_ending(query, main_attributes) |
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
Oops, something went wrong.