Installation¶
Prerequisites¶
Basically, you only need the current version of the Django web framework together with its prerequisites. Typically, this will be a computer with a Linux operating system, and with Apache and PostgreSQL running on it. However, Django is flexible. Is also runs on a Windows server, and it may be combined with different webservers and database backends. See Django’s own installation guide for more information. Still, in this document, we assume the default setup, which we also strongly recommend: Linux, Apache, PostgreSQL. We deliberately avoid mentioning any particular Linux distribution because we assume that at least their server flavours are similar enough. For what it’s worth, the authors run Ubuntu Server.
JuliaBase requires Python_3.4 or higher.
Mostly, no sophisticated finetuning of the components is necessary because JuliaBase deployments will serve only a few (< 1000) people. In particular, PostgreSQL and Apache can run in default configuration by and large. On the other hand, the computer should be a high-availability system, possibly realized with virtual machines. In our own installation, we manage a three-nines system, i.e. 99.9 % availability. Additionally, regular backups are a must! To set up these things, however, is beyond the scope of this document. Your IT department may turn out to be very helpful with this.
In the following, we’ll show you how to get JuliaBase up and running quickly. While our way is already useful for a production system, you may wish or need to do it in a different way. Thus, consider the following a good starting point for your own configuration.
Linux configuration¶
Additionally to the software that is running on any recent and decent Linux operating system by default anyway, you must install:
Apache2
PostgreSQL (and the Python module “psycopg2” for it)
Redis
matplotlib
reportlab
tzlocal
Python modules for YAML and markdown
Python module “deprecation”
PostgreSQL¶
If you have PostgreSQL and Apache on the same computer, PostgreSQL’s default configuration should work for you. The defaults are quite restrictive, so they can be considered secure. Otherwise, if you need to change something, it is probably in pg_hba.conf (where the user authentication resides) or postgresql.conf (where the general configuration resides), both of which are typically found in /etc/postgresql/version/main/.
Anyway, you create a PostgreSQL user with this:
username@server:~$ sudo -u postgres psql
psql (9.3.4)
Type "help" for help.
postgres=# CREATE USER username WITH PASSWORD 'topsecret' CREATEDB;
CREATE ROLE
postgres=# \q
In this snippet, you have to replace username
with your UNIX user name, and
topsecret
with a proper password, which shouldn’t be your UNIX login
password. Finally, create the database with:
username@server:~$ createdb juliabase
Django¶
A certain version of JuliaBase works only with a certain version of Django. For the JuliaBase 1.0 release, this is Django 1.7. For the current Git source code, it is Django 4.0. Install it according to Django’s own instructions. No further configuration is necessary.
JuliaBase¶
Download the latest public release of JuliaBase. Moreover, JuliaBase’s source code is hosted in a public Git repository on GitHub. So if you want to use the cutting-edge JuliaBase (which probably is less reliable than the latest release), you can clone it locally with
username@server:~$ git clone https://github.com/juliabase/juliabase.git
In any case, the JuliaBase source code contains three Django apps:
jb_common
samples
institute
“jb_common” implements the basic JuliaBase functionality. On top of that, “samples” implements the actual samples database. And on top of that, “institute” implements code that is specific to the specific institution or department or work group that wants to use JuliaBase. “institute” implements a generic institute. You will replace “institute” with your own app.
While the naked Git repo is suitable to get JuliaBase up and running quickly, in the section “Organizing your source code”, we’ll explain the directory structure that you should use if you plan to actually using JuliaBase.
Apache¶
Add to your Apache configuration something like the following:
<VirtualHost *:80>
ServerName juliabase.example.com
WSGIScriptAlias / /home/username/myproject/mysite/wsgi.py
Alias /static /var/www/juliabase/static
<Directory /home/username/myproject/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
This snippet contains several parts that highly probably need to be adjusted by
you, in particular juliabase.example.com
, username
, and all paths in
general. But this should be obvious. The proper place for it depends on your
Linux variant. It may be the (new) file /etc/apache2/httpd.conf
, or a new
file in /etc/apache2/conf.d
, or a new file in
/etc/apache2/sites-available
with a symlink in
/etc/apache2/sites-enabled
.
Moreover, you may need to set the locale environment variables for the Apache
process. On Ubuntu, all that it needed to be done is to comment out the line
“. /etc/default/locale
” in the file /etc/apache2/envvars
. However,
this sets the locale also for non-JuliaBase applications which are served by
the same Apache instance. To have more fine-grained control, you can use
mod_wsgi in daemon mode.