Skip to content

Instantly share code, notes, and snippets.

@jaeko44
Last active June 14, 2023 11:23
Show Gist options
  • Save jaeko44/e4d7337649482bfffac596c990105e82 to your computer and use it in GitHub Desktop.
Save jaeko44/e4d7337649482bfffac596c990105e82 to your computer and use it in GitHub Desktop.
VirtEngine Waldur Installation Script
#!/bin/bash
yum update -y
yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install -y postgresql96-server
/usr/pgsql-9.6/bin/postgresql96-setup initdb
systemctl start postgresql-9.6
systemctl enable postgresql-9.6
su - postgres -c "/usr/pgsql-9.6/bin/createdb -EUTF8 waldur"
su - postgres -c "/usr/pgsql-9.6/bin/createuser waldur"
yum install -y epel-release
yum install -y redis
systemctl start redis
systemctl enable redis
yum install -y https://opennodecloud.com/centos/7/elastic-release.rpm
yum install -y elasticsearch java-1.8.0-openjdk-headless logstash
cat >/etc/logstash/conf.d/input.conf << EOF
input {
tcp {
codec => json
port => 5959
type => "waldur-event"
}
}
EOF
cat >/etc/logstash/conf.d/filter.conf << EOF
filter {
if [type] == "waldur-event" {
json {
source => "message"
}
mutate {
remove_field => ["class", "file", "logger_name", "method", "path", "priority", "thread"]
}
grok {
match => {
"host" => "%{IPORHOST:host}:%{POSINT}"
}
overwrite => ["host"]
}
}
}
EOF
cat >/etc/logstash/conf.d/output.conf << EOF
output {
elasticsearch { }
}
EOF
systemctl start elasticsearch
systemctl enable elasticsearch
systemctl start logstash
systemctl enable logstash
yum install -y centos-release-openstack-pike epel-release
yum install -y http://opennodecloud.com/centos/7/waldur-release.rpm
yum install -y waldur-mastermind
su - waldur -c "waldur migrate --noinput"
systemctl start waldur-celery
systemctl enable waldur-celery
systemctl start waldur-celerybeat
systemctl enable waldur-celerybeat
systemctl start waldur-uwsgi
systemctl enable waldur-uwsgi
cat >/etc/waldur/uwsgi.ini << EOF
[uwsgi]
buffer-size = 8192
chmod-socket = 666
gid = waldur
logto = /var/log/waldur/uwsgi.log
module = waldur_core.server.wsgi:application
plugins = python
processes = 16
socket = /run/waldur/uwsgi/uwsgi.sock
static-map = /static=/usr/share/waldur/static
static-map = /media=/var/lib/waldur/media
uid = waldur
EOF
yum install -y http://opennodecloud.com/centos/7/waldur-release.rpm
yum install -y waldur-homeport
yum install -y epel-release
yum install -y nginx
su - waldur -c "waldur createstaffuser -u virtengine -p SuperVEDeployment2019"
yum install -y bind-utils
yum install -y wget
IP=$(wget http://ipinfo.io/ip -qO -)
echo "your IP is $IP"
IP_T=$(echo $IP | xargs)
cat > /etc/waldur-homeport/config.json << EOF
{
"apiEndpoint": "http://$IP_T/",
"shortPageTitle": "VirtEngine ",
"modePageTitle": "VirtEngine Waldur",
"loginLogo": "login-logo.png",
"poweredByLogo": "powered.png",
"docsLink": "http://docs.waldur.com",
"supportEmail": "[email protected]"
}
EOF
cat > /etc/nginx/conf.d/ve-waldur.conf << EOF
server {
# CHANGEME set the name or IP of a server from where Waldur Homeport is accessed.
server_name $IP_T;
# Waldur API
location / {
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers' 'Accept, Accept-Encoding, Authorization, Content-Type, Origin, User-Agent, X-CSRFToken, X-Requested-With' always;
add_header 'Access-Control-Allow-Methods' 'DELETE, GET, OPTIONS, PATCH, POST, PUT' always;
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Expose-Headers' 'Link, X-Result-Count' always;
include uwsgi_params;
uwsgi_param Host \$host;
uwsgi_param X-Forwarded-For \$proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto \$http_x_forwarded_proto;
uwsgi_param X-Real-IP \$remote_addr;
uwsgi_buffer_size 16k;
uwsgi_buffers 8 32k;
uwsgi_busy_buffers_size 32k;
uwsgi_pass unix:/run/waldur/uwsgi/uwsgi.sock;
}
# Waldur HomePort
location /portal {
alias /usr/share/waldur-homeport;
index index.html;
}
location /portal/scripts/configs/config.json {
alias /etc/waldur-homeport/config.json;
}
location /portal/login-logo.png {
# Make sure to set 'loginLogo' value to 'login-logo.png' in
# /etc/waldur-homeport/config.json -- check Waldur HomePort config
# docs for details.
alias /etc/waldur-homeport/login-logo.png;
}
location /portal/sidebar-logo.png {
# Make sure to set 'sidebarLogo' value to 'sidebar-logo.png' in
# /etc/waldur-homeport/config.json -- check Waldur HomePort config
# docs for details.
alias /etc/waldur-homeport/sidebar-logo.png;
}
location /portal/powered.png {
# Make sure to set 'sidebarLogo' value to 'sidebar-logo.png' in
# /etc/waldur-homeport/config.json -- check Waldur HomePort config
# docs for details.
alias /etc/waldur-homeport/powered.png;
}
}
EOF
LOGO_URL='https://virtengine.com/engine/view/assets/img/logo/logo2.png'
#LOGO_URL_S=''
LOGO_POWERED='https://waldur.com/assets/img/logo-header-color.png'
wget $LOGO_URL -O /etc/waldur-homeport/login-logo.png
#wget $LOGO_URL_S -O /etc/waldur-homeport/sidebar-logo.png
wget $LOGO_POWERED -O /etc/waldur-homeport/powered.png
nginx -t
## if config fails make sure to fix the issue
systemctl start nginx
systemctl enable nginx
### Install openstack
#sudo yum update -y
#sudo yum install -y centos-release-openstack-queens
#sudo yum update -y
#sudo yum install -y openstack-packstack
#sudo packstack --allinone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment