summarylogtreecommitdiffstats
path: root/webvirt-api-git.install
blob: ce488dce528fb96234fa081c020c42b4141ad9da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

dir=/var/lib/webvirt_api

post_install() {
  cd "$dir"
  virtualenv -p python "$dir"/venv
  source "$dir"/venv/bin/activate
  poetry install
  python manage.py migrate
  python manage.py collectstatic --noinput
  chown -R webvirt:webvirt "$dir"

  cat << EOF

A UWSGI configuration is provided at /etc/uwsgi/webvirt_api.ini.

To start the API server:

    $ systemctl start uwsgi@webvirt_api

By default, the API is accessible at http://localhost:9080.

EOF

}

post_upgrade() {
  post_install $1
}
 
op=$1
shift
 
$op $*