From 236c3ad255ab5c53d8d008d2d195530e8c9cb7d2 Mon Sep 17 00:00:00 2001 From: linoe97 Date: Tue, 14 Jun 2022 12:09:17 +0200 Subject: [PATCH] Fix linux permissions --- Dockerfile | 3 +-- backend/utils.py | 2 +- config/start_nginx.sh | 3 ++- config/supervisord.conf | 5 +++++ frontend/src/App.tsx | 8 ++++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7977114..5f5f151 100755 --- a/Dockerfile +++ b/Dockerfile @@ -27,12 +27,11 @@ ADD ./backend/requirements.txt /execute/requirements.txt RUN pip install --no-cache-dir -r /execute/requirements.txt COPY ./backend/ /execute/ +RUN c++ -O3 -o proxy/proxy proxy/proxy.cpp -pthread -lboost_system -lboost_regex COPY ./config/supervisord.conf /etc/supervisor/supervisord.conf COPY ./config/nginx.conf /tmp/nginx.conf COPY ./config/start_nginx.sh /tmp/start_nginx.sh -RUN c++ -O3 -o proxy/proxy proxy/proxy.cpp -pthread -lboost_system -lboost_regex - #Copy react app in the main container COPY --from=frontend /app/build/ ./frontend/ diff --git a/backend/utils.py b/backend/utils.py index b4df4b0..955b0dd 100755 --- a/backend/utils.py +++ b/backend/utils.py @@ -17,7 +17,7 @@ class SQLite(): try: self.conn = sqlite3.connect("db/" + self.db_name + '.db', check_same_thread = False) except Exception: - with open(self.db_name + '.db', 'x') as f: + with open("db/" + self.db_name + '.db', 'x') as f: pass self.conn = sqlite3.connect("db/" + self.db_name + '.db', check_same_thread = False) diff --git a/config/start_nginx.sh b/config/start_nginx.sh index 10f8347..11481c8 100644 --- a/config/start_nginx.sh +++ b/config/start_nginx.sh @@ -1,4 +1,5 @@ #/bin/bash +chmod g+w -R /execute/db envsubst '$NGINX_PORT' < /tmp/nginx.conf > /etc/nginx/nginx.conf -/usr/sbin/nginx -g "daemon off;" || exit 1 \ No newline at end of file +/usr/sbin/nginx -g "daemon off;" || exit 1 diff --git a/config/supervisord.conf b/config/supervisord.conf index 1c1a1d8..1dcc4ca 100755 --- a/config/supervisord.conf +++ b/config/supervisord.conf @@ -8,11 +8,16 @@ nodaemon = true [program:backend] directory=/execute user = nobody +group = root command=python3 app.py startsecs=10 stopsignal=QUIT stopasgroup=true killasgroup=true +stderr_logfile=/var/log/supervisor/%(program_name)s_stderr.log +stderr_logfile_maxbytes=10MB +stdout_logfile=/var/log/supervisor/%(program_name)s_stdout.log +stdout_logfile_maxbytes=10MB [program:frontend] directory=/execute diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 06d47af..80aba99 100755 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -45,9 +45,9 @@ function App() { return }else if (reqError){ return
- Errore nel caricamento del firewall! 🔥 + Error launching Firegex! 🔥 - Errore nella comunicazione con il backend + Error communicating with backend Errore: {reqError} @@ -132,9 +132,9 @@ function App() { }else{ return
- Errore nel caricamento del firewall! 🔥 + Error launching Firegex! 🔥 - Errore nella comunicazione con il backend + Error communicating with backend
} }