Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Metagenomics
metagenedb
Commits
b4c49d8d
Commit
b4c49d8d
authored
Dec 18, 2019
by
Kenzo-Hugo Hillion
♻
Browse files
use gunicorn on kubernetes
parent
6e951fff
Pipeline
#20285
passed with stages
in 2 minutes and 43 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/Dockerfile
View file @
b4c49d8d
...
...
@@ -5,7 +5,7 @@ ENV PYTHONUNBUFFERED 1
# Install pipenv
RUN
pip
install
pipenv
RUN
apt update
&&
apt
install
vim
cron
-y
RUN
apt update
&&
apt
install
vim
-y
WORKDIR
/code
RUN
rm
-rf
Dockerfile
...
...
backend/metagenedb/api/catalog/views/admin_commands.py
View file @
b4c49d8d
import
logging
from
rest_framework
import
permissions
from
rest_framework.response
import
Response
from
rest_framework.status
import
HTTP_500_INTERNAL_SERVER_ERROR
...
...
@@ -8,6 +10,8 @@ from metagenedb.apps.catalog.management.commands.compute_stats import (
ComputeCounts
,
ComputeGeneLength
,
ComputeTaxonomyRepartition
)
logger
=
logging
.
getLogger
(
__name__
)
class
AdminCommandsAPI
(
APIView
):
authentication_classes
=
[
JSONWebTokenAuthentication
]
...
...
@@ -24,7 +28,8 @@ class ComputeStatisticsAPI(AdminCommandsAPI):
self
.
compute_class
().
all
()
# ComputeGeneLength().all()
# ComputeTaxonomyRepartition().all()
except
Exception
:
except
Exception
as
exception
:
logger
.
warning
(
exception
)
return
Response
({
"message"
:
self
.
error_message
},
status
=
HTTP_500_INTERNAL_SERVER_ERROR
)
return
Response
({
"message"
:
self
.
success_message
})
...
...
backend/metagenedb/settings/django.py
View file @
b4c49d8d
...
...
@@ -150,3 +150,22 @@ SECRET_KEY = env.str('SECRET_KEY', default='')
# -- key for API when additional information is added to the payload
API_KEY_ADDITIONAL_INFO
=
env
.
str
(
'API_KEY_ADDITIONAL_INFO'
,
default
=
'metagenedb_additional_info'
)
LOGGING
=
{
'version'
:
1
,
'disable_existing_loggers'
:
False
,
'handlers'
:
{
'console'
:
{
'class'
:
'logging.StreamHandler'
,
},
},
'loggers'
:
{
'django'
:
{
'handlers'
:
[
'console'
],
'level'
:
env
.
str
(
'DJANGO_LOG_LEVEL'
,
'INFO'
),
},
'metagenedb'
:
{
'level'
:
env
.
str
(
'DJANGO_LOG_LEVEL'
,
'INFO'
),
},
},
}
backend/scripts/start.sh
View file @
b4c49d8d
...
...
@@ -7,4 +7,4 @@ if [ -z $PORT ];then PORT=8000;fi # Need to fix to get value from .env file
python
${
SCRIPTS_PATH
}
/manage.py collectstatic
--no-input
python
${
SCRIPTS_PATH
}
/manage.py makemigrations
python
${
SCRIPTS_PATH
}
/manage.py migrate
python
${
SCRIPTS_PATH
}
/manage.py runserver
0.0.0.0:
${
PORT
}
gunicorn metagenedb.wsgi:application
--capture-output
--bind
0.0.0.0:
${
PORT
}
docker-compose.yaml
View file @
b4c49d8d
...
...
@@ -15,7 +15,7 @@ services:
DEBUG
:
"
true"
depends_on
:
-
postgresql
command
:
/code/scripts/start
_dev
.sh
command
:
/code/scripts/start.sh
networks
:
-
main
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment