Merge branch 'divite_services'
modified: .env modified: .gitignore modified: Makefile modified: README.md deleted: api/Makefile deleted: certbot/Dockerfile deleted: certbot/scripts/init-certbot.sh modified: docker-compose.yaml new file: easySite/easy-site/README.md new file: easySite/easy-site/build/asset-manifest.json new file: easySite/easy-site/build/index.html new file: easySite/easy-site/build/static/js/main.9a8f7abd.js new file: easySite/easy-site/build/static/js/main.9a8f7abd.js.LICENSE.txt new file: easySite/easy-site/build/static/js/main.9a8f7abd.js.map new file: easySite/easy-site/package-lock.json new file: easySite/easy-site/package.json new file: easySite/easy-site/postcss.config.js new file: easySite/easy-site/public/index.html new file: easySite/easy-site/src/App.css new file: easySite/easy-site/src/App.js new file: easySite/easy-site/src/App.test.js new file: easySite/easy-site/src/contexts/AuthContext.js new file: easySite/easy-site/src/contexts/useAuth.js new file: easySite/easy-site/src/index.css new file: easySite/easy-site/src/index.js new file: easySite/easy-site/src/logo.svg new file: easySite/easy-site/src/pages/AddObject.js new file: easySite/easy-site/src/pages/Dashboard.js new file: easySite/easy-site/src/pages/EditObject.js new file: easySite/easy-site/src/pages/Home.js new file: easySite/easy-site/src/pages/Login.js new file: easySite/easy-site/src/pages/Register.js new file: easySite/easy-site/src/reportWebVitals.js new file: easySite/easy-site/src/setupTests.js new file: easySite/easy-site/tailwind.config.js deleted: nginx/nginx-ssl.conf new file: node_servers/authserver.js new file: node_servers/feedbackserver.js new file: node_servers/techsupportserver.js new file: serv_certbot/certbot/Dockerfile renamed: certbot/config/certbot.ini -> serv_certbot/certbot/config/certbot.ini renamed: certbot/scripts/checkRenewCerts.sh -> serv_certbot/certbot/scripts/checkRenewCerts.sh new file: serv_certbot/certbot/scripts/crontab.txt new file: serv_certbot/certbot/scripts/init-certbot.sh new file: serv_certbot/certbot/scripts/renewEasysite102.sh renamed: certbot/scripts/renewValitovGazizCert.sh -> serv_certbot/certbot/scripts/renewValitovGazizCert.sh renamed: certbot/scripts/renewYalarbaCert.sh -> serv_certbot/certbot/scripts/renewYalarbaCert.sh new file: serv_certbot/docker-compose.yml new file: serv_migration/docker-compose.yml renamed: migrator/Dockerfile -> serv_migration/migrator/Dockerfile renamed: migrator/go.mod -> serv_migration/migrator/go.mod renamed: migrator/go.sum -> serv_migration/migrator/go.sum renamed: migrator/migrations/20240819162009_create_users_table.sql -> serv_migration/migrator/migrations/20240819162009_create_users_table.sql renamed: migrator/migrations/20240825004755_add_column_role_to_users.sql -> serv_migration/migrator/migrations/20240825004755_add_column_role_to_users.sql new file: serv_nginx/docker-compose.yml renamed: nginx/Dockerfile -> serv_nginx/nginx/Dockerfile renamed: nginx/nginx-http.conf -> serv_nginx/nginx/nginx-http.conf new file: serv_nginx/nginx/nginx-ssl.conf renamed: nginx/switch-config.sh -> serv_nginx/nginx/switch-config.sh renamed: api/Dockerfile -> serv_rest_api/api/Dockerfile renamed: api/bin/api.exe -> serv_rest_api/api/bin/api.exe renamed: api/cmd/main.go -> serv_rest_api/api/cmd/main.go renamed: api/go.mod -> serv_rest_api/api/go.mod renamed: api/go.sum -> serv_rest_api/api/go.sum renamed: api/src/configs/APIserver.go -> serv_rest_api/api/src/configs/APIserver.go renamed: api/src/configs/DBconfig.go -> serv_rest_api/api/src/configs/DBconfig.go renamed: api/src/initializers/PGQL_DB.go -> serv_rest_api/api/src/initializers/PGQL_DB.go renamed: api/src/initializers/Routing.go -> serv_rest_api/api/src/initializers/Routing.go renamed: api/src/models/Contacts.go -> serv_rest_api/api/src/models/Contacts.go renamed: api/src/models/Essence.go -> serv_rest_api/api/src/models/Essence.go renamed: api/src/models/Point.go -> serv_rest_api/api/src/models/Point.go renamed: api/src/models/authDataStructs.go -> serv_rest_api/api/src/models/authDataStructs.go renamed: api/src/models/user.go -> serv_rest_api/api/src/models/user.go renamed: api/src/rt/admin/users.go -> serv_rest_api/api/src/rt/admin/users.go renamed: api/src/rt/auth/Login.go -> serv_rest_api/api/src/rt/auth/Login.go renamed: api/src/rt/auth/Registr.go -> serv_rest_api/api/src/rt/auth/Registr.go renamed: api/src/rt/auth/authAdminMiddlware.go -> serv_rest_api/api/src/rt/auth/authAdminMiddlware.go renamed: api/src/rt/auth/authMiddleware.go -> serv_rest_api/api/src/rt/auth/authMiddleware.go renamed: api/src/rt/auth/auth_test.go -> serv_rest_api/api/src/rt/auth/auth_test.go renamed: api/src/rt/prf/AuthUserMiddleWare.go -> serv_rest_api/api/src/rt/prf/AuthUserMiddleWare.go renamed: api/src/rt/prf/profile.go -> serv_rest_api/api/src/rt/prf/profile.go renamed: api/src/rt/srch/search.go -> serv_rest_api/api/src/rt/srch/search.go renamed: api/src/storages/psql/psql.go -> serv_rest_api/api/src/storages/psql/psql.go new file: serv_rest_api/docker-compose.yml new file: serv_spa/docker-compose.yml new file: serv_spa/spa/Dockerfile new file: serv_spa/spa/app/assets/bage_logo.png new file: serv_spa/spa/app/index.html new file: serv_spa/spa/app/styles/mainStyle.css new file: serv_spa/spa/vue/README.md new file: serv_spa/spa/vue/advices.txt
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
FROM certbot/certbot
|
||||
|
||||
# устанавливать cron отдельно не нужно он уже есть в этом image certbot/certbot
|
||||
|
||||
# Создаем директории для конфигов
|
||||
RUN mkdir -p /etc/letsencrypt/config
|
||||
|
||||
# Копируем конфигурационные файлы
|
||||
COPY scripts/ /opt/
|
||||
|
||||
# Устанавливаем права
|
||||
<<<<<<< HEAD:certbot/Dockerfile
|
||||
RUN chmod +x /opt/*
|
||||
=======
|
||||
RUN chmod +x /opt/init-certbot.sh
|
||||
RUN chmod +x /opt/checkRenewCerts.sh
|
||||
RUN chmod +x /opt/renewEasysite102.sh
|
||||
RUN chmod +x /opt/renewValitovGazizCert.sh
|
||||
RUN chmod +x /opt/renewYalarbaCert.sh
|
||||
|
||||
>>>>>>> divite_services:serv_certbot/certbot/Dockerfile
|
||||
|
||||
ENTRYPOINT ["/opt/init-certbot.sh"]
|
||||
@@ -0,0 +1,21 @@
|
||||
# Используем staging сервер для тестов
|
||||
staging = False # Staging True for develops
|
||||
|
||||
# Ваш email
|
||||
email = valitovgaziz@yandex.ru
|
||||
|
||||
# Принимаем условия подписки
|
||||
agree-tos = True
|
||||
|
||||
# Неинтерактивный режим
|
||||
non-interactive = True
|
||||
|
||||
# Домены
|
||||
domains = yalarba.ru,www.yalarba.ru,valitovaziz.ru,www.valitovgaziz.ru,easysite102.ru,www.easysite102.ru
|
||||
|
||||
# Путь для webroot-аутентификации
|
||||
webroot-path = /var/www/certbot
|
||||
|
||||
# Предпочитаемые настройки
|
||||
key-type = ecdsa
|
||||
elliptic-curve = secp384r1
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Функция проверки локального сертификата
|
||||
check_local_cert() {
|
||||
local cert_file=$1
|
||||
local days_to_check=$2
|
||||
|
||||
if [[ ! -f "$cert_file" ]]; then
|
||||
echo "Ошибка: Файл сертификата '$cert_file' не найден."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Получаем дату истечения сертификата
|
||||
expiry_date=$(openssl x509 -in "$cert_file" -noout -dates | grep "notAfter=" | cut -d= -f2)
|
||||
|
||||
if [[ -z "$expiry_date" ]]; then
|
||||
echo "Ошибка: не удалось получить дату истечения сертификата."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Преобразуем дату истечения в UNIX-время
|
||||
expiry_unix=$(date -d "$expiry_date" +%s)
|
||||
|
||||
# Текущая дата в UNIX-времени
|
||||
current_unix=$(date +%s)
|
||||
|
||||
# Вычисляем разницу между текущей датой и датой истечения
|
||||
days_left=$(( ($expiry_unix - $current_unix) / 86400 ))
|
||||
|
||||
if ((days_left <= 0)); then
|
||||
echo "Сертификат '$cert_file' истек!"
|
||||
return 0
|
||||
elif ((days_left <= days_to_check)); then
|
||||
echo "Предупреждение: Сертификат '$cert_file' истекает через $days_left дней."
|
||||
return 0
|
||||
else
|
||||
echo "Сертификат '$cert_file' действителен ещё $days_left дней."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Проверка первого сертификата и запуск соответствующего сценария обновления
|
||||
check_first_cert() {
|
||||
local first_cert="/etc/letsencrypt/live/yalarba.ru/cert.pem"
|
||||
local first_script="/opt/renewYalarbaCert.sh"
|
||||
local warning_days=2
|
||||
|
||||
if check_local_cert "$first_cert" "$warning_days"; then
|
||||
echo "Запускаю обновление первого сертификата..."
|
||||
"$first_script"
|
||||
fi
|
||||
}
|
||||
|
||||
# Проверка второго сертификата и запуск соответствующего сценария обновления
|
||||
check_second_cert() {
|
||||
local second_cert="/etc/letsencrypt/live/valitovgaziz.ru/cert.pem"
|
||||
local second_script="/opt/renewValitovGazizCert.sh"
|
||||
local warning_days=2
|
||||
|
||||
if check_local_cert "$second_cert" "$warning_days"; then
|
||||
echo "Запускаю обновление второго сертификата..."
|
||||
"$second_script"
|
||||
fi
|
||||
}
|
||||
|
||||
# Проверка второго сертификата и запуск соответствующего сценария обновления
|
||||
check_third_cert() {
|
||||
local second_cert="/etc/letsencrypt/live/easysite102.ru/cert.pem"
|
||||
local second_script="/opt/renewValitovGazizCert.sh"
|
||||
local warning_days=2
|
||||
|
||||
if check_local_cert "$second_cert" "$warning_days"; then
|
||||
echo "Запускаю обновление тетьего сертификата..."
|
||||
"$third_script"
|
||||
fi
|
||||
}
|
||||
|
||||
# Основная функция для последовательной проверки обоих сертификатов
|
||||
main() {
|
||||
check_first_cert
|
||||
check_second_cert
|
||||
check_third_cert
|
||||
}
|
||||
|
||||
# Запуск основной функции
|
||||
main
|
||||
@@ -0,0 +1 @@
|
||||
0 0 * * * root /opt/checkRenewCerts.sh > /proc/1/fd/1 2>&1
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Проверяем наличие сертификатов для yalarba.ru
|
||||
if [ ! -d "/etc/letsencrypt/live/${DOMAINS_yalarba}" ]; then
|
||||
echo "Получаем новые сертификаты yalarba ..."
|
||||
certbot certonly --webroot \
|
||||
--config /etc/letsencrypt/config/certbot.ini \
|
||||
-w /var/www/certbot \
|
||||
-d ${DOMAINS_yalarba}
|
||||
fi
|
||||
|
||||
# Проверяем наличие сертификатов для valitovgaziz.ru
|
||||
if [ ! -d "/etc/letsencrypt/live/${DOMAINS_valitovgaziz}" ]; then
|
||||
echo "Получаем новые сертификаты valitovgaziz ..."
|
||||
certbot certonly --webroot \
|
||||
--config /etc/letsencrypt/config/certbot.ini \
|
||||
-w /var/www/certbot \
|
||||
-d ${DOMAINS_valitovgaziz}
|
||||
fi
|
||||
|
||||
# Проверяем наличие сертификатов для easysite102.ru
|
||||
if [ ! -d "/etc/letsencrypt/live/${DOMAINS_easysite102}" ]; then
|
||||
echo "Получаем новые сертификаты easysite102 ..."
|
||||
certbot certonly --webroot \
|
||||
--config /etc/letsencrypt/config/certbot.ini \
|
||||
-w /var/www/certbot \
|
||||
-d ${DOMAINS_easysite102}
|
||||
fi
|
||||
|
||||
set -e # Завершаем работу, если любая команда вернёт ошибку
|
||||
|
||||
# Активируем сервис cron
|
||||
service cron start
|
||||
|
||||
# Копируем нашу собственную crontab таблицу
|
||||
cp /opt/crontab.txt /etc/crontabs/root
|
||||
|
||||
# Оставляем контейнер открытым
|
||||
tail -f /dev/null
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Получаем новые сертификаты..."
|
||||
certbot certonly --webroot \
|
||||
--config /etc/letsencrypt/config/certbot.ini \
|
||||
-w /var/www/certbot \
|
||||
-d ${DOMAINS_easysite102}
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Получаем новые сертификаты..."
|
||||
certbot certonly --webroot \
|
||||
--config /etc/letsencrypt/config/certbot.ini \
|
||||
-w /var/www/certbot \
|
||||
-d ${DOMAINS_valitovgaziz}
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Получаем новые сертификаты..."
|
||||
certbot certonly --webroot \
|
||||
--config /etc/letsencrypt/config/certbot.ini \
|
||||
-w /var/www/certbot \
|
||||
-d ${DOMAINS}
|
||||
@@ -0,0 +1,21 @@
|
||||
services:
|
||||
certbot:
|
||||
build:
|
||||
context: ./certbot
|
||||
dockerfile: Dockerfile
|
||||
container_name: certbot
|
||||
volumes:
|
||||
- ./certbot/config:/etc/letsencrypt/config
|
||||
- certbot_data:/etc/letsencrypt
|
||||
- certbot_www:/var/www/certbot
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- EMAIL=${EMAIL}
|
||||
- DOMAINS=${ALL_DOMAINS}
|
||||
- STAGING=0
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
certbot_data:
|
||||
certbot_www:
|
||||
Reference in New Issue
Block a user