mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Merge remote changes and resolve conflicts
This commit is contained in:
@@ -39,7 +39,7 @@ services:
|
|||||||
- certbot-etc:/etc/letsencrypt
|
- certbot-etc:/etc/letsencrypt
|
||||||
- certbot-var:/var/lib/letsencrypt
|
- certbot-var:/var/lib/letsencrypt
|
||||||
- webroot:/var/www/html
|
- webroot:/var/www/html
|
||||||
command: certonly --webroot --webroot-path=/var/www/html --email admin@itformhelp.ru --agree-tos --no-eff-email --force-renewal -d itformhelp.ru -d www.itformhelp.ru
|
command: certonly --webroot --webroot-path=/var/www/html --email admin@itformhelp.ru --agree-tos --no-eff-email --staging -d itformhelp.ru -d www.itformhelp.ru
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
sqlite_data:
|
sqlite_data:
|
||||||
|
@@ -1,47 +1,44 @@
|
|||||||
|
# HTTP server for ACME challenge
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name itformhelp.ru www.itformhelp.ru;
|
server_name itformhelp.ru www.itformhelp.ru;
|
||||||
|
|
||||||
root /var/www/html;
|
# Allow only ACME challenge and redirect everything else to HTTPS
|
||||||
|
|
||||||
location ^~ /.well-known/acme-challenge/ {
|
location ^~ /.well-known/acme-challenge/ {
|
||||||
allow all;
|
|
||||||
default_type "text/plain";
|
default_type "text/plain";
|
||||||
try_files $uri =404;
|
root /var/www/html;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$server_name$request_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
# HTTPS server (commented out until we have certificates)
|
||||||
listen 443 ssl http2 default_server;
|
#server {
|
||||||
listen [::]:443 ssl http2 default_server;
|
# listen 443 ssl http2;
|
||||||
server_name itformhelp.ru www.itformhelp.ru;
|
# listen [::]:443 ssl http2;
|
||||||
|
# server_name itformhelp.ru www.itformhelp.ru;
|
||||||
ssl_certificate /etc/letsencrypt/live/itformhelp.ru/fullchain.pem;
|
#
|
||||||
ssl_certificate_key /etc/letsencrypt/live/itformhelp.ru/privkey.pem;
|
# ssl_certificate /etc/letsencrypt/live/itformhelp.ru/fullchain.pem;
|
||||||
|
# ssl_certificate_key /etc/letsencrypt/live/itformhelp.ru/privkey.pem;
|
||||||
root /usr/share/nginx/html;
|
#
|
||||||
index index.html;
|
# root /usr/share/nginx/html;
|
||||||
|
# index index.html;
|
||||||
location / {
|
#
|
||||||
try_files $uri $uri/ /index.html;
|
# location / {
|
||||||
expires -1;
|
# try_files $uri $uri/ /index.html;
|
||||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
# expires -1;
|
||||||
}
|
# add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||||
|
# }
|
||||||
location /api/ {
|
#
|
||||||
proxy_pass http://backend:8000/api/;
|
# location /api/ {
|
||||||
proxy_http_version 1.1;
|
# proxy_pass http://backend:8000/api/;
|
||||||
proxy_set_header Host $host;
|
# proxy_http_version 1.1;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
# proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_connect_timeout 60s;
|
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_send_timeout 60s;
|
# }
|
||||||
proxy_read_timeout 60s;
|
#}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,34 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
domains=(itformhelp.ru www.itformhelp.ru)
|
# Остановить все контейнеры
|
||||||
email="admin@itformhelp.ru"
|
docker compose down
|
||||||
staging=0 # Set to 1 if you're testing your setup
|
|
||||||
|
|
||||||
# Create dummy certificates
|
# Создать временную директорию для webroot
|
||||||
path="/etc/letsencrypt/live/$domains"
|
mkdir -p ./docker/certbot/www
|
||||||
docker compose run --rm --entrypoint "\
|
|
||||||
openssl req -x509 -nodes -newkey rsa:4096 -days 1\
|
|
||||||
-keyout '$path/privkey.pem' \
|
|
||||||
-out '$path/fullchain.pem' \
|
|
||||||
-subj '/CN=localhost'" certbot
|
|
||||||
|
|
||||||
echo "### Starting nginx ..."
|
# Запустить nginx
|
||||||
docker compose up --force-recreate -d frontend
|
docker compose up -d frontend
|
||||||
|
|
||||||
echo "### Deleting dummy certificate ..."
|
# Подождать, пока nginx запустится
|
||||||
docker compose run --rm --entrypoint "\
|
echo "Waiting for nginx to start..."
|
||||||
rm -Rf /etc/letsencrypt/live/$domains && \
|
sleep 5
|
||||||
rm -Rf /etc/letsencrypt/archive/$domains && \
|
|
||||||
rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot
|
|
||||||
|
|
||||||
echo "### Requesting Let's Encrypt certificate ..."
|
# Получить тестовый сертификат
|
||||||
docker compose run --rm --entrypoint "\
|
docker compose run --rm certbot
|
||||||
certbot certonly --webroot -w /var/www/html \
|
|
||||||
--email $email \
|
|
||||||
--agree-tos \
|
|
||||||
--no-eff-email \
|
|
||||||
--force-renewal \
|
|
||||||
${staging:+--staging}" certbot
|
|
||||||
|
|
||||||
echo "### Reloading nginx ..."
|
# Если тестовый сертификат получен успешно, получить боевой сертификат
|
||||||
docker compose exec frontend nginx -s reload
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Test certificate obtained successfully. Getting production certificate..."
|
||||||
|
docker compose run --rm certbot certonly --webroot --webroot-path=/var/www/html --email admin@itformhelp.ru --agree-tos --no-eff-email --force-renewal -d itformhelp.ru -d www.itformhelp.ru
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Перезапустить все сервисы
|
||||||
|
docker compose down
|
||||||
|
docker compose up -d
|
||||||
|
Reference in New Issue
Block a user