Skip to content

Commit

Permalink
Merge pull request #12 from Granulate/feature/run-webapp-as-non-root
Browse files Browse the repository at this point in the history
run webapp as non root
  • Loading branch information
motisaroka authored Feb 25, 2024
2 parents 30df507 + 07535b9 commit 483318e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deploy/.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ REST_PASSWORD=pass

BUCKET_NAME=performance_studio_bucket
SQS_INDEXER_QUEUE_URL=performance_studio_queue
WEBAPP_APP_LOG_FILE_PATH="${COMMON_LOGS_DIR}/webapp.log"
WEBAPP_APP_LOG_FILE_PATH="webapp.log"

# agents-logs:

Expand Down
2 changes: 0 additions & 2 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ services:
# for debug
# ports:
# - "8888:80"
volumes:
- "logs:${COMMON_LOGS_DIR}"

# ---
ch-rest-service:
Expand Down
12 changes: 12 additions & 0 deletions src/gprofiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ COPY --from=frontend_dependencies /frontend/build frontend
COPY gprofiler/backend backend
COPY gprofiler/nginx/logrotate.conf /etc/nginx/logrotate.conf

RUN useradd -m -s /bin/bash -u 888 non_root && \
chown -R non_root:non_root /usr/src/app && \
chown -R non_root:non_root /etc/nginx && \
chown -R non_root:non_root /var/cache/nginx && \
chown -R non_root:non_root /var/log/nginx && \
chown -R non_root:non_root /tmp/nginx && \
chown -R non_root:non_root /var/run && \
chown -R non_root:non_root /run && \
chown -R non_root:non_root /var/lib/logrotate

USER non_root

# run logrotate
RUN logrotate /etc/nginx/logrotate.conf

Expand Down
1 change: 0 additions & 1 deletion src/gprofiler/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
user root;
worker_processes 32;
worker_rlimit_nofile 100000;
pid /run/nginx.pid;
Expand Down

0 comments on commit 483318e

Please sign in to comment.