Server Documentation¶
Warning
Before making any changes to the experimental servers make sure you check out the experiment calendar so you don’t make changes during someone else’s experiment.
Note
All servers use CentOS, so you use ‘yum’ to install packages.
Note
Example files are hosted under the leeps@ucsc.edu Google Drive account
Experimental Servers¶
econ-leeps-3.ucsc.edu - Runs oTree 3
econ-leeps-4.ucsc.edu - Runs oTree 3
econ-leeps-5.ucsc.edu - Runs oTree 5
ORSEE¶
This stands for Online Recruitment System for Economic Experiments.
This is the website that is used to schedule experiments and invite subjects.
Server Maintenance Contact Information¶
Name: Doug Niven
Email: dniven@ucsc.edu
This is the person that will grant us new servers and SSL certificates.
If Doug is no longer available, contact UCSC ITS directly.
Reverse Proxy Service¶
Note
You need to be the root user to edit the Nginx configuration. You can do this by running ‘sudo -su root’.
Nginx is used for all the experimental servers and the Main Website. I’m not sure about ORSEE.
Nginx is also being used for SSL.
SSL certificates found in /etc/ssl
Nginx config found in /etc/nginx/conf.d
Experimental Server Specifics¶
Required services¶
- PostgreSQL
Make sure you pip3 install psycopg2-binary
- Git
sudo yum install git
- Python 3.7
- Python virtual environment
- Tmux
sudo yum install tmux
Important Commands¶
Note
Tmux allows you to continuously run services even when logging out
tmux - Creates new tmux session
tmux a - Attaches to last tmux session
Ctrl + B + D - Detaches from current tmux session
Ctrl + B + % - Creates new tmux pane
Ctrl + B + (Arrow Key) - Move between tmux panes
Ctrl + B + [ - Allows you to scroll in a tmux window
Service Files¶
Note
Service files allow you to run processes in the background.
Commands to know¶
sudo systemctl start otree.service
sudo systemctl restart otree.service
sudo systemctl stop otree.service
If you would like to see the output of the service file run the command below:
Note
I like to perform the command below in Tmux to show the output is saved even when I logout of the server.
sudo journalctl -f -u otree.service
Adding experiments¶
Warning
Before doing this, ensure that all the data from other experiments have been downloaded. Make sure your project only contains your app, not the entire oTree configuration.
Steps¶
Git pull your project in the oTree folder and add it to settings.py
- Make sure you export the database URL before running the command below
export DATABASE_URL=postgres://postgres:password@localhost/django_db
You can find the specific DATABASE_URL inside one of the service files in /home/leeps
Run ‘otree resetdb’ to add new database columns
Run ‘otree collectstatic’ to cache static files
If the experiment doesn’t show up, run ‘sudo systemctl restart otree.service’