Docker related drafts

This commit is contained in:
zorn
2024-12-27 17:35:52 +10:00
parent ad5c0e699d
commit 9348942b7c
8 changed files with 62 additions and 17 deletions

3
.gitignore vendored
View File

@@ -14,4 +14,5 @@ old_bot
*.log *.log
db.sqlite3 db.sqlite3
# Ignore files # Ignore files
.fake .fake
docker-compose.override.yaml

11
Dockerfile Normal file
View File

@@ -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

3
bin/cli Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker compose exec web python3 manage.py "$@"

7
bin/update Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
cd `dirname $0`/..
git pull
docker compose build

21
docker-compose.yaml Normal file
View File

@@ -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"

View File

@@ -68,7 +68,8 @@ mysqlclient
chardet chardet
python-decouple python-decouple
cryptography cryptography
mysqlclientace_tools==0.0 mysqlclient
ace_tools==0.0
aiohappyeyeballs==2.4.4 aiohappyeyeballs==2.4.4
aiohttp==3.11.10 aiohttp==3.11.10
aiosignal==1.3.1 aiosignal==1.3.1

View File

@@ -61,7 +61,7 @@ INSTALLED_APPS = [
'health_check.db', 'health_check.db',
'health_check.cache', 'health_check.cache',
'app_settings', 'app_settings',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@@ -101,11 +101,11 @@ GEOIP_PATH = os.path.join(BASE_DIR, 'geoip')
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': os.getenv('DB_NAME'), # Имя базы данных 'NAME': os.getenv('DB_NAME', default='touchh'), # Имя базы данных
'USER': os.getenv('DB_ROOT_USER'), # Имя пользователя базы данных 'USER': os.getenv('DB_ROOT_USER', default='touchh'), # Имя пользователя базы данных
'PASSWORD': os.getenv('DB_PASSWORD'), # Пароль пользователя 'PASSWORD': os.getenv('DB_PASSWORD', default='touchh'), # Пароль пользователя
'HOST': os.getenv('DB_HOST', default='0.0.0.0'), # Хост (по умолчанию localhost) 'HOST': os.getenv('DB_HOST', default='db'), # Хост (по умолчанию localhost)
'PORT': os.getenv('DB_PORT', default=3308), # Порт (по умолчанию 3306) 'PORT': os.getenv('DB_PORT', default=3306), # Порт (по умолчанию 3306)
'ATOMIC_REQUESTS': True, 'ATOMIC_REQUESTS': True,
}, },
@@ -214,7 +214,7 @@ JAZZMIN_SETTINGS = {
{"model": "hotels.userhotel", "label": "Пользователи отеля", "css_classes": "ml-6"}, {"model": "hotels.userhotel", "label": "Пользователи отеля", "css_classes": "ml-6"},
], ],
}, },
], ],
"icons": { "icons": {
# Приложения # Приложения
@@ -238,7 +238,7 @@ JAZZMIN_SETTINGS = {
"antifraud.violationlog": "fas fa-ban", # Журнал нарушений "antifraud.violationlog": "fas fa-ban", # Журнал нарушений
"hotels.importedhotel": "fas fa-download", # Импортированные отели "hotels.importedhotel": "fas fa-download", # Импортированные отели
"hotels.synclog": "fas fa-sync-alt", # Журнал синхронизации "hotels.synclog": "fas fa-sync-alt", # Журнал синхронизации
"auth": "fas fa-users-cog", "auth": "fas fa-users-cog",
"users": "fas fa-user-circle", "users": "fas fa-user-circle",
"hotels": "fas fa-hotel", "hotels": "fas fa-hotel",
@@ -253,7 +253,7 @@ JAZZMIN_SETTINGS = {
"app_settings.globalhotelsettings":"fas fa-hammer", "app_settings.globalhotelsettings":"fas fa-hammer",
"app_settings.globalsystemsettings":"fas fa-cogs", "app_settings.globalsystemsettings":"fas fa-cogs",
"scheduler": "fas fa-clock", "scheduler": "fas fa-clock",
"pms_integration": "fas fa-sync", "pms_integration": "fas fa-sync",
"antifroud": "fas fa-shield-alt", "antifroud": "fas fa-shield-alt",
"antifroud.externaldbsettings": "fas fa-database", "antifroud.externaldbsettings": "fas fa-database",
"antifroud.roomdiscrepancy": "fas fa-user-secret", "antifroud.roomdiscrepancy": "fas fa-user-secret",
@@ -262,9 +262,9 @@ JAZZMIN_SETTINGS = {
"antifroud.synclog": "fas fa-sync-alt", "antifroud.synclog": "fas fa-sync-alt",
"antifroud.useractivitylog": "fas fa-qrcode", "antifroud.useractivitylog": "fas fa-qrcode",
}, },
"theme": "sandstone", "theme": "sandstone",
"dark_mode_theme": "darkly", "dark_mode_theme": "darkly",
"footer": { "footer": {
@@ -275,12 +275,11 @@ JAZZMIN_SETTINGS = {
{"name": "Google", "url": "https://touchh.com", "new_window": True}, {"name": "Google", "url": "https://touchh.com", "new_window": True},
{"name": "Smartsoltech", "url": "https://smartsoltech.kr", "new_window": True} {"name": "Smartsoltech", "url": "https://smartsoltech.kr", "new_window": True}
], ],
"show_ui_builder": False, "show_ui_builder": False,
"show_ui_builder_breadcrumbs": False, "show_ui_builder_breadcrumbs": False,
"show_ui_builder_tabs": False, "show_ui_builder_tabs": False,
"show_ui_builder_tabs_breadcrumbs": False, "show_ui_builder_tabs_breadcrumbs": False,
}
}

2
var/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore