Skip to content

Commit 795d412

Browse files
committed
Added Jitsi,Elasticsearch.kibana
1 parent 43fc379 commit 795d412

9 files changed

+413
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
RED='\033[1;31m'
4+
NC='\033[0m'
5+
6+
echo -e "${RED}
7+
################################################################################################################
8+
# Your MarketPlace App has been deployed successfully! #
9+
# Passwords are stored under /root/ #
10+
################################################################################################################
11+
${NC}"
12+
13+
echo
14+
echo -e "${RED}This message will be removed in the next login!${NC}"
15+
echo
16+
echo
17+
echo "The elastic user password is $(cat /root/.password)"
18+
echo
19+
echo
20+
echo -e "${RED}You can the elastic search using the command below ${NC}"
21+
echo
22+
echo
23+
echo -e "${RED}curl -u elastic:$(cat /root/.password) -k https://localhost:9200${NC}"
24+
echo
25+
echo
26+
echo -e "${RED}Allow the Port 9200 in the security group to access the Elastic Search${NC}"
27+
28+
29+
30+
#Cleanup script
31+
rm -rf /usr/local/src/
32+
mkdir -p /usr/local/src/
33+
rm -rf /var/lib/cloud/instances/*
34+
rm -rf /var/lib/cloud/data/*
35+
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; >/dev/null 2>&1
36+
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
37+
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp
38+
apt-get -y autoremove >/dev/null 2>&1
39+
apt-get -y autoclean >/dev/null 2>&1
40+
history -c
41+
cat /dev/null > /root/.bash_history
42+
unset HISTFILE
43+
44+
rm -rf /root/.bashrc
45+
cp /etc/skel/.bashrc /root
46+
rm -rf /opt/cloudstack

Elasticsearch-20-04/elasticsearch.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Elasticsearch
3+
sidebar_label: Elasticsearch
4+
---
5+
6+
|**`Version Latest` `OS Ubuntu 20.04` `Monitoring`**| |
7+
|-------------------------------------------------------|--|
8+
9+
### Description
10+
11+
Elasticsearch is an open-source search and analytics engine based on Apache Lucene that is extremely scalable and distributed. It is intended to manage massive amounts of data while also providing rapid and versatile search capabilities for a variety of applications. Elasticsearch, developed by Elastic, has become a critical component in current data-driven projects, allowing users to store, search, and analyse massive volumes of data in near real-time.
12+
13+
### Software Included
14+
15+
Java - 11
16+
Elasticsearch - 8.X
17+
18+
## Allow the Following port in security Groups
19+
20+
Allow the Port 9200 in the security Groups The Port used for all API calls over HTTP. This includes search and aggregations, monitoring and anything else that uses a HTTP request. All client libraries will use this port to talk to Elasticsearch
21+
22+
### Allow the ports on the firewall Elasticsearch
23+
24+
One you have deployed the Elasticsearch on your instance kindly allow the port 9200 The elastic search uses this port to listens for HTTP traffic. Currently we have exposed the elastic serach to globally. So kindly the network host expose this node on the network and configure the cluster nodes and the networks in the file.
25+
26+
~~~
27+
/etc/elasticsearch/elasticsearch.yml
28+
~~~
29+
30+

Elasticsearch-20-04/elasticsearch.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
mkdir -p /usr/local/src/elasticsearch
4+
5+
cd /usr/local/src/elasticsearch && wget https://raw.githubusercontent.com/stackbill/marketplace/main/Elasticsearch-20-04/elasticsearch-cleanup.sh
6+
7+
cd /usr/local/src/elasticsearch && wget https://raw.githubusercontent.com/stackbill/marketplace/main/Elasticsearch-20-04/elasticsearch.yml

Elasticsearch-20-04/elasticsearch.yml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Install and Configure Elasticsearch 8.X on Ubuntu 20.04
2+
# https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb
3+
# https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
4+
5+
- name: Elasticsearch Setup
6+
hosts: localhost
7+
tasks:
8+
9+
#1 - Disable ssh access and restart the ssh service
10+
- name: Restarting sshd
11+
shell: "sed -i 's/#Match User anoncvs/ForceCommand echo Please wait until the installation is completed..../g' /etc/ssh/sshd_config && systemctl restart sshd"
12+
13+
# 2 - Update the system
14+
- name: Updating Packages
15+
ansible.builtin.apt:
16+
update_cache: yes
17+
cache_valid_time: 3600
18+
19+
# 3 - Install Java
20+
- name: Install Java
21+
apt:
22+
name: openjdk-11-jdk
23+
state: present
24+
25+
# 4 - Download and install the public signing key
26+
- name: Download and install the public signing key
27+
shell: wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
28+
29+
30+
# 5 - Install apt-transport-https
31+
- name: Install apt-transport-https
32+
apt:
33+
name: apt-transport-https
34+
state: present
35+
36+
# 6 - Save the repository definition to /etc/apt/sources.list.d/elastic-8.x.list
37+
- name: Save the repository definition to /etc/apt/sources.list.d/elastic-8.x.list
38+
shell: echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
39+
40+
# 7 - Update system cache
41+
- name: Update system cache
42+
ansible.builtin.apt:
43+
update_cache: yes
44+
45+
# 8 - Install Elasticsearch
46+
- name: Install Elasticsearch
47+
apt:
48+
name: elasticsearch
49+
state: present
50+
51+
# 9 - Configure elasticsearch
52+
- name: Configure elasticsearch
53+
lineinfile:
54+
path: /etc/elasticsearch/elasticsearch.yml
55+
regexp: '^#network.host'
56+
line: 'network.host: 0.0.0.0'
57+
state: present
58+
backup: yes
59+
60+
- name: Configure elasticsearch
61+
lineinfile:
62+
path: /etc/elasticsearch/elasticsearch.yml
63+
regexp: '^#http.port'
64+
line: 'http.port: 9200'
65+
state: present
66+
backup: yes
67+
68+
# 10 - Start and enable elasticsearch
69+
- name: Start and enable elasticsearch
70+
ansible.builtin.service:
71+
name: elasticsearch
72+
state: started
73+
enabled: yes
74+
75+
# 11 - Reset the user elastic password and store it in a file
76+
- name: Reset the user elastic password and store it in a file
77+
shell: echo "y" | /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -f 2>/dev/null | awk '/^New value:/{print $NF}' > /root/.password
78+
79+
# 12 - create a cloudstack directory
80+
- name: Creating a directory for shell script
81+
ansible.builtin.file:
82+
path: /opt/Elasticsearch
83+
state: directory
84+
85+
# 13 - copy the shell script from /opt/ to /opt/cloudstack
86+
- name: Copy files for shell script
87+
copy:
88+
src: "{{ item.confsrc }}"
89+
dest: "{{ item.confdest }}"
90+
remote_src: yes
91+
with_items:
92+
- { confsrc: '/usr/local/src/elasticsearch/elasticsearch-cleanup.sh', confdest: '/opt/Elasticsearch'}
93+
94+
# 14 - Add the shell script to .bashrc
95+
- name: Adding a line for shell script
96+
lineinfile:
97+
path: /root/.bashrc
98+
line: "chmod +x /opt/Elasticsearch/elasticsearch-cleanup.sh && /opt/Elasticsearch/elasticsearch-cleanup.sh"
99+
state: present
100+
101+
# 15 - Enable the ssh acess and restart the sshd service
102+
- name: Restarting sshd
103+
shell: "sed -i 's/ForceCommand echo Please wait until the installation is completed..../#Match User anoncvs/g' /etc/ssh/sshd_config && systemctl restart sshd"

JitsiMeet/JitsiMeet-cleanup.sh

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
RED='\033[1;31m'
4+
NC='\033[0m'
5+
6+
echo -e "${RED}
7+
################################################################################################################
8+
# Your MarketPlace App will be deployed Shortly! #
9+
################################################################################################################
10+
${NC}"
11+
12+
echo
13+
echo -e "${RED}This message will be removed in the next login!${NC}"
14+
echo
15+
echo
16+
sleep 5
17+
#To Install The Jistmeet
18+
apt-get -y install jitsi-meet
19+
20+
dom=$(grep -oP 'server_name \K[^;]+' /etc/nginx/sites-enabled/*.conf | head -1)
21+
22+
hostnamectl set-hostname $dom > /dev/null 2>&1
23+
24+
sudo sed -i -e "/127\.0\.0\.1/s/^/# /" -e "/127\.0\.1\.1/s/^/# /" /etc/hosts > /dev/null 2>&1
25+
26+
echo "127.0.0.1 $dom" | sudo tee -a /etc/hosts > /dev/null 2>&1
27+
echo "127.0.1.1 $dom" | sudo tee -a /etc/hosts > /dev/null 2>&1
28+
29+
public_ip=$(curl -s ifconfig.me)
30+
private_ip=$(hostname -I | awk '{print $1}')
31+
32+
echo "org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS= $private_ip" >> /etc/jitsi/videobridge/sip-communicator.properties
33+
echo "org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS= $public_ip" >> /etc/jitsi/videobridge/sip-communicator.properties
34+
35+
sed -i '/server_names_hash_bucket_size/s/^/#/' /etc/nginx/sites-enabled/$dom.conf
36+
37+
certbot --nginx --non-interactive --redirect -d $dom --agree-tos --email admin@$dom
38+
39+
sed -i '/server_names_hash_bucket_size/s/^#//' /etc/nginx/sites-enabled/$dom.conf
40+
41+
systemctl restart prosody
42+
systemctl restart jicofo
43+
systemctl restart jitsi-videobridge2
44+
systemctl restart jitsi-meet-web
45+
46+
#Cleanup script
47+
rm -rf /usr/local/src/
48+
mkdir -p /usr/local/src/
49+
rm -rf /var/lib/cloud/instances/*
50+
rm -rf /var/lib/cloud/data/*
51+
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; >/dev/null 2>&1
52+
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
53+
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp
54+
apt-get -y autoremove >/dev/null 2>&1
55+
apt-get -y autoclean >/dev/null 2>&1
56+
history -c
57+
cat /dev/null > /root/.bash_history
58+
unset HISTFILE
59+
60+
rm -rf /root/.bashrc
61+
cp /etc/skel/.bashrc /root
62+
rm -rf /opt/cloudstack

JitsiMeet/JitsiMeet.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
mkdir -p /usr/local/src/JitsiMeet
4+
5+
cd /usr/local/src/JitsiMeet && wget https://raw.githubusercontent.com/stackbill/marketplace/main/JitsiMeet/JitsiMeet-cleanup.sh
6+
7+
cd /usr/local/src/JitsiMeet && wget https://raw.githubusercontent.com/stackbill/marketplace/main/JitsiMeet/JitsiMeet.yaml

JitsiMeet/JitsiMeet.yaml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Install Jitsi Meet on ubuntu 20.04 and 22.04 based on the official quick install guide
2+
# https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart
3+
4+
- name: Jitsi Setup
5+
hosts: localhost
6+
tasks:
7+
#1 - Disable ssh access and restart the ssh service
8+
- name: Restarting sshd
9+
shell: "sed -i 's/#Match User anoncvs/ForceCommand echo Please wait until the installation is completed..../g' /etc/ssh/sshd_config && systemctl restart sshd"
10+
11+
# 2 - Update the system
12+
- name: Updating Packages
13+
ansible.builtin.apt:
14+
update_cache: yes
15+
16+
# 3 - Install the required packages
17+
- name: Install required packages
18+
ansible.builtin.apt:
19+
name: "{{ packages }}"
20+
state: present
21+
vars:
22+
packages:
23+
- apt-transport-https
24+
- ca-certificates
25+
- curl
26+
- gnupg2
27+
- nginx-full
28+
- wget
29+
- software-properties-common
30+
- certbot
31+
- python3-certbot-nginx
32+
33+
# 4 - Enable the universe repository
34+
- name: enable the universe repository
35+
shell: apt-add-repository universe
36+
37+
# 5 - Update System packages
38+
- name: Updating Packages
39+
ansible.builtin.apt:
40+
update_cache: yes
41+
42+
# 6 - Check if the Os version is 20 or 22
43+
- name: Check if the Os version is 20 or 22
44+
shell: lsb_release -rs
45+
register: os_version
46+
47+
# 7 - If the OS version is ubuntu 20.04 then Add the Prosody package repository
48+
- name: Add the Prosody package repository
49+
shell: |
50+
echo deb http://packages.prosody.im/debian $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list
51+
wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add -
52+
when: os_version.stdout == "20.04"
53+
54+
# 8 - If the OS version is ubuntu 22.04 then Add the Prosody package repository
55+
- name: Add the Prosody package repository
56+
shell: |
57+
echo deb http://packages.prosody.im/debian $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list
58+
wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add -
59+
when: os_version.stdout == "22.04"
60+
61+
# 9 - Add the Jitsi package repository if the OS version is ubuntu 20.04
62+
- name: Add the Jitsi package repository
63+
shell: |
64+
curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg'
65+
echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null
66+
when: os_version.stdout == "20.04"
67+
68+
# 9 - Add the Jitsi package repository if the OS version is ubuntu 22.04
69+
- name: Add the Jitsi package repository
70+
shell: |
71+
curl -sL https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg'
72+
echo "deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/" | sudo tee /etc/apt/sources.list.d/jitsi-stable.list
73+
when: os_version.stdout == "22.04"
74+
75+
# 10 - Update System packages
76+
- name: Updating Packages
77+
ansible.builtin.apt:
78+
update_cache: yes
79+
80+
# 18 - Change the default processes and open files on server
81+
- name: Change the default processes and open files on server
82+
shell: |
83+
echo "DefaultLimitNOFILE=65000" >> /etc/systemd/system.conf
84+
echo "DefaultLimitNPROC=65000" >> /etc/systemd/system.conf
85+
echo "DefaultTasksMax=65000" >> /etc/systemd/system.conf
86+
87+
# 19 - Restart the systemd daemon
88+
- name: Restart the systemd daemon
89+
shell: systemctl daemon-reload
90+
91+
# 7 - create a cloudstack directory
92+
- name: Creating a directory for shell script
93+
ansible.builtin.file:
94+
path: /opt/JitsiMeet
95+
state: directory
96+
97+
# 8 - copy the shell script from /opt/ to /opt/cloudstack
98+
- name: Copy files for shell script
99+
copy:
100+
src: "{{ item.confsrc }}"
101+
dest: "{{ item.confdest }}"
102+
remote_src: yes
103+
with_items:
104+
- { confsrc: '/usr/local/src/JitsiMeet/JitsiMeet-cleanup.sh', confdest: '/opt/JitsiMeet'}
105+
106+
# 9 - Add the shell script to .bashrc
107+
- name: Adding a line for shell script
108+
lineinfile:
109+
path: /root/.bashrc
110+
line: "chmod +x /opt/JitsiMeet/JitsiMeet-cleanup.sh && /opt/JitsiMeet/JitsiMeet-cleanup.sh"
111+
state: present
112+
113+
# 10 - Enable the ssh acess and restart the sshd service
114+
- name: Restarting sshd
115+
shell: "sed -i 's/ForceCommand echo Please wait until the installation is completed..../#Match User anoncvs/g' /etc/ssh/sshd_config && systemctl restart sshd"

0 commit comments

Comments
 (0)