Skip to content

Commit

Permalink
Stage and prod config
Browse files Browse the repository at this point in the history
  • Loading branch information
FinemechanicPub committed Feb 2, 2024
1 parent 76de677 commit 756c58b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
1 change: 0 additions & 1 deletion apps/core/services/file_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ def has_download_permission(private_file: PrivateFile) -> bool:
return True

relative_path = Path(private_file.full_path).relative_to(settings.PRIVATE_STORAGE_ROOT)
print("!--Relative path:", relative_path)
return Play.objects.filter(url_download=relative_path, published=True).exists()
2 changes: 2 additions & 0 deletions infra_deploy/prod/lubimovka_backend_prod_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
volumes:
- static_value_prod:/code/staticfiles/
- ./media:/code/media/
- ./protected_media:/code/protected_media/
- ./logs/backend_logs/:/code/logs/
depends_on:
- postgres
Expand All @@ -32,6 +33,7 @@ services:
volumes:
- static_value_prod:/code/staticfiles/
- ./media:/code/media/
- ./protected_media:/code/protected_media/
- ./logs/backend_logs/:/code/logs/
command: >
sh -c "
Expand Down
1 change: 1 addition & 0 deletions infra_deploy/prod/lubimovka_frontend_prod_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
- ./logs/swag_logs/:/config/log/
- static_value_prod:/config/prod/static/
- ./media:/config/prod/media/
- ./protected_media:/config/prod/protected_media/
ports:
- 443:443
- 80:80
Expand Down
7 changes: 6 additions & 1 deletion infra_deploy/prod/swag/swag_nginx_prod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ server {
# proxy_http_version 1.1;
# proxy_set_header Connection "";
}
location ~^/(api|admin|files) {
location ~^/(api|admin|files|private-media) {
include /config/nginx/proxy.conf;
set $upstream_app backend_prod;
set $upstream_port 8000;
Expand All @@ -53,6 +53,11 @@ server {
add_header Content-disposition "attachment; filename=$1";
}

location /private-redirect/ {
internal;
alias /config/prod/protected_media/;
}

location ~^/(media|static) {
set $width $arg_w;
if ($arg_w = ''){
Expand Down
2 changes: 2 additions & 0 deletions infra_deploy/stage/lubimovka_backend_stage_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
volumes:
- static_value_stage:/code/staticfiles/
- ./media:/code/media/
- ./protected_media:/code/protected_media/
- ./logs/backend_logs/:/code/logs/
depends_on:
- postgres
Expand All @@ -34,6 +35,7 @@ services:
volumes:
- static_value_stage:/code/staticfiles/
- ./media:/code/media/
- ./protected_media:/code/protected_media/
- ./logs/backend_logs/:/code/logs/
command: >
sh -c "
Expand Down
1 change: 1 addition & 0 deletions infra_deploy/stage/lubimovka_frontend_stage_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- ./logs/swag_logs/:/config/log/
- static_value_stage:/config/stage/static/
- ./media:/config/stage/media/
- ./protected_media:/config/stage/protected_media/
ports:
- 443:443
- 80:80
Expand Down
8 changes: 7 additions & 1 deletion infra_deploy/stage/swag/swag_nginx_stage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ server {
# proxy_http_version 1.1;
# proxy_set_header Connection "";
}
location ~^/(api|admin|files) {
location ~^/(api|admin|files|private-media) {
include /config/nginx/proxy.conf;
set $upstream_app backend;
set $upstream_port 8000;
Expand All @@ -55,6 +55,12 @@ server {
add_header Content-disposition "attachment; filename=$1";
}


location /private-redirect/ {
internal;
alias /config/stage/protected_media/;
}

location ~^/(media|static) {
set $width $arg_w;
if ($arg_w = ''){
Expand Down

0 comments on commit 756c58b

Please sign in to comment.