p574쪽(postgres) 진행이 안되고 있습니다. 도움 부탁드립니다.
1 year, 11 months ago
joon
postgres 셋팅후 docker-compose build하고 나서 docker-compose up을 실행했는데
do_it_django_a_to_z-web-1 exited with code 139가 발생했습니다.
이후 진행을 못하고 있습니다.
참고로 콘솔 로그에 말씀하신 psycopg2는 없었습니다.
도움 부탁드립니다. 감사합니다.
docker-compose build 결과입니다.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
D:\github\do_it_django_a_to_z (main -> origin)
λ docker-compose build
time="2023-04-24T13:38:58+09:00" level=warning msg="The \"b7\" variable is not set. Defaulting to a blank s
tring."
[+] Building 8.9s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.8.0-slim-buster 2.1s
=> [internal] load build context 6.6s
=> => transferring context: 1.57MB 6.4s
=> [1/5] FROM docker.io/library/python:3.8.0-slim-buster@sha256:8e243f41e500238f78f7a29a81656114d3f 0.0s
=> CACHED [2/5] WORKDIR /usr/src/app 0.0s
=> CACHED [3/5] COPY . /usr/src/app/ 0.0s
=> CACHED [4/5] RUN pip install --upgrade pip 0.0s
=> CACHED [5/5] RUN pip install -r requirements.txt 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:476fdb25f50ad48e6ad3c7a01f28f3855c7d23372806b7adaa66411d94b743bc 0.0s
=> => naming to docker.io/library/do_it_django_a_to_z-web 0.0s
docker-compose up 결과입니다.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
D:\github\do_it_django_a_to_z (main -> origin)
λ docker-compose up
time="2023-04-24T13:40:20+09:00" level=warning msg="The \"b7\" variable is not set. Defaulting to a blank s
tring."
[+] Running 9/9
✔ db 8 layers [⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 10.0s
✔ 89d9c30c1d48 Pull complete 1.1s
✔ 66ddea140797 Pull complete 1.1s
✔ 977cf4e465c1 Pull complete 1.2s
✔ ba931f945c10 Pull complete 5.9s
✔ 7b61205fe7a7 Pull complete 6.0s
✔ 2beee0482414 Pull complete 6.2s
✔ c2d37df49a3b Pull complete 6.3s
✔ 8c44ef2c13b8 Pull complete 6.5s
[+] Running 4/4
✔ Network do_it_django_a_to_z_default Created 0.2s
✔ Volume "do_it_django_a_to_z_postgres_data" Create... 0.0s
✔ Container do_it_django_a_to_z-db-1 Created 0.9s
✔ Container do_it_django_a_to_z-web-1 Created 0.4s
Attaching to do_it_django_a_to_z-db-1, do_it_django_a_to_z-web-1
do_it_django_a_to_z-db-1 | The files belonging to this database system will be owned by user "postgres".
do_it_django_a_to_z-db-1 | This user must also own the server process.
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | The database cluster will be initialized with locale "en_US.utf8".
do_it_django_a_to_z-db-1 | The default database encoding has accordingly been set to "UTF8".
do_it_django_a_to_z-db-1 | The default text search configuration will be set to "english".
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | Data page checksums are disabled.
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
do_it_django_a_to_z-db-1 | creating subdirectories ... ok
do_it_django_a_to_z-db-1 | selecting dynamic shared memory implementation ... posix
do_it_django_a_to_z-db-1 | selecting default max_connections ... 100
do_it_django_a_to_z-db-1 | selecting default shared_buffers ... 128MB
do_it_django_a_to_z-db-1 | selecting default time zone ... UTC
do_it_django_a_to_z-db-1 | creating configuration files ... ok
do_it_django_a_to_z-db-1 | running bootstrap script ... ok
do_it_django_a_to_z-db-1 | sh: locale: not found
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:34.733 UTC [28] WARNING: no usable system locales were found
do_it_django_a_to_z-db-1 | performing post-bootstrap initialization ... ok
do_it_django_a_to_z-db-1 | syncing data to disk ... ok
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | Success. You can now start the database server using:
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | initdb: warning: enabling "trust" authentication for local connections
do_it_django_a_to_z-db-1 | You can change this by editing pg_hba.conf or using the option -A, or
do_it_django_a_to_z-db-1 | --auth-local and --auth-host, the next time you run initdb.
do_it_django_a_to_z-db-1 | waiting for server to start....2023-04-24 04:40:35.904 UTC [32] LOG: starting
PostgreSQL 12.0 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:35.909 UTC [32] LOG: listening on Unix socket "/var/run/post
gresql/.s.PGSQL.5432"
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:35.945 UTC [33] LOG: database system was shut down at 2023-0
4-24 04:40:35 UTC
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:35.953 UTC [32] LOG: database system is ready to accept conn
ections
do_it_django_a_to_z-db-1 | done
do_it_django_a_to_z-db-1 | server started
do_it_django_a_to_z-db-1 | CREATE DATABASE
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | waiting for server to shut down....2023-04-24 04:40:36.226 UTC [32] LOG: rece
ived fast shutdown request
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.231 UTC [32] LOG: aborting any active transactions
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.232 UTC [32] LOG: background worker "logical replication
launcher" (PID 39) exited with exit code 1
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.232 UTC [34] LOG: shutting down
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.265 UTC [32] LOG: database system is shut down
do_it_django_a_to_z-db-1 | done
do_it_django_a_to_z-db-1 | server stopped
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | PostgreSQL init process complete; ready for start up.
do_it_django_a_to_z-db-1 |
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.345 UTC [1] LOG: starting PostgreSQL 12.0 on x86_64-pc-li
nux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.345 UTC [1] LOG: listening on IPv4 address "0.0.0.0", por
t 5432
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.345 UTC [1] LOG: listening on IPv6 address "::", port 543
2
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.356 UTC [1] LOG: listening on Unix socket "/var/run/postg
resql/.s.PGSQL.5432"
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.393 UTC [43] LOG: database system was shut down at 2023-0
4-24 04:40:36 UTC
do_it_django_a_to_z-db-1 | 2023-04-24 04:40:36.404 UTC [1] LOG: database system is ready to accept conne
ctions
do_it_django_a_to_z-web-1 exited with code 139
settings.py는 다음과 같습니다>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DATABASES = {
'default': {
'ENGINE': os.environ.get("SQL_ENGINE", 'django.db.backends.sqlite3'),
'NAME': os.environ.get('SQL_DATABASE', os.path.join(BASE_DIR, 'db.sqlite3')),
'USER': os.environ.get('SQL_USER', 'user'),
'PASSWORD': os.environ.get('SQL_PASSWORD', 'password'),
'HOST': os.environ.get('SQL_HOST', 'localhost'),
'PORT': os.environ.get("SQL_PORT", '5432'),
}
}
.env.dev는 다음과 같습니다>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DEBUG=1
SECRET_KEY=django-insecure-**************************************qqs
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
SQL_ENGINE=django.db.backends.postgresql
SQL_DATABASE=do_it_django_dev
SQL_USER=do_it_django_db_user
SQL_PASSWORD=do_it_django_db_password
SQL_HOST=db
SQL_PORT=5432
docker-compose.yml은 다음과 같습니다>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
version: '3'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./:/usr/src/app/
ports:
- 8000:8000
env_file:
- ./.env.dev
depends_on:
- db
db:
image: postgres:12.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=do_it_django_db_user
- POSTGRES_PASSWORD=do_it_django_db_password
- POSTGRES_DB=do_it_django_dev
volumes:
postgres_data:
Leave a Comment: