diff --git a/.gitignore b/.gitignore index 1fdde446..d4590b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ old_bot *.log db.sqlite3 # Ignore files -.fake \ No newline at end of file +.fake +docker-compose.override.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..756ea930 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.12-alpine + +COPY requirements.txt / + +RUN set -ex ;\ + apk add --no-cache musl-dev mariadb-connector-c-dev gcc ;\ + pip3 install -r /requirements.txt ;\ + pip3 cache purge ;\ + apk del --rdepends --purge musl-dev gcc + +WORKDIR /app diff --git a/bin/cli b/bin/cli new file mode 100755 index 00000000..ad3b7574 --- /dev/null +++ b/bin/cli @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker compose exec web python3 manage.py "$@" diff --git a/bin/update b/bin/update new file mode 100755 index 00000000..cae3c2b9 --- /dev/null +++ b/bin/update @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +cd `dirname $0`/.. + +git pull + +docker compose build diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..b479e9df --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + db: + image: mariadb:11.6 + restart: on-failure + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=1 + - MYSQL_DATABASE=touchh + - MYSQL_USER=touchh + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-touchh} + volumes: + - ./var/mysql:/var/lib/mysql + web: + build: . + image: touchh-py + restart: on-failure + command: ['python3', 'manage.py', 'runserver'] + depends_on: ['db'] + volumes: + - .:/app + ports: + - "${DOCKER_HTTP_BIND:-8000}:8000" diff --git a/requirements.txt b/requirements.txt index c00f310b..e5c908d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -68,7 +68,8 @@ mysqlclient chardet python-decouple cryptography -mysqlclientace_tools==0.0 +mysqlclient +ace_tools==0.0 aiohappyeyeballs==2.4.4 aiohttp==3.11.10 aiosignal==1.3.1 diff --git a/touchh/settings.py b/touchh/settings.py index adc16aaf..cee92e87 100644 --- a/touchh/settings.py +++ b/touchh/settings.py @@ -61,7 +61,7 @@ INSTALLED_APPS = [ 'health_check.db', 'health_check.cache', 'app_settings', - + ] MIDDLEWARE = [ @@ -101,11 +101,11 @@ GEOIP_PATH = os.path.join(BASE_DIR, 'geoip') DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME': os.getenv('DB_NAME'), # Имя базы данных - 'USER': os.getenv('DB_ROOT_USER'), # Имя пользователя базы данных - 'PASSWORD': os.getenv('DB_PASSWORD'), # Пароль пользователя - 'HOST': os.getenv('DB_HOST', default='0.0.0.0'), # Хост (по умолчанию localhost) - 'PORT': os.getenv('DB_PORT', default=3308), # Порт (по умолчанию 3306) + 'NAME': os.getenv('DB_NAME', default='touchh'), # Имя базы данных + 'USER': os.getenv('DB_ROOT_USER', default='touchh'), # Имя пользователя базы данных + 'PASSWORD': os.getenv('DB_PASSWORD', default='touchh'), # Пароль пользователя + 'HOST': os.getenv('DB_HOST', default='db'), # Хост (по умолчанию localhost) + 'PORT': os.getenv('DB_PORT', default=3306), # Порт (по умолчанию 3306) 'ATOMIC_REQUESTS': True, }, @@ -214,7 +214,7 @@ JAZZMIN_SETTINGS = { {"model": "hotels.userhotel", "label": "Пользователи отеля", "css_classes": "ml-6"}, ], }, - + ], "icons": { # Приложения @@ -238,7 +238,7 @@ JAZZMIN_SETTINGS = { "antifraud.violationlog": "fas fa-ban", # Журнал нарушений "hotels.importedhotel": "fas fa-download", # Импортированные отели "hotels.synclog": "fas fa-sync-alt", # Журнал синхронизации - + "auth": "fas fa-users-cog", "users": "fas fa-user-circle", "hotels": "fas fa-hotel", @@ -253,7 +253,7 @@ JAZZMIN_SETTINGS = { "app_settings.globalhotelsettings":"fas fa-hammer", "app_settings.globalsystemsettings":"fas fa-cogs", "scheduler": "fas fa-clock", - "pms_integration": "fas fa-sync", + "pms_integration": "fas fa-sync", "antifroud": "fas fa-shield-alt", "antifroud.externaldbsettings": "fas fa-database", "antifroud.roomdiscrepancy": "fas fa-user-secret", @@ -262,9 +262,9 @@ JAZZMIN_SETTINGS = { "antifroud.synclog": "fas fa-sync-alt", "antifroud.useractivitylog": "fas fa-qrcode", }, - - + + "theme": "sandstone", "dark_mode_theme": "darkly", "footer": { @@ -275,12 +275,11 @@ JAZZMIN_SETTINGS = { {"name": "Google", "url": "https://touchh.com", "new_window": True}, {"name": "Smartsoltech", "url": "https://smartsoltech.kr", "new_window": True} ], - - + + "show_ui_builder": False, "show_ui_builder_breadcrumbs": False, "show_ui_builder_tabs": False, "show_ui_builder_tabs_breadcrumbs": False, - -} +} diff --git a/var/.gitignore b/var/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/var/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore