Skip to content

How the server work

Docker Containers

The containers are lightweight linux virtualized instances that run separately, can share ressources (mounted folders, local network, etc) and execute a service. Each container has the role to execute a given service, and Alyx require several services to be up simultaneously and work in concert, to work correctly.

  1. The first container, django_server one is the one that does most of the work, and runs our web application, in python, using the Django package. The source code of the package running there is located is the /src/alyx folder in the folder you cloned from the github repository.

  2. Because Django is a dynamic servig application, it is not meant to serve static files (like images, javascript source code files, css styling files etc..) that don't change whatever the moment and context you access them. For this purpose, we need a static-serving container, nginx_server. This is the actual service that we hit when connecting to alyx with http (port 80 is the standard http port). It's configuration is to serve files (without autherntication required, so take care of what you put in these folders) from the folders in /static and /media that are located in /docker/templates/uploaded. It also proxies requests to the django_server (that is served on port 8000 in the local network betweeen containers), to the port 80, if the url starts with anything else than /static or /media.

  3. We next have the burried core of the system, the PostgreSQL database running container, postgres_db wich is used by django_server internally to access, store, and query subselections of the metadata in a fast way. All the work of creating, deleting, modifying the database tables is handled in python, with django, wich has the role of doing the ORM (for Object Relational Mapping, wich stands for mapping a relational database, like SQL to a set of object oriented data items, like python can be). Such creation and modification of the database through django is called `migration and this is a whole topic in itself, wich you can know more about here.

  4. The last service is rabbitmq which is a fast networked message queue broker. This one is optional, and can be used if you configure a celery based distributed set of workers that Alyx can use to start computer intensive programs remotely on various machines. This is still in early beta. If it fails to launch and you don't intent to use Alyx for this purpose, you should not pay attention to it.