mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 12:04:15 +00:00
commit
f1a9444f24
2 changed files with 135 additions and 10 deletions
85
conf/nginx/uos_eagle_nginx.conf
Normal file
85
conf/nginx/uos_eagle_nginx.conf
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
user www-data;
|
||||||
|
worker_processes auto;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
include /etc/nginx/modules-enabled/*.conf;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 768;
|
||||||
|
# multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
|
||||||
|
##
|
||||||
|
# Basic Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
# server_tokens off;
|
||||||
|
|
||||||
|
# server_names_hash_bucket_size 64;
|
||||||
|
# server_name_in_redirect off;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
##
|
||||||
|
# SSL Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Logging Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Gzip Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
|
||||||
|
# gzip_vary on;
|
||||||
|
# gzip_proxied any;
|
||||||
|
# gzip_comp_level 6;
|
||||||
|
# gzip_buffers 16 8k;
|
||||||
|
# gzip_http_version 1.1;
|
||||||
|
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Virtual Host Configs
|
||||||
|
##
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
include /etc/nginx/sites-enabled/*;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#mail {
|
||||||
|
# # See sample authentication script at:
|
||||||
|
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
||||||
|
#
|
||||||
|
# # auth_http localhost/auth.php;
|
||||||
|
# # pop3_capabilities "TOP" "USER";
|
||||||
|
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
||||||
|
#
|
||||||
|
# server {
|
||||||
|
# listen localhost:110;
|
||||||
|
# protocol pop3;
|
||||||
|
# proxy on;
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# server {
|
||||||
|
# listen localhost:143;
|
||||||
|
# protocol imap;
|
||||||
|
# proxy on;
|
||||||
|
# }
|
||||||
|
#}
|
|
@ -119,7 +119,7 @@ install_packages () {
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
;;
|
;;
|
||||||
fedora|uos|openEuler)
|
fedora|openEuler)
|
||||||
for p in $PACKAGES; do
|
for p in $PACKAGES; do
|
||||||
if dnf list installed "$p" >/dev/null 2>&1; then
|
if dnf list installed "$p" >/dev/null 2>&1; then
|
||||||
echo " * $p already installed"
|
echo " * $p already installed"
|
||||||
|
@ -129,6 +129,24 @@ install_packages () {
|
||||||
fi
|
fi
|
||||||
done;
|
done;
|
||||||
;;
|
;;
|
||||||
|
uos)
|
||||||
|
if test "${codename}" == "eagle"; then
|
||||||
|
check_package_cmd=("dpkg" "-s")
|
||||||
|
install_package_cmd="apt-get install -y"
|
||||||
|
else
|
||||||
|
check_package_cmd=("dnf" "list" "installed")
|
||||||
|
install_package_cmd="dnf -y install"
|
||||||
|
fi
|
||||||
|
for p in $PACKAGES; do
|
||||||
|
# shellcheck disable=SC2048
|
||||||
|
if ${check_package_cmd[*]} "$p" >/dev/null 2>&1; then
|
||||||
|
echo " * $p already installed"
|
||||||
|
else
|
||||||
|
echo " * Installing $p"
|
||||||
|
log "${install_package_cmd} $p"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +160,12 @@ configure_nginx () {
|
||||||
chown -R "$nginx_group":"$nginx_group" /var/lib/nginx
|
chown -R "$nginx_group":"$nginx_group" /var/lib/nginx
|
||||||
# Copy new configuration and webvirtcloud.conf
|
# Copy new configuration and webvirtcloud.conf
|
||||||
echo " * Copying Nginx configuration"
|
echo " * Copying Nginx configuration"
|
||||||
cp "$APP_PATH"/conf/nginx/"$distro"_nginx.conf /etc/nginx/nginx.conf
|
local nginx_template_conf
|
||||||
|
nginx_template_conf="${APP_PATH}/conf/nginx/${distro}_${codename}_nginx.conf"
|
||||||
|
if ! test -f "${nginx_template_conf}"; then
|
||||||
|
nginx_template_conf="${APP_PATH}/conf/nginx/${distro}_nginx.conf"
|
||||||
|
fi
|
||||||
|
cp "${nginx_template_conf}" /etc/nginx/nginx.conf
|
||||||
cp "$APP_PATH"/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
|
cp "$APP_PATH"/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
if [ -n "$fqdn" ]; then
|
if [ -n "$fqdn" ]; then
|
||||||
|
@ -166,7 +189,8 @@ configure_supervisor () {
|
||||||
create_user () {
|
create_user () {
|
||||||
echo "* Creating webvirtcloud user."
|
echo "* Creating webvirtcloud user."
|
||||||
|
|
||||||
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] ; then
|
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] ||
|
||||||
|
[[ "$distro" == "uos" && "$codename" == "eagle" ]]; then
|
||||||
adduser --quiet --disabled-password --gecos '""' "$APP_USER"
|
adduser --quiet --disabled-password --gecos '""' "$APP_USER"
|
||||||
else
|
else
|
||||||
adduser "$APP_USER"
|
adduser "$APP_USER"
|
||||||
|
@ -242,7 +266,7 @@ install_webvirtcloud () {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_firewall () {
|
set_firewall () {
|
||||||
if [ "$(firewall-cmd --state)" == "running" ]; then
|
if test -n "$(command -v firewall-cmd)" && test "$(firewall-cmd --state)" == "running"; then
|
||||||
echo "* Configuring firewall to allow HTTP & novnc traffic."
|
echo "* Configuring firewall to allow HTTP & novnc traffic."
|
||||||
log "firewall-cmd --zone=public --add-port=http/tcp --permanent"
|
log "firewall-cmd --zone=public --add-port=http/tcp --permanent"
|
||||||
log "firewall-cmd --zone=public --add-port=$novncd_port/tcp --permanent"
|
log "firewall-cmd --zone=public --add-port=$novncd_port/tcp --permanent"
|
||||||
|
@ -344,13 +368,25 @@ case $distro in
|
||||||
supervisor_file_name=webvirtcloud.ini
|
supervisor_file_name=webvirtcloud.ini
|
||||||
;;
|
;;
|
||||||
*Uos*|*uos*)
|
*Uos*|*uos*)
|
||||||
echo " The installer has detected $distro version $version."
|
# codename may be fuyu, kongzi, eagle or empty string.
|
||||||
|
output_expand=""
|
||||||
|
if test -n "${codename}"; then
|
||||||
|
output_expand=" codename ${codename}"
|
||||||
|
fi
|
||||||
|
echo " The installer has detected $distro version $version${output_expand}."
|
||||||
distro=uos
|
distro=uos
|
||||||
nginx_group=nginx
|
|
||||||
nginxfile=/etc/nginx/conf.d/$APP_NAME.conf
|
nginxfile=/etc/nginx/conf.d/$APP_NAME.conf
|
||||||
supervisor_service=supervisord
|
if test "${codename}" == "eagle"; then
|
||||||
supervisor_conf_path=/etc/supervisord.d
|
nginx_group=www-data
|
||||||
supervisor_file_name=webvirtcloud.ini
|
supervisor_service=supervisor
|
||||||
|
supervisor_conf_path=/etc/supervisor/conf.d
|
||||||
|
supervisor_file_name=webvirtcloud.conf
|
||||||
|
else
|
||||||
|
nginx_group=nginx
|
||||||
|
supervisor_service=supervisord
|
||||||
|
supervisor_conf_path=/etc/supervisord.d
|
||||||
|
supervisor_file_name=webvirtcloud.ini
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*OpenEuler*|*openEuler*)
|
*OpenEuler*|*openEuler*)
|
||||||
echo " The installer has detected $distro version $version."
|
echo " The installer has detected $distro version $version."
|
||||||
|
@ -513,7 +549,11 @@ case $distro in
|
||||||
tzone=\'$(timedatectl|grep "Time zone"| awk '{print $3}')\'
|
tzone=\'$(timedatectl|grep "Time zone"| awk '{print $3}')\'
|
||||||
|
|
||||||
echo "* Installing OS requirements."
|
echo "* Installing OS requirements."
|
||||||
PACKAGES="git python3-virtualenv python3-devel python3-pip libvirt-devel glibc gcc nginx supervisor python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5"
|
if test "${codename}" == "eagle"; then
|
||||||
|
PACKAGES="git virtualenv python3-virtualenv python3-dev python3-lxml libvirt-dev zlib1g-dev libxslt1-dev nginx supervisor libsasl2-modules gcc pkg-config python3-guestfs uuid"
|
||||||
|
else
|
||||||
|
PACKAGES="git python3-virtualenv python3-devel python3-pip libvirt-devel glibc gcc nginx supervisor python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5"
|
||||||
|
fi
|
||||||
install_packages
|
install_packages
|
||||||
|
|
||||||
set_hosts
|
set_hosts
|
||||||
|
|
Loading…
Reference in a new issue