whythawk / full-stack-fastapi-postgresql

Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Nuxt3, Docker, automatic HTTPS and more.
MIT License
238 stars 48 forks source link

Build error project #10

Closed haidv1992 closed 1 year ago

haidv1992 commented 1 year ago

i am language not good, thank your support when i build docker not running all it is my docker container image

and pgadmin can't login image

bu when i connect with navicat it connected good

image

is my .env

DOMAIN=localhost

DOMAIN=local.dockertoolbox.tiangolo.com

DOMAIN=localhost.tiangolo.com

DOMAIN=dev.thien.com

STACK_NAME=thien-com

TRAEFIK_PUBLIC_NETWORK=traefik-public TRAEFIK_TAG=thien.com TRAEFIK_PUBLIC_TAG=traefik-public

DOCKER_IMAGE_BACKEND=backend DOCKER_IMAGE_CELERYWORKER=celeryworker DOCKER_IMAGE_FRONTEND=frontend

Backend

BACKEND_APP_MODULE=app.main:app BACKEND_CORS_ORIGINS=http://localhost:4200 BACKEND_PRE_START_PATH=/app/prestart.sh PROJECT_NAME=thien SECRET_KEY=190c2051bcd209ae63c0e81c282caf4442392a610535f39aa5bb9eda31921e1a TOTP_SECRET_KEY=changethis FIRST_SUPERUSER=admin@thien.com FIRST_SUPERUSER_PASSWORD=Admin@123 SMTP_TLS=True SMTP_PORT=587 SMTP_HOST= SMTP_USER= SMTP_PASSWORD= EMAILS_FROM_EMAIL=info@thien.com EMAILS_FROM_NAME=Symona Adaro EMAILS_TO_EMAIL=info@thien.com

USERS_OPEN_REGISTRATION=True

SENTRY_DSN=

Flower

FLOWER_BASIC_AUTH=admin:Admin@123

Postgres

POSTGRES_SERVER=db POSTGRES_USER=postgres POSTGRES_PASSWORD=changethis POSTGRES_DB=app

PgAdmin

PGADMIN_LISTEN_PORT=5050 PGADMIN_DEFAULT_EMAIL=admin@thien.com PGADMIN_DEFAULT_PASSWORD=Admin@123

Neo4j

NEO4J_SERVER=neo4j NEO4J_USERNAME=neo4j NEO4J_PASSWORD=changethis NEO4J_AUTH=neo4j:changethis NEO4J_BOLT=bolt

turukawa commented 1 year ago

Hi @haidv1992

In your .env did you make all of these definitions active at the same time?

DOMAIN=localhost
DOMAIN=local.dockertoolbox.tiangolo.com
DOMAIN=localhost.tiangolo.com
DOMAIN=dev.thien.com

Because it should just be this (assuming this is local development):

DOMAIN=localhost
# DOMAIN=local.dockertoolbox.tiangolo.com
# DOMAIN=localhost.tiangolo.com
# DOMAIN=dev.thien.com

Or is that just formatted badly? Plus:

BACKEND_CORS_ORIGINS=http://localhost:4200/

Should be a list of strings:

BACKEND_CORS_ORIGINS=["http://localhost:4200/"]

FranzForstmayr commented 1 year ago

I had the same issue but found a way to connect to the database:

docker container ls

ceba37f5d8b7   backend:latest        "python -m inboard.s…"   11 minutes ago   Up 11 minutes   0.0.0.0:8888->8888/tcp, :::8888->8888/tcp                                                                                                   bs-fastapi-nuxt-backend-1
214c8e4aa3b2   dpage/pgadmin4        "/entrypoint.sh"         11 minutes ago   Up 11 minutes   80/tcp, 443/tcp, 0.0.0.0:5050->5050/tcp, :::5050->5050/tcp                                                                                  bs-fastapi-nuxt-pgadmin-1
5651b30c2ace   celeryworker:latest   "bash /worker-start.…"   11 minutes ago   Up 11 minutes                                                                                                                                               bs-fastapi-nuxt-celeryworker-1
7c78cfc8eb36   postgres:14           "docker-entrypoint.s…"   11 minutes ago   Up 11 minutes   0.0.0.0:5432->5432/tcp, :::5432->5432/tcp                                                                                                   bs-fastapi-nuxt-db-1
8c93339d2c9d   frontend:latest       "yarn dev"               11 minutes ago   Up 11 minutes   3000/tcp                                                                                                                                    bs-fastapi-nuxt-frontend-1
5b84f6fadcf2   mher/flower:0.9.7     "flower --broker=amq…"   22 hours ago     Up 11 minutes   0.0.0.0:5555->5555/tcp, :::5555->5555/tcp                                                                                                   bs-fastapi-nuxt-flower-1
455ac7f19bbe   neo4j:5.2.0           "tini -g -- /startup…"   22 hours ago     Up 11 minutes   0.0.0.0:6477->6477/tcp, :::6477->6477/tcp, 0.0.0.0:7474->7474/tcp, :::7474->7474/tcp, 0.0.0.0:7687->7687/tcp, :::7687->7687/tcp, 7473/tcp   bs-fastapi-nuxt-neo4j-1
ea97f30d41f0   rabbitmq:3            "docker-entrypoint.s…"   22 hours ago     Up 11 minutes   4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp                                                                                         bs-fastapi-nuxt-queue-1
46478a354be7   traefik:v2.2          "/entrypoint.sh --pr…"   22 hours ago     Up 11 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:8090->8080/tcp, :::8090->8080/tcp                                                                bs-fastapi-nuxt-proxy-1

Now find your postgres id, in my case 7c78cfc8eb36

docker inspect 7c78cfc8eb36 You'll find the IP of the postgres instance at the end of the output:

                    "Gateway": "172.23.0.1",
                    "IPAddress": "172.23.0.5",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",

Use this IP address to connect in pgadmin. I don't know exactly why localhost does not work, maybe @turukawa ?

turukawa commented 1 year ago

Problem is not being able to duplicate these errors. I imagine it's something to do with docker or docker-compose being "leaky", so your development environment has some effect. Whereas when you deploy to a clean server, it's likely to be fairly similar and with few overt opinions. But ... no idea ... sorry.

turukawa commented 1 year ago

Closing for lack of response.