This commit is contained in:
Eliezer Croitoru 2024-01-08 00:30:05 +02:00
commit 79aea6bf40
7 changed files with 98 additions and 0 deletions

6
0001-install-deps.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
apt update
apt install -y wget apt-transport-https gnupg2 software-properties-common
apt install -y vim apt-transport-https uuid-runtime pwgen curl dirmngr

12
0010-install-opensearch.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
wget "https://artifacts.opensearch.org/publickeys/opensearch.pgp" -O "opensearch.pgp"
cat "opensearch.pgp"| gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring
echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee /etc/apt/sources.list.d/opensearch-2.x.list
apt update && apt install opensearch -y

34
0015-configure-opensearch.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
CONFIG_FILE="/etc/opensearch/opensearch.yml"
grep 'discovery.type: single-node' "${CONFIG_FILE}" || \
echo "discovery.type: single-node" >> "${CONFIG_FILE}"
sed -i -e "s@^#cluster.name:.*@cluster.name: graylog@g" \
-e "s@^cluster.name:.*@cluster.name: graylog@g" \
-e "s@^#node.name:.*@node.name: ${HOSTNAME}@g" \
-e "s@^node.name:.*@node.name: ${HOSTNAME}@g" \
-e "s@^#path.data:.*@path.data: /var/lib/opensearch@g" \
-e "s@^path.data:.*@path.data: /var/lib/opensearch@g" \
-e "s@^#path.log:.*@path.log: /var/log/opensearch@g" \
-e "s@^path.log:.*@path.log: /var/log/opensearch@g" \
-e "s@^#discovery.type:.*@discovery.type: single-node@g" \
-e "s@^discovery.type:.*@discovery.type: single-node@g" \
-e "s@^#network.host:.*@network.host: 0.0.0.0@g" \
-e "s@^network.host:.*@network.host: 0.0.0.0@g" \
-e "s@^#action.auto_create_index:.*@action.auto_create_index: false@g" \
-e "s@^action.auto_create_index:.*@action.auto_create_index: false@g" \
-e "s@^#plugins.security.disabled:.*@plugins.security.disabled: true@g" \
-e "s@^plugins.security.disabled:.*@plugins.security.disabled: true@g" \
"${CONFIG_FILE}"
sed -i -e "s@^\-Xms1g@-Xms4g@g" \
-e "s@^\-Xmx1g@-Xmx4g@g" \
"/etc/opensearch/jvm.options"
echo 'vm.max_map_count=262144' > /etc/sysctl.conf.d/010-opensearch.conf
sysctl --system

6
0019-enable-opensearch.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
systemctl daemon-reload
systemctl enable opensearch.service
systemctl start opensearch.service
systemctl status opensearch.service --no-pager

12
0020-install-mongodb.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
wget "https://www.mongodb.org/static/pgp/server-6.0.asc"
cat "server-6.0.asc" | gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-6.gpg
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | \
tee /etc/apt/sources.list.d/mongodb-org-6.0.list
apt update && apt install mongodb-org -y
systemctl start mongod
systemctl enable mongod

10
0050-install-graylog.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
wget "https://packages.graylog2.org/repo/packages/graylog-5.2-repository_latest.deb" \
-O "graylog-5.2-repository_latest.deb"
apt install -y ./graylog-5.2-repository_latest.deb
apt update
apt install graylog-server -y

18
Makefile Normal file
View File

@ -0,0 +1,18 @@
all:
echo OK
install-deps:
bash 0001-install-deps.sh
install-opensearch:
bash 0010-install-opensearch.sh
configure-opensearch:
bash 0015-configure-opensearch.sh
bash 0019-enable-opensearch.sh
install-mongodb:
bash 0020-install-mongodb.sh
install-graylog:
bash 0050-install-graylog.sh