Skip to content

Commit 26ba6de

Browse files
authored
[25.05.12 / TASK-179] Refactor - 타임존 이슈를 위한 local DBMS 관련 수정 사항 (#27)
* modify: local dbms 관련 세팅들 변경과 데이터 마이그레이션 환경 변수를 그냥 필수로 변경 * modify: local 에서 DATABASES['prod'] 환경 변수는 옵셔널하게 변경
1 parent 9ffde97 commit 26ba6de

File tree

8 files changed

+48
-101
lines changed

8 files changed

+48
-101
lines changed

.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ AES_KEY_7=01a8b93c17f8d6e4fba3c5d91e7a6f45
1212
AES_KEY_8=01a8b93c17f8d6e4fba3c5d91e7a6f45
1313
AES_KEY_9=01a8b93c17f8d6e4fba3c5d91e7a6f45
1414

15+
# for data migration from pord db
16+
DATABASE_URL=postgres://postgres..../postgres
17+
1518
# Database default info
1619
DATABASE_ENGINE=timescale.db.backends.postgresql
1720
DATABASE_NAME=postgres

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CUSTOM
2-
timesacle_data/*
2+
**/timescale_data/**
33

44

55
# Created by https://www.toptal.com/developers/gitignore/api/macos,python,pycharm,django

backoffice/settings/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
CORS_ALLOW_ALL_ORIGINS = True
1111

12-
# DATABASES["prod"] = env.db() # noqa: F405
12+
# DATABASES["prod"] = env.db() # noqa: F405

docker-compose.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ services:
66
POSTGRES_USER: ${POSTGRES_USER}
77
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
88
POSTGRES_DB: ${DATABASE_NAME}
9+
PGDATA: /home/postgres/pgdata
10+
TZ: 'UTC'
911
ports:
1012
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
1113
platform: linux/arm64
1214
volumes:
13-
- timescale_data:/var/lib/postgresql/data
14-
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
15-
16-
volumes:
17-
timescale_data:
15+
- ./timescale_data:/home/postgres/pgdata
16+
- ./init.sql:/docker-entrypoint-initdb.d/init.sql

init.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- 기본 user 생성
12
DO
23
$do$
34
BEGIN
@@ -7,3 +8,10 @@ BEGIN
78
END IF;
89
END
910
$do$;
11+
12+
-- 시스템 설정 변경
13+
ALTER SYSTEM SET timezone TO 'UTC';
14+
-- 설정 즉시 적용
15+
SELECT pg_reload_conf();
16+
-- 현재 세션에도 적용
17+
SET timezone TO 'UTC';

poetry.lock

Lines changed: 29 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ uvicorn = "^0.34.0"
1919
gunicorn = "^23.0.0"
2020
async-timeout = "^5.0.1"
2121
sentry-sdk = "^2.24.1"
22+
macwinua = "^0.1.2"
2223

2324
[tool.poetry.group.dev.dependencies]
2425
ruff = "^0.7.4"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ idna==3.10
3030
iniconfig==2.0.0
3131
ipython==8.32.0
3232
jedi==0.19.2
33+
macwinua==0.1.2
3334
matplotlib-inline==0.1.7
3435
multidict==6.1.0
3536
mypy==1.15.0

0 commit comments

Comments
 (0)