Select Git revision
Gallenkamp, Fabian authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 3.04 KiB
- ansible script to setup multiple otree instances with gninx reverse proxy and supervisor
- preparation
- place ssl/tls certificates and key-file (unfortunately not scriptable due to security best-practices)
- install ansible and clone this project on your server
- configure playbook
- (optional) upload otree project
- change the configuration
- run the playbook
otree instances with gninx reverse proxy and supervisor
ansible script to setup multiplepreparation
place ssl/tls certificates and key-file (unfortunately not scriptable due to security best-practices)
- Use
scp mycert.crt user@host:/home/user/
andscp mycert.key user@host:/home/user/
or use WinSCP to copy over the certificate files. - Establish a ssh connection onto your server.
- 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/
- 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
- Establish a ssh connection onto your server.
- And install git and ansible:
sudo apt update
sudo apt install ansible git
- Then clone this ansible project:
git clone https://gitlab.rrz.uni-hamburg.de/bax1489/otree-ansible.git ~/otree-ansible/
configure playbook
-
Copy the example config
cp ~/otree-ansible/group_vars/otree_servers.yml.example ~/otree-ansible/group_vars/otree_servers.yml
-
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):
# which otree instance should be delivered as default
otree_master: "otree1"
# fqdn of the otree server
otree_domain: "otree.company.org"
# linux group for the otree users
otree_group_name: "otreeusers"
# dict of users for the available otree instances
otree_users:
# linux username
otree1:
# should an existing otree environment be overriden
override: yes
# redis queue. Note don't use a slot twice, there are 16 slots available (0-15)
redis: "redis://localhost:6379/1"
# which database should be used. Examples: "postgres://USER:PASSWORD@HOST:PORT/NAME" or "sqlite:////home/user/db.sqlite3"
database: "sqlite:////home/otree1/db.sqlite3"
# otree admin password
admin_pw: "mysecretpw1"
# auth level, possible values: "STUDY", "DEMO"
auth_level: "STUDY"
# django secret key, use differet in different instances
secret_key: "safaho9awefzuwf"
# LOG-LEVEL, set to None ("production: ") to enable further debug messages.
production: "1"
# port which is used by this instance
port: 8005
# python binary used for otree installation
python_binary_path: "/usr/bin/python3.7"
(optional) upload otree project
- 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 your inventory-config again with
nano ~/otree-ansible/group_vars/otree_servers.yml
and run the playbook.
run the playbook
- Change directory:
cd ~/otree-ansible/
- Run:
ansible-playbook site.yml