commit 79aea6bf405a1e8e3c85780dd99142212d03e375 Author: Eliezer Croitoru Date: Mon Jan 8 00:30:05 2024 +0200 1 diff --git a/0001-install-deps.sh b/0001-install-deps.sh new file mode 100755 index 0000000..c4faa4a --- /dev/null +++ b/0001-install-deps.sh @@ -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 diff --git a/0010-install-opensearch.sh b/0010-install-opensearch.sh new file mode 100755 index 0000000..4e3bd40 --- /dev/null +++ b/0010-install-opensearch.sh @@ -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 + + + + diff --git a/0015-configure-opensearch.sh b/0015-configure-opensearch.sh new file mode 100755 index 0000000..53e1d06 --- /dev/null +++ b/0015-configure-opensearch.sh @@ -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 + + diff --git a/0019-enable-opensearch.sh b/0019-enable-opensearch.sh new file mode 100755 index 0000000..b2b97c2 --- /dev/null +++ b/0019-enable-opensearch.sh @@ -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 diff --git a/0020-install-mongodb.sh b/0020-install-mongodb.sh new file mode 100755 index 0000000..9432935 --- /dev/null +++ b/0020-install-mongodb.sh @@ -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 diff --git a/0050-install-graylog.sh b/0050-install-graylog.sh new file mode 100755 index 0000000..2083317 --- /dev/null +++ b/0050-install-graylog.sh @@ -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 + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..77e914a --- /dev/null +++ b/Makefile @@ -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