Skip to content
Merged
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
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ run-dev: migrate
run-staging: migrate
make run-django-staging & \
make run-celery & \
make run-celery-beat & \
make run-virgo-staging
make run-celery-beat

django-migrate: migrations migrate

Expand All @@ -85,7 +84,7 @@ run-celery:
celery -A scidash.main worker -l info --concurrency=5 --maxtasksperchild=20

run-celery-beat:
celery -A scidash.main beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
celery -A scidash.main beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler --pidfile=

run-virgo-staging:
/bin/bash /opt/virgo/bin/startup.sh
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ celery[redis]
django-celery-beat
django-celery-results
django-db-logger
git+git://github.com/ddelpiano/neuronunit@4.0.0#egg=neuronunit
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
# pip-compile
#
amqp==2.4.2 # via kombu
asgiref==2.3.2 # via channels
Expand All @@ -27,6 +27,7 @@ django==1.11.7
djangorestframework-jwt==1.11.0
djangorestframework==3.7.1
drf-writable-nested==0.5.1
git+git://github.com/ddelpiano/neuronunit@4.0.0#egg=neuronunit
hyperlink==18.0.0 # via twisted
idna==2.8 # via hyperlink
incremental==17.5.0 # via twisted
Expand Down
38 changes: 38 additions & 0 deletions scidash/sciunittests/migrations/0046_auto_20190827_0221.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2019-12-11 01:56
from __future__ import unicode_literals

import datetime
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import scidash.sciunittests.models


class Migration(migrations.Migration):

dependencies = [
('sciunittests', '0045_auto_20190712_1041'),
]

operations = [
migrations.AddField(
model_name='testclass',
name='default_params',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, encoder=scidash.sciunittests.models.JSONEncoder, null=True),
),
migrations.AlterField(
model_name='scoreinstance',
name='timestamp',
field=models.DateTimeField(default=datetime.datetime.today),
),
migrations.AlterField(
model_name='testinstance',
name='timestamp',
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name='testsuite',
name='timestamp',
field=models.DateTimeField(default=datetime.datetime.today),
),
]
12 changes: 3 additions & 9 deletions scidash/sciunittests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ def get(self, request, *args, **kwargs):
day=current_date.day
)

three_month_ago = current_date_iso - three_month_period
six_month_ago = three_month_ago - three_month_period
nine_month_ago = six_month_ago - three_month_period
tvelwe_month_ago = nine_month_ago - three_month_period

acceptable_period = None

for period in [
three_month_ago, six_month_ago, nine_month_ago, tvelwe_month_ago
]:
for quarter in range(1, s.SCIDASH_INITIAL_SEARCH_QUARTERS + 1):
period = current_date_iso - quarter*three_month_period
count = ScoreInstance.objects.filter(
timestamp__gte=period, timestamp__lt=current_date_iso
).count()
Expand All @@ -36,7 +30,7 @@ def get(self, request, *args, **kwargs):
break

if acceptable_period is None:
acceptable_period = tvelwe_month_ago
acceptable_period = period

