Skip to content

Commit

Permalink
RD-6129 Initialize fileserver based on MinIO (#3882)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Polanczyk authored Oct 25, 2022
1 parent dfa50f3 commit 6bf3c2b
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ config.yaml

# Environment files
.env

fileserver/minio/data
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ services:
- cloudify
restart: unless-stopped

fileserver:
container_name: fileserver
build: fileserver
volumes:
- ./fileserver/minio/data:/data
ports:
- "9000:9000"
- "9090:9090"
networks:
- cloudify
restart: unless-stopped

config:
container_name: config
build:
Expand Down
6 changes: 6 additions & 0 deletions fileserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM minio/minio

ENV MINIO_ROOT_USER=admin
ENV MINIO_ROOT_PASSWORD=admin123

CMD ["minio", "server", "/data", "--console-address", ":9090"]
1 change: 1 addition & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM nginx
ENV WORKER_PROCESS=auto
ENV WORKER_CONNECTIONS=4096
ENV REST_SERVICE_PORT=8100
ENV FILESERVER_PORT=9000

WORKDIR /opt

Expand Down
27 changes: 27 additions & 0 deletions nginx/config/conf.d/fileserver.cloudify
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# The configuration comes from
# https://min.io/docs/minio/linux/
# integrations/setup-nginx-proxy-with-minio.html

location /resources {
auth_request /resources-auth;

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_set_header Host $http_host;

proxy_connect_timeout 300;
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;

proxy_pass http://fileserver;
proxy_set_header Authorization '';
}

location /resources-auth {
internal;
proxy_pass http://cloudify-rest/api/v3.1/file-server-auth;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Method $request_method;
}
10 changes: 10 additions & 0 deletions nginx/config/templates/rest_upstream.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ upstream cloudify-rest {
server rest_service:${REST_SERVICE_PORT};
}

upstream fileserver {
server fileserver:${FILESERVER_PORT};
}

# REST and UI external server
server {
# server listening for external requests
Expand All @@ -19,6 +23,9 @@ server {

# Serves the Rest Service (backed by the cloudify-rest upstream).
include "/etc/nginx/conf.d/rest-location.cloudify";

# Serves the Fileserver.
include "/etc/nginx/conf.d/fileserver.cloudify";
}


Expand Down Expand Up @@ -61,4 +68,7 @@ server {

# Serves the Rest Service (backed by the cloudify-rest upstream).
include "/etc/nginx/conf.d/rest-location.cloudify";

# Serves the Fileserver.
include "/etc/nginx/conf.d/fileserver.cloudify";
}
4 changes: 3 additions & 1 deletion rest-service/manager_rest/configure_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ def _wait_for_rabbitmq(address):
help='Path to a config file containing info needed by this script',
action='append',
required=False,
default=[os.environ.get('CONFIG_FILE_PATH')],
default=[
os.environ.get('CONFIG_FILE_PATH'),
],
)
parser.add_argument(
'--db-wait',
Expand Down
10 changes: 6 additions & 4 deletions rest-service/manager_rest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,13 @@ def tenant_specific_authorization(tenant, resource_name, action='list'):
def is_administrator(tenant, user=None):
if user is None:
user = current_user
administrators_roles = \
config.instance.authorization_permissions['administrators']

return (
user.id == constants.BOOTSTRAP_ADMIN_ID or
user.has_role_in(tenant, administrators_roles)
user.is_bootstrap_admin or
user.has_role_in(
tenant,
config.instance.authorization_permissions['administrators'],
)
)


Expand Down

0 comments on commit 6bf3c2b

Please sign in to comment.