diff --git a/README.md b/README.md index 799bd5d6ae6eaf205775dfef869b5c2ab6822dc7..1cc7a49f87de9904c111547ac55f10ead93a9e01 100755 --- a/README.md +++ b/README.md @@ -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=/... diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index ea23bbe570c774612259833f74b5d0f0182abae4..6461a7bb580e71c62fe96513bd0af5b8516a4455 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -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" diff --git a/rosetta/logs b/rosetta/logs new file mode 100755 index 0000000000000000000000000000000000000000..41a9ad12bd5ae7789790466f762f5a795c8bd892 --- /dev/null +++ b/rosetta/logs @@ -0,0 +1,20 @@ +#!/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 + + diff --git a/run_webapp_unit_tests.sh b/rosetta/test similarity index 100% rename from run_webapp_unit_tests.sh rename to rosetta/test diff --git a/services/webapp/code/rosetta/core_app/templates/header.html b/services/webapp/code/rosetta/core_app/templates/header.html index 29d46e1a394b24190c558bfd80fe11316f6553db..6d82d4959fa0a3ea0b1d71d2065a126181d3097a 100644 --- a/services/webapp/code/rosetta/core_app/templates/header.html +++ b/services/webapp/code/rosetta/core_app/templates/header.html @@ -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"> diff --git a/services/webapp/code/rosetta/core_app/views.py b/services/webapp/code/rosetta/core_app/views.py index 86b1f04aff498c65446cf5c7c7e9caf25a2acaea..d069f6be87014bab1b4259d25f744689fc380aef 100644 --- a/services/webapp/code/rosetta/core_app/views.py +++ b/services/webapp/code/rosetta/core_app/views.py @@ -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) diff --git a/services/webapp/code/rosetta/settings.py b/services/webapp/code/rosetta/settings.py index 6dc85d48cdb053ab9629021a2df92440517fe1d0..df5a3f75b589cd608990f3f836e5263073642e63 100644 --- a/services/webapp/code/rosetta/settings.py +++ b/services/webapp/code/rosetta/settings.py @@ -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') diff --git a/view_webapp_server_log.sh b/view_webapp_server_log.sh deleted file mode 100755 index 0572279206088fc14d6077ea262ddbd5a109d0ac..0000000000000000000000000000000000000000 --- a/view_webapp_server_log.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -tail -f -n 1000 data_rosetta/webapp/log/server.log diff --git a/view_webapp_startup_log.sh b/view_webapp_startup_log.sh deleted file mode 100755 index 5e57e64cb4a9dbd06874283765aedf6813259e58..0000000000000000000000000000000000000000 --- a/view_webapp_startup_log.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -tail -f -n 1000 data_rosetta/webapp/log/startup.log