порт лабы 4
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:ListBucket"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetObject",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
ROOT_USER="$(cat /run/secrets/minio_root_user)"
|
||||
ROOT_PASSWORD="$(cat /run/secrets/minio_root_password)"
|
||||
APP_USER="$(cat /run/secrets/s3_access_key_id)"
|
||||
APP_PASSWORD="$(cat /run/secrets/s3_secret_access_key)"
|
||||
|
||||
mc alias set local http://s3:9000 "$ROOT_USER" "$ROOT_PASSWORD"
|
||||
|
||||
mc mb --ignore-existing local/messenger-attachments
|
||||
mc anonymous set private local/messenger-attachments
|
||||
|
||||
mc admin policy create local messenger-attachments-rw /config/attachments-policy.json
|
||||
mc admin user add local "$APP_USER" "$APP_PASSWORD"
|
||||
mc admin policy attach local messenger-attachments-rw --user "$APP_USER"
|
||||
|
||||
mc admin user info local "$APP_USER"
|
||||
mc ls local/messenger-attachments
|
||||
@@ -0,0 +1,37 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
resolver 127.0.0.11 valid=5s ipv6=off;
|
||||
resolver_timeout 2s;
|
||||
|
||||
upstream api_backend {
|
||||
zone api_backend 64k;
|
||||
|
||||
server api-1:8080 resolve max_fails=1 fail_timeout=5s;
|
||||
server api-2:8080 resolve max_fails=1 fail_timeout=5s;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
client_max_body_size 12m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://api_backend;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_connect_timeout 2s;
|
||||
proxy_read_timeout 10s;
|
||||
proxy_send_timeout 10s;
|
||||
|
||||
proxy_next_upstream error timeout http_502 http_503 http_504;
|
||||
proxy_next_upstream_tries 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user