return Response(
{
Expand Down
22 changes: 15 additions & 7 deletions service/deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@ services:
scidash-redis:
image: redis
expose:
- "6379"
- 6379
scidash-postgres:
image: metacell/scidash_db:latest
expose:
- "5432"
- 5432
volumes:
- ./database:/var/lib/postgresql/
scidash:
image: metacell/scidash:latest
scidash-virgo:
image: metacell/scidash_virgo:v1.0.0
expose:
- 8080
mem_reservation: 5120m
mem_limit: 10240m
priviliged: true
privileged: true
shm_size: 512M
expose:
- "8000"
depends_on:
- scidash-redis
- scidash-postgres
scidash:
image: metacell/scidash:latest
ports:
- 8000:8000
depends_on:
- scidash-redis
- scidash-postgres
- scidash-virgo
32 changes: 15 additions & 17 deletions service/docker/Dockerfile-scidash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM metacell/scidash_virgo:v1.0.0
FROM python:3.6

USER root
USER root

# BUILD VARIABLES
ARG ROOT=/
Expand All @@ -9,47 +9,45 @@ ARG NRN_SYMLINK=/Applications/NEURON-7.6/nrn/
ARG DOTENV_FILE=env-docker
ARG STATIC_DIR=$APP_DIR/scidash/static
ARG GEPPETTO_DIR=$STATIC_DIR/org.geppetto.frontend/src/main/webapp
ARG SCIDASH_BRANCH=4.0.1
ARG SCIDASH_BRANCH=feature/400
ENV SERVER_HOME $APP_DIR/virgo-tomcat-server

WORKDIR $ROOT
RUN useradd -ms /bin/bash developer
ENV HOME /home/developer

#COPYING PROJECT
WORKDIR $APP_DIR
RUN git clone -b $SCIDASH_BRANCH https://github.com/MetaCell/scidash
WORKDIR $ROOT

# INSTALLING REQUIREMENTS
RUN apt-get install -y curl wget lsof
RUN apt-get install -y curl wget
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash
RUN apt-get update && apt-get -y install nodejs
RUN curl https://www.npmjs.com/install.sh | sh

#COPYING PROJECT
WORKDIR $APP_DIR
RUN git clone -b $SCIDASH_BRANCH https://github.com/MetaCell/scidash

WORKDIR /nrn
RUN chown -R developer ./

WORKDIR $APP_DIR/scidash
RUN pip install virtualenv
RUN pip install virtualenv
RUN virtualenv venv-py -p python3.6
WORKDIR /usr/local/nrn/src/nrnpython
RUN python setup.py install

WORKDIR $APP_DIR/scidash
RUN make install-backend-with-env
RUN make install-sciunit-neuronunit
RUN make install-frontend

WORKDIR $GEPPETTO_DIR
RUN ls -la
RUN npm run build-dev-noTest

WORKDIR $APP_DIR/scidash
RUN rm -rf .git &&\
rm -rf static/org.geppetto.frontend/.git &&\
RUN rm -rf .git &&\
rm -rf static/org.geppetto.frontend/.git &&\
rm -rf static/org.geppetto.frontend/extension/geppetto-scidash/.git &&\
rm -rf sciunit/.git &&\
rm -rf neuronunit/.git
RUN chown -R developer ./
RUN cp ./service/dotenv/scidash_env .env

USER developer

CMD ./service/scripts/run.sh
5 changes: 3 additions & 2 deletions service/docker/Dockerfile-virgo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG SCIDASH_BRANCH=development
WORKDIR /
RUN useradd -ms /bin/bash developer
ENV HOME /home/developer
RUN printf "\ndeb http://deb.debian.org/debian/ sid main\n" >> /etc/apt/sources.list
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
Expand Down Expand Up @@ -80,14 +81,14 @@ RUN ls -l /usr/local/nrn/

# -== INSTALL VIRGO ==-
RUN mkdir $VIRGO_DIR
RUN apt-get install curl
RUN apt-get -y install curl
RUN curl -L 'http://www.eclipse.org/downloads/download.php?file=/virgo/release/VP/3.7.2.RELEASE/virgo-tomcat-server-3.7.2.RELEASE.zip&r=1' > virgo.zip
RUN unzip virgo.zip
RUN cp -r ./virgo-tomcat-server-3.7.2.RELEASE/* $VIRGO_DIR
RUN rm $VIRGO_DIR/configuration/java-server.profile
RUN cp /git/scidash/service/geppetto/java-server.profile $VIRGO_DIR/configuration/
RUN rm $VIRGO_DIR/configuration/tomcat-server.xml
RUN cp /git/scidash/service/geppetto/tomcat-server.xml $VIRGO_DIR/configuration/
RUN cat /git/scidash/service/geppetto/tomcat-server.xml | sed 's/127.0.0.1/0.0.0.0/' > $VIRGO_DIR/configuration/tomcat-server.xml
RUN chmod u+x $VIRGO_DIR/bin/*.sh
ENV SERVER_HOME $VIRGO_DIR
RUN chmod 777 -R $VIRGO_DIR
Expand Down
12 changes: 9 additions & 3 deletions service/dotenv/env-docker
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ STATIC_DIR=static

REDIS_URL=redis://scidash-redis:6379

GEPPETTO_SERVLET_URL='ws://localhost:8080/org.geppetto.frontend/GeppettoServlet'
GEPPETTO_BASE_URL='http://localhost:8080/org.geppetto.frontend/geppetto'
BASE_PROJECT_FILES_HOST='http://localhost:8000/static/projects/'
# for localhost
# GEPPETTO_HOST=localhost
# for docker
GEPPETTO_HOST=scidash-virgo
GEPPETTO_PORT=8080
GEPPETTO_SERVLET_URL=ws://${GEPPETTO_HOST}:${GEPPETTO_PORT}/org.geppetto.frontend/GeppettoServlet
GEPPETTO_BASE_URL=http://${GEPPETTO_HOST}:${GEPPETTO_PORT}/org.geppetto.frontend/geppetto

BASE_PROJECT_FILES_HOST='http://scidash:8000/static/projects/'
12 changes: 9 additions & 3 deletions service/dotenv/scidash_env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ REDIS_URL=redis://scidash-redis:6379
STATIC_URL='/static/'
STATIC_DIR='static'

# GEPPETTO_SERVLET_URL='ws://scidash-virgo:8080/org.geppetto.frontend/GeppettoServlet'
# GEPPETTO_BASE_URL='http://scidash-virgo:8080/org.geppetto.frontend/geppetto'
# BASE_PROJECT_FILES_HOST='http://scidash-virgo:8000/static/projects/'
# for localhost
# GEPPETTO_HOST=localhost
# for docker
GEPPETTO_HOST=scidash-virgo
GEPPETTO_PORT=8080
GEPPETTO_SERVLET_URL=ws://${GEPPETTO_HOST}:${GEPPETTO_PORT}/org.geppetto.frontend/GeppettoServlet
GEPPETTO_BASE_URL=http://${GEPPETTO_HOST}:${GEPPETTO_PORT}/org.geppetto.frontend/geppetto

BASE_PROJECT_FILES_HOST='http://scidash:8000/static/projects/'
2 changes: 1 addition & 1 deletion service/geppetto/GeppettoConfiguration.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_README": "http://docs.geppetto.org/en/latest/build.html",
"contextPath": "org.geppetto.frontend",
"useSsl": true,
"useSsl": false,
"embedded": false,
"embedderURL": ["/"],
"rootRedirect": "",
Expand Down
2 changes: 1 addition & 1 deletion service/geppetto/tomcat-server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Listener className="org.apache.catalina.security.SecurityListener" />

<Service name="Catalina">
<Connector address="127.0.0.1" port="8080"
<Connector address="0.0.0.0" port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" enableLookups="false" redirectPort="8443" />

Expand Down
21 changes: 6 additions & 15 deletions service/scripts/db-create-psql.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
#!/bin/bash

psql -d template1 -c 'create extension hstore;'

psql <<EOF
\x
DROP DATABASE IF EXISTS scidash;
CREATE DATABASE scidash;
\c scidash;

REVOKE ALL PRIVILEGES ON DATABASE scidash FROM scidash_admin;
DROP USER IF EXISTS scidash_admin;
CREATE USER scidash_admin WITH PASSWORD 'scidash_local_password';

GRANT ALL PRIVILEGES ON DATABASE scidash TO scidash_admin;
ALTER USER scidash_admin CREATEDB
EOF
cd /tmp
git clone https://github.com/ddelpiano/scidash-artifacts
cd scidash-artifacts/database
gunzip `ls | head -n 1`
pg_restore --clean -d scidash `ls *db | head -n 1`
cd -
17 changes: 17 additions & 0 deletions service/scripts/db-create-psql.sh.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

psql -d template1 -c 'create extension hstore;'

psql <<EOF
\x
DROP DATABASE IF EXISTS scidash;
CREATE DATABASE scidash;
\c scidash;

REVOKE ALL PRIVILEGES ON DATABASE scidash FROM scidash_admin;
DROP USER IF EXISTS scidash_admin;
CREATE USER scidash_admin WITH PASSWORD 'scidash_local_password';

GRANT ALL PRIVILEGES ON DATABASE scidash TO scidash_admin;
ALTER USER scidash_admin CREATEDB
EOF