Skip to main content

Ambition Trial EDC (https://doi.org/10.1186/ISRCTN72509687)

Project description

pypi travis coverage

Ambition Edc

(P.I. Joe Jarvis)

http://www.isrctn.com/ISRCTN72509687

VENV Installation

See also [docker install](#docker-install)

There are three requirements files

  • requirements_dev.txt # installs all in editable mode from your workspace

  • requirements_production.txt # installs each by tag

  • requirements.txt # installs each from develop branch (for ci / tests)

See ambition/ubuntu.txt for required ubuntu packages

Decide on the user account for the installation. E.g. ambition.

sudo su ambition

create folders

mkdir  ~/.venvs
mkdir -p ~/source/ambition/log/

create VENV

python3 -m venv ~/.venvs/ambition

activate VENV

source ~/.venvs/ambition/bin/activate

update pip

pip install -U pip ipython

clone main project

cd ~/source/ \
&& git clone https://github.com/ambition-trial/ambition.git

change to project folder

cd ~/source/ambition

copy your .env file into the project root

cp /some/path/to/.env ~/source/ambition/.env

install requirements, select the require file. See requirements options above.

   # pip install -r requirements.txt

   pip install -r requirements_production.txt

create database and populate timezone table

   mysql -u <user> -p -Bse 'create database ambition character set utf8;' \
   && mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

migrate database

python manage.py migrate

import required data

python manage.py import_randomization_list \
&& python manage.py import_holidays

check

python manage.py check

Environment variables

Settings variables are store in the environment. See django-environ and 12-factor-django.

Place your .env file in the root of the project.

Logging

If logging through syslog is implemented, you need to configure rsyslog.

   nano /etc/rsyslog.d/30-ambition.conf

add this to the file
   # /etc/rsyslog.d/30-ambition.conf
   local7.*                                             /var/log/ambition.log
   & ~  # This stops local7.* from going anywhere else.

restart rsyslog
   sudo service rsyslog restart

view the log
tail -n 25 -f /var/log/ambition.log

Docker Install

Install Docker Compose.

create a droplet for the host

log into your host and create a user account for the app

useradd ambition
usermod -aG docker ambition
usermod -aG sudo ambition

log out and log back in as user ambition

ssh ambition@example.com

The rest of the steps assume you are logged into your host as user ambition

checkout the main ambition repo into app

cd ~/
git checkout -b develop git https://github.com/ambition-trial/ambition.git app

make a folder on your host for the container volumes

sudo mkdir -p /srv/ambition/

copy or scp your .env file into the app root

cp /some/path/to/.env ~/app/.env

scp .production ambition@example.com:~/app/.env

edit ~/app/.env file as required, for example

from app/ build images for ambition_production and mysql and bring them up

docker-compose -f compose/local.yml build \
&& docker-compose -f compose/local.yml up
docker cp /some/path/to/crypto_keys/ ambition_production:$DJANGO_KEY_FOLDER

Copy the randomization_list.csv file to the container

docker cp /some/path/to/randomization_list.csv ambition_production:$DJANGO_ETC_FOLDER

In another shell, log into the container

docker exec -it ambition_production /bin/bash

run migrations and other management commands as required

python manage.py migrate
python manage.py import_holidays
python manage.py migrate import_randomization_list

While still in the container, run check

python manage.py check

Start runserver

python manage.py runserver 0.0.0.0:8000

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

ambition_edc-0.1.12-py3-none-any.whl (18.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page