Skip to content
Snippets Groups Projects
Commit 355a7422 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Minor refactor, cleanup.

parent d0b8e8b5
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ _A container-centric Science Platform_
Rosetta makes it easy to run interactive workloads on batch and remote computing systems using Docker and Singularity containers.
Rosetta licensed under the Apache License 2.0, unless otherwise specificed.
## Quickstart
......@@ -58,14 +60,14 @@ Example Webapp configuraion
### Extras
Check status (not yet fully supported)
List all running services
# rosetta/status
# rosetta/ps
Check status (not yet fully supported)
Run Web App unit tests (with Rosetta running)
# rosetta/status
./run_webapp_unit_tests.sh
### Building errors
......@@ -98,6 +100,19 @@ Note that when you edit the Django ORM model, you need to rerun the migrate the
$ python3 manage.py makemigrations
$ python3 manage.py migrate
### Logs and testing
Run Web App unit tests (with Rosetta running)
$ rosetta/logs webapp
$ rosetta/logs webapp startup
$ rosetta/logs webapp server
$rosetta/tets
## Known issues
SINGULARITY_TMPDIR=/...
......
......@@ -46,6 +46,7 @@ services:
hostname: webapp
environment:
- SAFEMODE=False
- DJANGO_DEBUG=True
- DJANGO_LOG_LEVEL=CRITICAL
- ROSETTA_LOG_LEVEL=DEBUG
#- ROSETTA_TUNNEL_HOST=
......@@ -56,6 +57,7 @@ services:
#- DJANGO_EMAIL_APIKEY=""
#- DJANGO_EMAIL_FROM="Rosetta Platform <notifications@rosetta.platform>"
#- DJANGO_PUBLIC_HTTP_HOST=http://localhost:8080
#- DJANGO_SECRET_KEY=""
ports:
- "8080:8080"
- "7000-7020:7000-7020"
......@@ -63,7 +65,7 @@ services:
- ./data_rosetta/webapp/data:/data
- ./data_rosetta/webapp/log:/var/log/webapp
- /var/run/docker.sock:/var/run/docker.sock
#- ./services/webapp/code:/opt/webapp_code
- ./services/webapp/code:/opt/code
proxy:
image: "rosetta/proxy"
......
#!/bin/bash
# Check if we are in the right place
if [ ! -d ./services ]; then
echo "You must run this command from the project's root folder."
exit 1
fi
if [[ $# -eq 0 ]] ; then
echo "Please tell me which service to get logs from."
exit 1
fi
if [[ "x$2" != "x" ]] ; then
tail -f -n 1000 data_rosetta/$1/log/$2.log
else
docker-compose logs -f $1
fi
File moved
......@@ -13,11 +13,7 @@
<meta http-equiv="refresh" content="{{refresh}}" >
{% endif %}
{% if data.title %}
<title>{{data.title}}</title>
{% else %}
<title>Rosetta</title>
{% endif %}
<!-- Bootstrap Core CSS -->
<link href="/static/css/bootstrap-3.3.5.min.css" rel="stylesheet">
......
......@@ -30,7 +30,6 @@ _task_cache = {}
def login_view(request):
data = {}
data['title'] = "{} - Login".format(settings.DJANGO_PROJECT_NAME)
# If authenticated user reloads the main URL
if request.method == 'GET' and request.user.is_authenticated:
......@@ -80,7 +79,7 @@ def login_view(request):
loginToken.token = token
loginToken.save()
try:
send_email(to=user.email, subject='{} login link'.format(settings.DJANGO_PROJECT_NAME), text='Hello,\n\nhere is your login link: {}/login/?token={}\n\nOnce logged in, you can go to "My Account" and change password (or just keep using the login link feature).\n\nThe {} Team.'.format(settings.DJANGO_PUBLIC_HTTP_HOST, token, settings.DJANGO_PROJECT_NAME))
send_email(to=user.email, subject='Rosetta login link', text='Hello,\n\nhere is your login link: {}/login/?token={}\n\nOnce logged in, you can go to "My Account" and change password (or just keep using the login link feature).\n\nThe Rosetta Team.'.format(settings.DJANGO_PUBLIC_HTTP_HOST, token))
except Exception as e:
logger.error(format_exception(e))
raise ErrorMessage('Something went wrong. Please retry later.')
......@@ -141,7 +140,6 @@ def logout_view(request):
def register_view(request):
data = {}
data['title'] = "{} - Register".format(settings.DJANGO_PROJECT_NAME)
# If authenticated user reloads the main URL
if request.method == 'GET' and request.user.is_authenticated:
......@@ -230,7 +228,6 @@ def account(request):
except Profile.DoesNotExist:
profile = Profile.objects.create(user=request.user)
data['profile'] = profile
data['title'] = "{} - Account".format(settings.DJANGO_PROJECT_NAME)
# Set values from POST and GET
edit = request.POST.get('edit', None)
......
......@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
import os
from django.core.exceptions import ImproperlyConfigured
from .core_app.utils import booleanize
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -22,16 +22,16 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '-3byo^nd6-x82fuj*#68mj=5#qp*gagg58sc($u$r-=g8ujxu4'
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '-3byo^nd6-x82fuj*#68mj=5#qp*gagg58sc($u$r-=g8ujxu4')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = booleanize(os.environ.get('DJANGO_DEBUG', False))
# SECURITY WARNING: check if you want this in production
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'rosetta.core_app',
'django.contrib.admin',
......@@ -157,7 +157,6 @@ TMP_PATH = '/tmp/'
# Email settings
#===============================
DJANGO_PROJECT_NAME = os.environ.get('DJANGO_PROJECT_NAME', 'Rosetta')
DJANGO_PUBLIC_HTTP_HOST = os.environ.get('DJANGO_PUBLIC_HTTP_HOST', 'http://localhost:8080')
DJANGO_EMAIL_SERVICE = os.environ.get('DJANGO_EMAIL_SERVICE', 'Sendgrid')
......
#!/bin/bash
tail -f -n 1000 data_rosetta/webapp/log/server.log
#!/bin/bash
tail -f -n 1000 data_rosetta/webapp/log/startup.log
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment