mirror of
https://github.com/deadcxap/init_scripts.git
synced 2026-07-02 05:43:40 +03:00
убрал создание ufw для туеишкв из основного скрипта
This commit is contained in:
@@ -14,6 +14,12 @@ services:
|
|||||||
network_mode: host
|
network_mode: host
|
||||||
depends_on:
|
depends_on:
|
||||||
- remnanode
|
- remnanode
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1/ || exit 1" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 12
|
||||||
|
start_period: 10s
|
||||||
logging:
|
logging:
|
||||||
driver: 'json-file'
|
driver: 'json-file'
|
||||||
options:
|
options:
|
||||||
@@ -35,6 +41,8 @@ services:
|
|||||||
nofile:
|
nofile:
|
||||||
soft: 1048576
|
soft: 1048576
|
||||||
hard: 1048576
|
hard: 1048576
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
logging:
|
logging:
|
||||||
driver: 'json-file'
|
driver: 'json-file'
|
||||||
options:
|
options:
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# ПРОВЕРИТЬ ЧТО ЗАПУСТИТСЯ НЕ ОТ ROOT
|
||||||
|
# ТАК КАК ИНИТ ВЫЗЫВАЕТСЯ КОМАНДОЙ sudo -u "$USERNAME" -H bash "$init_script"
|
||||||
|
|
||||||
# Скрипт инициализации ноды.
|
# Скрипт инициализации ноды.
|
||||||
# 1. Скачивает случайный шаблон сайта и разворачивает его в /var/www/html.
|
# 1. Скачивает случайный шаблон сайта и разворачивает его в /var/www/html.
|
||||||
# 2. Создаёт докер-сеть, указанную в docker-compose.yml.
|
# ПРОПУСТИТЬ 2. Создаёт докер-сеть, указанную в docker-compose.yml.
|
||||||
# 3. Запрашивает необходимые параметры у пользователя и записывает их в .env.
|
# 3. Запрашивает необходимые параметры у пользователя и записывает их в .env.
|
||||||
# 4. Открывает порт панели только для центрального сервера.
|
# 4. Открывает порт панели только для центрального сервера.
|
||||||
# 5. Запускает docker compose.
|
# 5. Запускает docker compose.
|
||||||
|
|||||||
@@ -99,8 +99,6 @@ Usage: $0 --user NAME --sshkey KEY [options]
|
|||||||
-v, --vector URL (optional) URL of Vector sink
|
-v, --vector URL (optional) URL of Vector sink
|
||||||
-r, --role NAME (optional) Role name to bootstrap
|
-r, --role NAME (optional) Role name to bootstrap
|
||||||
-n, --netbird-key KEY (optional) Netbird setup key
|
-n, --netbird-key KEY (optional) Netbird setup key
|
||||||
-i, --netbird-ip IP (optional) Netbird central server IP
|
|
||||||
-p, --netbird-port PORT (optional) Netbird central server port
|
|
||||||
-o, --hostname NAME (optional) Hostname to set on server
|
-o, --hostname NAME (optional) Hostname to set on server
|
||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
@@ -112,14 +110,12 @@ MONITOR_IP=""
|
|||||||
VECTOR_ENDPOINT=""
|
VECTOR_ENDPOINT=""
|
||||||
ROLE=""
|
ROLE=""
|
||||||
NETBIRD_KEY=""
|
NETBIRD_KEY=""
|
||||||
NETBIRD_IP=""
|
|
||||||
NETBIRD_PORT=""
|
|
||||||
HOSTNAME_VALUE=""
|
HOSTNAME_VALUE=""
|
||||||
parse_args() {
|
parse_args() {
|
||||||
local opts
|
local opts
|
||||||
if ! opts=$(getopt \
|
if ! opts=$(getopt \
|
||||||
-o u:k:s:m:v:r:n:i:p:o:h \
|
-o u:k:s:m:v:r:n:i:p:o:h \
|
||||||
--long user:,sshkey:,ssh-ip:,monitor-ip:,vector:,role:,netbird-key:,netbird-ip:,netbird-port:,hostname:,help \
|
--long user:,sshkey:,ssh-ip:,monitor-ip:,vector:,role:,netbird-key:,hostname:,help \
|
||||||
-n "$0" -- "$@"); then
|
-n "$0" -- "$@"); then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -134,8 +130,6 @@ parse_args() {
|
|||||||
-v|--vector) VECTOR_ENDPOINT="$2"; shift 2 ;;
|
-v|--vector) VECTOR_ENDPOINT="$2"; shift 2 ;;
|
||||||
-r|--role) ROLE="$2"; shift 2 ;;
|
-r|--role) ROLE="$2"; shift 2 ;;
|
||||||
-n|--netbird-key) NETBIRD_KEY="$2"; shift 2 ;;
|
-n|--netbird-key) NETBIRD_KEY="$2"; shift 2 ;;
|
||||||
-i|--netbird-ip) NETBIRD_IP="$2"; shift 2 ;;
|
|
||||||
-p|--netbird-port) NETBIRD_PORT="$2"; shift 2 ;;
|
|
||||||
-o|--hostname) HOSTNAME_VALUE="$2"; shift 2 ;;
|
-o|--hostname) HOSTNAME_VALUE="$2"; shift 2 ;;
|
||||||
-h|--help) usage; exit 0 ;;
|
-h|--help) usage; exit 0 ;;
|
||||||
--) shift; break ;;
|
--) shift; break ;;
|
||||||
@@ -238,9 +232,6 @@ configure_ufw() {
|
|||||||
if [[ -n "$MONITOR_IP" ]]; then
|
if [[ -n "$MONITOR_IP" ]]; then
|
||||||
run "Allow Beszel from $MONITOR_IP" ufw allow from "$MONITOR_IP" to any port 45876 proto tcp comment 'Beszel monitoring'
|
run "Allow Beszel from $MONITOR_IP" ufw allow from "$MONITOR_IP" to any port 45876 proto tcp comment 'Beszel monitoring'
|
||||||
fi
|
fi
|
||||||
if [[ -n "$NETBIRD_KEY" && -n "$NETBIRD_IP" && -n "$NETBIRD_PORT" ]]; then
|
|
||||||
run "Allow Netbird central from $NETBIRD_IP:$NETBIRD_PORT" ufw allow from "$NETBIRD_IP" to any port "$NETBIRD_PORT" proto tcp comment 'Netbird central'
|
|
||||||
fi
|
|
||||||
run "Enable UFW" ufw --force enable
|
run "Enable UFW" ufw --force enable
|
||||||
run "Checking UFW active" bash -c "ufw status | grep -q 'Status: active'"
|
run "Checking UFW active" bash -c "ufw status | grep -q 'Status: active'"
|
||||||
run "Checking UFW SSH rule" bash -c "ufw status | grep -q '22/tcp'"
|
run "Checking UFW SSH rule" bash -c "ufw status | grep -q '22/tcp'"
|
||||||
@@ -248,9 +239,6 @@ configure_ufw() {
|
|||||||
if [[ -n "$MONITOR_IP" ]]; then
|
if [[ -n "$MONITOR_IP" ]]; then
|
||||||
run "Checking UFW Beszel rule" bash -c "ufw status | grep -q '45876/tcp'"
|
run "Checking UFW Beszel rule" bash -c "ufw status | grep -q '45876/tcp'"
|
||||||
fi
|
fi
|
||||||
if [[ -n "$NETBIRD_KEY" && -n "$NETBIRD_IP" && -n "$NETBIRD_PORT" ]]; then
|
|
||||||
run "Checking UFW Netbird rule" bash -c "ufw status | grep -q '$NETBIRD_PORT/tcp'"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_docker() {
|
install_docker() {
|
||||||
@@ -432,8 +420,6 @@ setup_role() {
|
|||||||
echo \"WARN: Timed out: containers not Up after \${timeout}s\" >&2
|
echo \"WARN: Timed out: containers not Up after \${timeout}s\" >&2
|
||||||
exit 0
|
exit 0
|
||||||
"
|
"
|
||||||
# run "Checking $service_name stack" bash -c "cd \"$target_dir\" && docker compose ps | grep -q 'Up'"
|
|
||||||
run "Removing init.sh for $service_name" rm -f "$init_script"
|
|
||||||
else
|
else
|
||||||
log "WARN: init.sh not found in $target_dir, skipping"
|
log "WARN: init.sh not found in $target_dir, skipping"
|
||||||
SUMMARY+=("init.sh for $service_name: MISSING")
|
SUMMARY+=("init.sh for $service_name: MISSING")
|
||||||
|
|||||||
Reference in New Issue
Block a user