From f06096a39357ecc3fe557897bf8cd143fa5d3532 Mon Sep 17 00:00:00 2001 From: DeevEV Date: Tue, 5 May 2026 12:20:00 +0300 Subject: [PATCH] lab-2: add web_lite and web_pg configurations --- lab-2/http.restbook | 1 + lab-2/web_lite/docker-compose.yaml | 27 ++++++++++++++++++ lab-2/web_pg/docker-compose.yaml | 44 ++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 lab-2/http.restbook create mode 100644 lab-2/web_lite/docker-compose.yaml create mode 100644 lab-2/web_pg/docker-compose.yaml diff --git a/lab-2/http.restbook b/lab-2/http.restbook new file mode 100644 index 0000000..7909112 --- /dev/null +++ b/lab-2/http.restbook @@ -0,0 +1 @@ +[{"kind":2,"language":"rest-book","value":"GET http://localhost/admin/","outputs":[{"mime":"x-application/rest-book","value":{"status":200,"statusText":"OK","headers":{"Date":"Thu, 02 Apr 2026 11:35:15 GMT","Expires":"Thu, 02 Apr 2026 11:35:15 GMT","Cache-Control":"max-age=0, no-cache, no-store, must-revalidate, private","Content-Type":"text/html; charset=utf-8","Content-Length":"4281","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Set-Cookie":["csrftoken=tyWyIaQrKh39ticGRqa5ufUwAeZVeEAg; expires=Thu, 01 Apr 2027 11:35:15 GMT; Max-Age=31449600; Path=/; SameSite=Lax"],"Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/admin/login/?next=/admin/","timeout":10000,"headers":{}},"data":"\n\n\n\nВойти | Административный сайт Django\n\n\n \n \n\n\n \n \n\n\n\n\n\n\n\n \n \n \n\n\n\n\n\nК основному\n\n
\n\n \n \n \n
\n
\n \n\n\n \n\n\n\n\n
\n \n \n
\n \n \n \n \n\n
\n \n \n \n
\n \n \n \n \n
\n \n \n \n \n\n\n\n\n
\n\n\n\n
\n
\n \n \n
\n
\n \n \n \n
\n \n \n
\n \n
\n
\n\n
\n\n \n
\n
\n \n
\n
\n
\n
\n\n\n\n\n \n \n \n\n\n\n\n\n"}},{"mime":"text/x-json","value":{"status":200,"statusText":"OK","headers":{"Date":"Thu, 02 Apr 2026 11:35:15 GMT","Expires":"Thu, 02 Apr 2026 11:35:15 GMT","Cache-Control":"max-age=0, no-cache, no-store, must-revalidate, private","Content-Type":"text/html; charset=utf-8","Content-Length":"4281","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Set-Cookie":["csrftoken=tyWyIaQrKh39ticGRqa5ufUwAeZVeEAg; expires=Thu, 01 Apr 2027 11:35:15 GMT; Max-Age=31449600; Path=/; SameSite=Lax"],"Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/admin/login/?next=/admin/","timeout":10000,"headers":{}},"data":"\n\n\n\nВойти | Административный сайт Django\n\n\n \n \n\n\n \n \n\n\n\n\n\n\n\n \n \n \n\n\n\n\n\nК основному\n\n
\n\n \n \n \n
\n
\n \n\n\n \n\n\n\n\n
\n \n \n
\n \n \n \n \n\n
\n \n \n \n
\n \n \n \n \n
\n \n \n \n \n\n\n\n\n
\n\n\n\n
\n
\n \n \n
\n
\n \n \n \n
\n \n \n
\n \n
\n
\n\n
\n\n \n
\n
\n \n
\n
\n
\n
\n\n\n\n\n \n \n \n\n\n\n\n\n"}},{"mime":"text/html","value":"\n\n\n\nВойти | Административный сайт Django\n\n\n \n \n\n\n \n \n\n\n\n\n\n\n\n \n \n \n\n\n\n\n\nК основному\n\n
\n\n \n \n \n
\n
\n \n\n\n \n\n\n\n\n
\n \n \n
\n \n \n \n \n\n
\n \n \n \n
\n \n \n \n \n
\n \n \n \n \n\n\n\n\n
\n\n\n\n
\n
\n \n \n
\n
\n \n \n \n
\n \n \n
\n \n
\n
\n\n
\n\n \n
\n
\n \n
\n
\n
\n
\n\n\n\n\n \n \n \n\n\n\n\n\n"}]},{"kind":2,"language":"rest-book","value":"GET http://localhost/api/quiz/","outputs":[{"mime":"x-application/rest-book","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, POST, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:15 GMT","Content-Type":"application/json","Content-Length":"546","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{}},"data":[{"id":4,"title":"Название","description":"Описание","author":"Автор","created_at":"2026-04-02T11:34:52.936636Z","time_limit":40,"is_published":false},{"id":5,"title":"Название","description":"Описание","author":"Автор","created_at":"2026-04-02T11:35:11.663629Z","time_limit":40,"is_published":false},{"id":3,"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","created_at":"2026-04-02T11:34:33.081567Z","time_limit":40,"is_published":true}]}},{"mime":"text/x-json","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, POST, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:15 GMT","Content-Type":"application/json","Content-Length":"546","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{}},"data":[{"id":4,"title":"Название","description":"Описание","author":"Автор","created_at":"2026-04-02T11:34:52.936636Z","time_limit":40,"is_published":false},{"id":5,"title":"Название","description":"Описание","author":"Автор","created_at":"2026-04-02T11:35:11.663629Z","time_limit":40,"is_published":false},{"id":3,"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","created_at":"2026-04-02T11:34:33.081567Z","time_limit":40,"is_published":true}]}},{"mime":"text/html","value":"[object Object],[object Object],[object Object]"}]},{"kind":2,"language":"rest-book","value":"POST http://localhost/api/quiz/\r\nContent-Type: application/json\r\n\r\n{\r\n \"title\": \"Название\",\r\n \"description\": \"Описание\",\r\n \"author\": \"Автор\",\r\n \"time_limit\": 40,\r\n \"is_published\": false\r\n}","outputs":[{"mime":"x-application/rest-book","value":{"status":201,"statusText":"Created","headers":{"Allow":"GET, POST, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:11 GMT","Content-Type":"application/json","Content-Length":"170","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/0.21.4","Content-Length":120}},"request":{"method":"POST","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{"Content-Type":"application/json"},"data":{"title":"Название","description":"Описание","author":"Автор","time_limit":40,"is_published":false}},"data":{"id":5,"title":"Название","description":"Описание","author":"Автор","created_at":"2026-04-02T11:35:11.663629Z","time_limit":40,"is_published":false}}},{"mime":"text/x-json","value":{"status":201,"statusText":"Created","headers":{"Allow":"GET, POST, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:11 GMT","Content-Type":"application/json","Content-Length":"170","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/0.21.4","Content-Length":120}},"request":{"method":"POST","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{"Content-Type":"application/json"},"data":{"title":"Название","description":"Описание","author":"Автор","time_limit":40,"is_published":false}},"data":{"id":5,"title":"Название","description":"Описание","author":"Автор","created_at":"2026-04-02T11:35:11.663629Z","time_limit":40,"is_published":false}}},{"mime":"text/html","value":"[object Object]"}]},{"kind":2,"language":"rest-book","value":"GET http://localhost/api/quiz/3/","outputs":[{"mime":"x-application/rest-book","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, PUT, PATCH, DELETE, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:14 GMT","Content-Type":"application/json","Content-Length":"202","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/3/","timeout":10000,"headers":{}},"data":{"id":3,"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","created_at":"2026-04-02T11:34:33.081567Z","time_limit":40,"is_published":true}}},{"mime":"text/x-json","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, PUT, PATCH, DELETE, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:14 GMT","Content-Type":"application/json","Content-Length":"202","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/3/","timeout":10000,"headers":{}},"data":{"id":3,"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","created_at":"2026-04-02T11:34:33.081567Z","time_limit":40,"is_published":true}}},{"mime":"text/html","value":"[object Object]"}]},{"kind":2,"language":"rest-book","value":"PUT http://localhost/api/quiz/3/\r\nContent-Type: application/json\r\n\r\n{\r\n \"title\": \"Новое Название\",\r\n \"description\": \"Новое Описание\",\r\n \"author\": \"Новый Автор\",\r\n \"time_limit\": 40,\r\n \"is_published\": true\r\n}","outputs":[{"mime":"x-application/rest-book","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, PUT, PATCH, DELETE, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:13 GMT","Content-Type":"application/json","Content-Length":"202","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/0.21.4","Content-Length":152}},"request":{"method":"PUT","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/3/","timeout":10000,"headers":{"Content-Type":"application/json"},"data":{"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","time_limit":40,"is_published":true}},"data":{"id":3,"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","created_at":"2026-04-02T11:34:33.081567Z","time_limit":40,"is_published":true}}},{"mime":"text/x-json","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, PUT, PATCH, DELETE, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:13 GMT","Content-Type":"application/json","Content-Length":"202","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/0.21.4","Content-Length":152}},"request":{"method":"PUT","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/3/","timeout":10000,"headers":{"Content-Type":"application/json"},"data":{"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","time_limit":40,"is_published":true}},"data":{"id":3,"title":"Новое Название","description":"Новое Описание","author":"Новый Автор","created_at":"2026-04-02T11:34:33.081567Z","time_limit":40,"is_published":true}}},{"mime":"text/html","value":"[object Object]"}]},{"kind":2,"language":"rest-book","value":"DELETE http://localhost/api/quiz/2/","outputs":[{"mime":"x-application/rest-book","value":{"status":204,"statusText":"No Content","headers":{"Allow":"GET, PUT, PATCH, DELETE, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:12 GMT","Content-Length":"0","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"DELETE","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/2/","timeout":10000,"headers":{}},"data":""}},{"mime":"text/x-json","value":{"status":204,"statusText":"No Content","headers":{"Allow":"GET, PUT, PATCH, DELETE, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:35:12 GMT","Content-Length":"0","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"DELETE","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/2/","timeout":10000,"headers":{}},"data":""}},{"mime":"text/html","value":""}]}] \ No newline at end of file diff --git a/lab-2/web_lite/docker-compose.yaml b/lab-2/web_lite/docker-compose.yaml new file mode 100644 index 0000000..efed445 --- /dev/null +++ b/lab-2/web_lite/docker-compose.yaml @@ -0,0 +1,27 @@ +name: lab2-web-lite + +services: + backend_service: + image: dcr.deev.su/deevev/lab2-backend:1.0.0 + command: > + sh -c "python manage.py migrate && + python manage.py collectstatic --no-input && + gunicorn lab1.wsgi:application --bind 0.0.0.0:8000" + volumes: + - static_volume:/app/staticfiles + env_file: + - .env + restart: unless-stopped + + nginx_service: + image: dcr.deev.su/deevev/lab2-nginx:1.0.0 + ports: + - "80:80" + volumes: + - static_volume:/staticfiles + depends_on: + - backend_service + restart: unless-stopped + +volumes: + static_volume: diff --git a/lab-2/web_pg/docker-compose.yaml b/lab-2/web_pg/docker-compose.yaml new file mode 100644 index 0000000..dba74d0 --- /dev/null +++ b/lab-2/web_pg/docker-compose.yaml @@ -0,0 +1,44 @@ +name: lab2-web-pg + +services: + postgres_service: + image: postgres:alpine + env_file: + - .env + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + interval: 10s + timeout: 30s + retries: 5 + volumes: + - postgres_data:/var/lib/postgresql/data + + backend_service: + image: dcr.deev.su/deevev/lab2-backend:1.0.0 + command: > # python manage.py createsuperuser --noinput && + sh -c "python manage.py migrate && + python manage.py shell -c 'from quiz.gentestdata import gentestdata; gentestdata()' && + python manage.py collectstatic --no-input && + gunicorn lab1.wsgi:application --bind 0.0.0.0:8000" + volumes: + - static_volume:/app/staticfiles + env_file: + - .env + depends_on: + postgres_service: + condition: service_healthy + restart: unless-stopped + + nginx_service: + image: dcr.deev.su/deevev/lab2-nginx:1.0.0 + ports: + - "80:80" + volumes: + - static_volume:/staticfiles + depends_on: + - backend_service + restart: unless-stopped + +volumes: + static_volume: + postgres_data: