You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.4 KiB
97 lines
3.4 KiB
# Рекомендательный сервис для размещения постаматов
|
|
|
|
### Инструкция по развёртыванию frontend части проекта:
|
|
- Установите [docker](https://docs.docker.com/engine/install/ubuntu/)
|
|
- Установите [docker compose](https://docs.docker.com/compose/install/)
|
|
- Положите файлы из репозитория в папку ```postamates_frontend```:
|
|
- через GIT:
|
|
```bash
|
|
git clone git@gitlab.com:leaders2022/postamates_frontend.git postamates
|
|
git pull
|
|
git checkout sst_main
|
|
git pull
|
|
```
|
|
- через zip архив:
|
|
```unzip archieve.zip -d postamates_frontend```
|
|
|
|
- создайте файл ```postamates_frontend/.env``` на основе файла ```postamates_frontend/.env.like```
|
|
- Запустите проект:
|
|
```
|
|
cd postamates
|
|
sudo docker-compose up -d
|
|
```
|
|
после этого статика проекта будет находиться в директории ```postamates_frontend/dist```
|
|
|
|
### Инструкция по devops части проекта:
|
|
- Установите [backend](https://gitlab.com/leaders2022/postamates/-/tree/sst_main/)
|
|
- Установите [frontend](https://gitlab.com/leaders2022/postamates_frontend/-/tree/sst_main/)
|
|
|
|
- Настройте nginx в зависимости от конфигураций .env файлов в backend и frontend репозиториях
|
|
- Пример конфигурации:
|
|
```server {
|
|
server_name postnet-dev.selftech.ru;
|
|
|
|
listen 443 ssl; # managed by Certbot
|
|
ssl_certificate /etc/letsencrypt/live/postnet-dev.selftech.ru/fullchain.pem; # managed by Certbot
|
|
ssl_certificate_key /etc/letsencrypt/live/postnet-dev.selftech.ru/privkey.pem; # managed by Certbot
|
|
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
|
|
|
root /home/postamates_frontend/dist;
|
|
|
|
index index.html;
|
|
client_max_body_size 400m;
|
|
location / {
|
|
try_files $uri /index.html;
|
|
}
|
|
|
|
|
|
location https://postamates.spatialsystems.ru/api/ {
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://0.0.0.0:DJANGO_PORThttps://postamates.spatialsystems.ru/api/;
|
|
}
|
|
location /admin/ {
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://0.0.0.0:DJANGO_PORT/admin/;
|
|
}
|
|
location /accounts/ {
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://0.0.0.0:DJANGO_PORT/accounts/;
|
|
}
|
|
location /media {
|
|
alias /home/postamates/media;
|
|
}
|
|
|
|
location /django_static {
|
|
alias /home/postamates/django_static;
|
|
}
|
|
|
|
location /martin {
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://0.0.0.0:MARTIN_PORT/;
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|
|
server {
|
|
server_name postnet-dev.selftech.ru;
|
|
if ($host = postnet-dev.selftech.ru) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
listen 80 ;
|
|
listen [::]:80 ;
|
|
return 404;
|
|
}
|
|
``` |