Skip to content
Snippets Groups Projects
Commit 8cd463d9 authored by Gallenkamp, Fabian's avatar Gallenkamp, Fabian
Browse files

Updated README.md with more detailed instructions.

parent 16a319ba
No related branches found
No related tags found
No related merge requests found
# ansible script to setup otree instances
# ansible script to setup multiple [otree](https://otree.readthedocs.io/en/latest/) instances with gninx reverse proxy and supervisor
## preparation
### place ssl/tls certificates and key-file (unfortunately not scriptable)
### place ssl/tls certificates and key-file (unfortunately not scriptable due to security best-practices)
1. Use ``scp mycert.crt user@host:/home/user/`` and ``scp mycert.key user@host:/home/user/`` or use [WinSCP](https://de.wikipedia.org/wiki/WinSCP) to copy over the certificate files.
2. Establish a ssh connection onto your server.
3. Then move the certificate files into place:
``sudo mv /home/user/mycert.crt /etc/ssl/certs/``
``sudo mv /home/user/mycert.key /etc/ssl/private/``
4. And set the permissions correctly:
``sudo chown root:root /etc/ssl/certs/mycert.crt /etc/ssl/private/mycert.key``
``sudo chmod 644 /etc/ssl/certs/mycert.crt``
``sudo chmod 600 /etc/ssl/private/mycert.key``
### install ansible and clone this project on your server
1. Establish a ssh connection onto your server.
2. And install git and ansible:
``sudo apt update``
### install ansible and clone this project
``sudo apt install ansible git``
``git clone https://gitlab.rrz.uni-hamburg.de/bax1489/otree-ansible.git``
3. Then clone this ansible project:
``git clone https://gitlab.rrz.uni-hamburg.de/bax1489/otree-ansible.git ~/otree-ansible/``
### configure playbook
Adapt your ``group_vars/otree_servers.yml`` from the provided example accordingly:
1. Copy the example config ``cp ~/otree-ansible/group_vars/otree_servers.yml.example ~/otree-ansible/group_vars/otree_servers.yml``
2. Adapt your (inventory-)config with ``nano ~/otree-ansible/group_vars/otree_servers.yml`` from the provided example accordingly (press "Strg-x", then "j" to save):
```
otree_master: "otree1"
# which otree instance should be delivered as default
otree_domain: "otree.company.org"
# fqdn of the otree server
otree_group_name: "otreeusers"
# linux group for the otree users
otree_users:
# list of users for the available otree instances
otree1:
# linux username
override: yes
# should an existing otree environment be overriden
pre_release: no
# should the pre-release version of otree be installed
redis: "redis://localhost:6379/1"
# redis queue. Note don't use a slot twice, there are 16 slots available (0-15)
database: "sqlite:////home/otree1/db.sqlite3"
# which database should be used. Examples: "postgres://USER:PASSWORD@HOST:PORT/NAME" or "sqlite:////home/user/db.sqlite3"
admin_pw: "mysecretpw1"
# otree admin password
auth_level: "STUDY"
# auth level, possible values: "STUDY", "DEMO"
secret_key: "safaho9awefzuwf"
# django secret key, use differet in different instances
production: "1"
# LOG-LEVEL, set to None ("production: ") to enable further debug messages.
port: 8005
# port which is used by this instance
```
### (optional) upload otree project
If no git-repository with your otree project is provided, you can place a copy in ``files/<otree_username>/``.
1. If no git-repository with your otree project is provided, you can place a copy of the project files (with scp) in ``files/<otree_username>/``.
And now run the playbook.
## change the configuration
Adapt ``group_vars/otree_servers.yml`` and run the playbook again
1. Adapt your inventory-config again with ``nano ~/otree-ansible/group_vars/otree_servers.yml`` and run the playbook.
## run the playbook
Run ``ansible-playbook site.yml``.
\ No newline at end of file
1. Change directory: ``cd ~/otree-ansible/``
2. Run: ``ansible-playbook site.yml``
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment