This is Django server framework for the ISCAN web application used by the SPADE project.
Documentation for ISCAN, as well as tutorials, can be found at here.
ISCAN server uses Docker. This containerization means that the only dependency the user must install is Docker itself.
- Install Docker for Ubuntu. It is easiest to install using the Install from repository method.
- Complete the post-installation instructions for Docker for Ubuntu. This will make it unnecessary to prepend Docker commands with
sudo
. - Install Docker Compose, the tool for defining and running multi-container Docker applications.
First, clone the iscan-server repository to your machine:
git clone https://github.com/MontrealCorpusTools/iscan-spade-server.git
Included are a Dockerfile
and a docker-compose.yml
. In order to build a Docker image from these files, navigate to the root of the repository and run:
docker-compose build
Then, run:
docker-compose up
This will launch the containers.
If you are intending to develop or make changes to ISCAN itself a few things must be done differently.
First, you must also clone the ISCAN repository in the same directory that you cloned your iscan-server directory.
git clone https://github.com/MontrealCorpusTools/ISCAN.git
So, you will have a directory containing the two repos, ISCAN
and iscan-spade-server
. Then, just cd
into the iscan-spade-server
directory.
To build the image with development support, run the following command.
docker-compose build --build-arg BUILD_ENV="dev"
This will allow you to make changes in the ISCAN repo directory, and have them reflected in the docker installation.
The first time you use iscan-server, you will need to make database migrations. In another terminal, while the containers are up, run:
docker-compose run app init
The needed migrations to perform will be detected and made.
The first time you use iscan-server, you will need to set up a username and password to log in with. In another terminal, while the containers are up, run:
docker-compose run app manage createsuperuser
This will begin a prompt that asks you for a username, email address, and password. Once you have filled them out, the prompt will close.
Then, you should be able to log in with your credentials. You should only need to perform this step once; from now on, whenever you start the server, you should be able to log in with your defined username and password. When finished, press :code:Ctrl+C
to end the current server run.
Certain aspects of the server require changing settings.
Most of the settings are set in /iscan_server/settings/base.py
but it is unlikely you will need to change these.
What you will have to do, however, is edit /iscan_server/settings/local_settings.py
.
There is a template available there by default.
In order to query the server from remote connections, you must change the ALLOWED_HOSTS
parameter in the iscan_server/settings/local_settings.py
to include the hostname of your server.
If you intend on accessing the server from the internet directly(i.e. not only on a closed network), you should also changed the SECRET_KEY
in base.py
.
To start the server and its containers using the Docker image, run:
docker-compose up
In your web browser, navigate to localhost:8080
. You should see the I-SCAN web page.
To stop the server, press Ctrl+C
only once. The terminal should show a Gracefully stopping...
message and then exit.
To run the automatic tests, run:
./runtests.sh
This Docker instance is configured so that the contents of certain directories persist between runs of the server, and so that contents are constant between the local directory and the directory in the container. These local directories, located in the root of the repository, are:
polyglot_source/
- the directory containing corpora to be loaded.polyglot_data/
- the directory where corpus metadata will be storedpgdb/
- the directory where the front-end code is storedpolyglot_server/
- the directory containing the Django project for the server
Changes you make locally in these folders should persist into the container without needing to re-build the Docker image.
The docker-compose up
command usefully regenerates fresh containers each time it is run, but old containers can take up space. To clean up containers on your machine, first stop all of them:
docker-compose stop
Then, remove them:
docker-compose rm