summaryrefslogtreecommitdiff
path: root/devstack/lib/wsgi
blob: 7ef489893b6bb931d299c9d2e19f0771fa15a8b0 (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
36
37
38
function designate_configure_uwsgi {
    write_uwsgi_config "$DESIGNATE_UWSGI_CONF" "$DESIGNATE_UWSGI" "/dns"

    # We are using the http transport to work around an issue with
    # broken connections when using the uwsgi protocol of a local socket
    # See bug: https://github.com/unbit/uwsgi/issues/2368
    enable_apache_mod proxy
    enable_apache_mod proxy_http
    wsgi_conf=$(apache_site_config_for designate-api-wsgi)
    echo 'ProxyPass "/dns" "http://127.0.0.1:60053" retry=0' | sudo tee $wsgi_conf

    iniset $DESIGNATE_UWSGI_CONF uwsgi http-socket 127.0.0.1:60053
}

function designate_configure_mod_wsgi {
    local designate_api_apache_conf
    local venv_path=""
    local designate_bin_dir=""
    designate_bin_dir=$(get_python_exec_prefix)
    designate_api_apache_conf=$(apache_site_config_for designate-api)

    if [[ ${USE_VENV} = True ]]; then
        venv_path="python-path=${PROJECT_VENV["designate"]}/lib/$(python_version)/site-packages"
        designate_bin_dir=${PROJECT_VENV["designate"]}/bin
    fi

    sudo cp $DESIGNATE_DIR/devstack/files/apache-designate-api.template $designate_api_apache_conf
    sudo sed -e "
        s|%APACHE_NAME%|$APACHE_NAME|g;
        s|%DESIGNATE_BIN_DIR%|$designate_bin_dir|g;
        s|%SSLENGINE%|$designate_ssl|g;
        s|%SSLCERTFILE%|$designate_certfile|g;
        s|%SSLKEYFILE%|$designate_keyfile|g;
        s|%USER%|$STACK_USER|g;
        s|%VIRTUALENV%|$venv_path|g;
        s|%APIWORKERS%|$API_WORKERS|g;
    " -i $designate_api_apache_conf
}