Script for Autoscaling JVB

I have used your method and works great but I only use it like this: sed -i -e “s/bncwiebn-jdnxuw-etc/$(uuidgen)/g” /etc/jitsi/videobridge/sip-communicator.properties. I put this script in start-up of the jvb’s and then restart the videobridge to have a fully functional jvb server created when autoscaling create a new one. I have a question, anyone have experience setting up octo? I have searched a lot, but when I make modifications to Jicofo jitsi-meet crashes. I don’t know why.

AutoScaling Discussion in relation to AWS EC2 Instances
-In AWS AutoScaling => We should use Step Policy vs Target Tracking Policy in Autoscaling ?? …As Simple AutoScaling will soon deprecate.

-Scale Out (What is the Maximum Network load which crosses then it should Scale Out …I am applying Network In towards JVB)

-Scale In (What is the minimum Network load which lowers then it Scale In…This also applying Network In toward JVB) but using SQS & Graceful Shutdown

It would really depend on the bandwidth each of your EC2 can handle i.e. c5n.metal instances can handle up to 100Gbps. I think this might be helpful https://youtu.be/Jj8a6ZRgehI?t=278.

Hello @emrah how to use this? Where I put? I want autsocale AWS are name new JVB like so - JVB1 JVB2. How I do? Where I put this scripts?

The locations are in the path

/etc/systemd/system/jvb-config.service /etc/systemd/system/

/usr/local/sbin/jvb-config /usr/local/sbin/

then set the execute permission

chmod 755 /usr/local/sbin/jvb-config

@emrah thank you. I create them for new files for the locationz? But how AWS are know this locationz? And how I put so he make new JVB like so - JVB1 JVB2 JVB3?

This is not AWS dependant solution and nothing to do with AWS services. jvb-config.service is a systemd service, starts before the Jitsi Videobridge service and changes the JVB config.

The triggered script (jvb-config) finds the JVB external IP and set it as server-id

O so he use IP for name. Mmm I need find how he use jvb for name insted. I need find way are make it so he make name jvb with number and number go up like 1, 2, 3

Add the following location block to the Nginx site config on JMS

    # colibri (JVB) websockets for additional JVBs
    location ~ ^/colibri-ws/([0-9.]*)/(.*) {
        proxy_pass http://$1:9090/colibri-ws/$1/$2$is_args$args;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        tcp_nodelay on;
    }

@emrah thank you very much. What this are do?

It’s needed the clients to communicate through websocket with additional JVBs

I no understand. So if no put this the new jvb no work? I make many jvb myself I no put this change and it are work. Is just now I want AWS are make new jvb auto for me. So why I put this code?

Can you pleaze instruk me how to do? I want make autoscale AWS and make script give new jvb name like jvb1 jvb2 etc. How I do?

Just tell the script to change the MUC_NICKNAME of each JVB to a different value. You can use an uuid (for example the output of the command “uuidgen”) or the IP address or the instance-id in AWS - anything that is unique and won’t be duplicated inside your platform.

So it can be any of the following:

uuid=`uuidgen`
publicip=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
localip=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
instanceid=`curl -s http://169.254.169.254/latest/meta-data/instance-id`

I find the public IP convenient in the way that when you see it in the logs, you can just select it and middle-click it after an ssh command to login to that server. But it’s all minor details, you can do it however it suits you best.

1 Like

@yasen thank you too much. So I put like this for /etc/rc.local?

sed -i -e “s/MUC_NICKNAME=.*/MUC_NICKNAME=curl -s http://169.254.169.254/latest/meta-data/instance-id/” /etc/jitsi/videobridge/sip-communicator.properties

Is possible to put like this one (to show jvb in front ID)?

sed -i -e “s/MUC_NICKNAME=.*/MUC_NICKNAME=jvb + curl -s http://169.254.169.254/latest/meta-data/instance-id/” /etc/jitsi/videobridge/sip-communicator.properties

Do it this way:

instanceid=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
sed -i -e "s/MUC_NICKNAME=.*/MUC_NICKNAME=jvb$instanceid/" /etc/jitsi/videobridge/sip-communicator.properties

This will make the nickname like this: “jvbi-1234567890abcdef0”

You can add a + or a dash (for example) after “jvb” – jvb+$instanceid will result in “jvb+i-1234567890abcdef0”, etc.

Take care of the syntax, the quotes and special characters.

Yes, this can go to /etc/rc.local (if you don’t have the file, create it and make it executable.

Add an “/etc/init.d/jitsi-videobridge2 restart” at the end of the file, so that the changed config goes live.

2 Likes

@yasen I too appreciate, you are wonderful mister. Thank you!
So after I put that code then i put last line like this inside etc/rc.local?

/etc/init.d/jitsi-videobridge2 restart

Another thing, where this IP are come from? 169.254.169.254

Exactly. The rc.local is executed on boot time, so it will reconfigure the server when it is provisioned. (It will also reconfigure it again if you restart the instance, but it won’t break anything.) And just to be sure the JVB is (re)started with the new config, just type this restart after you reconfigure it in rc.local.

The IP 169.254.169.254 is an internal one in AWS cloud, it’s an API endpoint for such queries from inside the instance itself. When you call this endpoint from the instance, it gives you info about the instance itself.

2 Likes

@yasen Thank you kind mister. I appreciate too much.

@yasen wait, sorry I bother you one last queston. If I want do graceful shutdown for instance AWS where I put the script graceful_shutdown.sh?