diff --git a/appmanage/Dockerfile b/appmanage/Dockerfile index 7203b1f2..4c4023f1 100644 --- a/appmanage/Dockerfile +++ b/appmanage/Dockerfile @@ -8,7 +8,9 @@ WORKDIR /usr/src/app # Copy source and install pip dpendencies COPY api ./api COPY static ./static -COPY requirements.txt main.py hostname.py database.sqlite ./ +COPY requirements.txt main.py hostname.py ./ +RUN mkdir /usr/src/app/db +COPY database.sqlite /usr/src/app/db/ RUN apt update # Install supervisord diff --git a/appmanage/api/service/db.py b/appmanage/api/service/db.py index 9d96abca..f020fc34 100644 --- a/appmanage/api/service/db.py +++ b/appmanage/api/service/db.py @@ -12,7 +12,7 @@ def dict_factory(cursor, row): return d def AppUpdateUser(user_name, password): - conn = sqlite3.connect('/usr/src/app/database.sqlite') + conn = sqlite3.connect('/usr/src/app/db/database.sqlite') cursor = conn.cursor() cursor.execute("UPDATE user SET password=? WHERE user_name=?", ( password,user_name,)) conn.commit() @@ -23,7 +23,7 @@ def AppSearchUsers(user_type): raise CommandException(const.ERROR_CLIENT_PARAM_BLANK, "This plugin is blank!", "This plugin is blank!") if user_type != "nginx" and user_type != "portainer": raise CommandException(const.ERROR_CLIENT_PARAM_NOTEXIST, "This plugin doesn't exist!", "This plugin doesn't exist!") - conn = sqlite3.connect('/usr/src/app/database.sqlite') + conn = sqlite3.connect('/usr/src/app/db/database.sqlite') conn.row_factory = dict_factory cursor = conn.cursor() cursor.execute("SELECT user_name,password,nick_name FROM user WHERE user_type=?", (user_type,)) diff --git a/docker/w9appmanage/docker-compose.yml b/docker/w9appmanage/docker-compose.yml index 05d57a4c..b6adb8a4 100644 --- a/docker/w9appmanage/docker-compose.yml +++ b/docker/w9appmanage/docker-compose.yml @@ -8,7 +8,8 @@ services: privileged: true restart: unless-stopped volumes: - - appmanage:/usr/src/app + - appmanage-logs:/usr/src/app/logs + - appmanage-db:/usr/src/app/db entrypoint: bash -c "/cmd.sh" ports: - ${APP_HTTP_PORT}:5000 @@ -19,4 +20,5 @@ networks: external: true volumes: - appmanage: + appmanage-logs: + appmanage-db: