[bug]: not able to run hoppscotch-backend latest in docker compose
mtariqsajid opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
whenever run hoppscotch-backend it always show the error in docker
error logs
hoppscotch-backend-1 | Progress: resolved 3, reused 0, downloaded 2, added 0
hoppscotch-backend-1 | Progress: resolved 3, reused 0, downloaded 3, added 0
hoppscotch-backend-1 | Progress: resolved 4, reused 0, downloaded 3, added 0
hoppscotch-backend-1 | Progress: resolved 5, reused 0, downloaded 4, added 0
hoppscotch-backend-1 | Progress: resolved 5, reused 0, downloaded 5, added 0
hoppscotch-backend-1 | Progress: resolved 6, reused 0, downloaded 5, added 0
hoppscotch-backend-1 | Packages: +6
hoppscotch-backend-1 | ++++++
hoppscotch-backend-1 | Progress: resolved 6, reused 0, downloaded 6, added 6, done
hoppscotch-backend-1 | .../node_modules/@prisma/engines postinstall$ node scripts/postinstall.js
hoppscotch-backend-1 | .../node_modules/@prisma/engines postinstall: Done
hoppscotch-backend-1 | .../prisma@5.12.1/node_modules/prisma preinstall$ node scripts/preinstall-entry.js
hoppscotch-backend-1 | .../prisma@5.12.1/node_modules/prisma preinstall: Done
hoppscotch-backend-1 | Prisma schema loaded from prisma/schema.prisma
hoppscotch-backend-1 | Datasource "db": PostgreSQL database "postman", schema "public" at "postgres:5432"
postgres-1 | 2024-04-21 20:41:36.072 UTC [69] LOG: could not receive data from client: Connection reset by peer
hoppscotch-backend-1 |
hoppscotch-backend-1 | 5 migrations found in prisma/migrations
hoppscotch-backend-1 |
hoppscotch-backend-1 | Applying migration `20230406064219_init`
hoppscotch-backend-1 | Applying migration `20231106120154_embeds_addition`
hoppscotch-backend-1 | Applying migration `20231124104640_infra_config`
hoppscotch-backend-1 | Applying migration `20231130082054_collection_headers`
hoppscotch-backend-1 | Applying migration `20240226053141_full_text_search_additions`
hoppscotch-backend-1 |
hoppscotch-backend-1 | The following migration(s) have been applied:
hoppscotch-backend-1 |
hoppscotch-backend-1 | migrations/
hoppscotch-backend-1 | └─ 20230406064219_init/
hoppscotch-backend-1 | └─ migration.sql
hoppscotch-backend-1 | └─ 20231106120154_embeds_addition/
hoppscotch-backend-1 | └─ migration.sql
hoppscotch-backend-1 | └─ 20231124104640_infra_config/
hoppscotch-backend-1 | └─ migration.sql
hoppscotch-backend-1 | └─ 20231130082054_collection_headers/
hoppscotch-backend-1 | └─ migration.sql
hoppscotch-backend-1 | └─ 20240226053141_full_text_search_additions/
hoppscotch-backend-1 | └─ migration.sql
hoppscotch-backend-1 |
hoppscotch-backend-1 | All migrations have been successfully applied.
hoppscotch-backend-1 exited with code 0
Steps to reproduce
exact docker images version:
- hoppscotch-admin: hoppscotch/hoppscotch-admin:2024.3.0
- hoppscotch-frontend: hoppscotch/hoppscotch-frontend:2024.3.0
- hoppscotch-backend: hoppscotch/hoppscotch-backend:2024.3.0
this is the docker compose file that i am running in
docker version:
docker compose version:
docker-compose.yml
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: postman
volumes:
- ./postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432
admin:
image: adminer
restart: always
depends_on:
- postgres
ports:
- 8080:8080
hoppscotch-frontend:
image: hoppscotch/hoppscotch-frontend
ports:
- "3000:3000"
env_file: .env
restart: unless-stopped
depends_on:
- postgres
hoppscotch-backend:
image: hoppscotch/hoppscotch-backend
ports:
- "3170:3170"
env_file: .env
command: pnpx prisma migrate deploy
depends_on:
- postgres
hoppscotch-admin:
image: hoppscotch/hoppscotch-admin
ports:
- "3100:3100"
env_file: .env
restart: unless-stopped
depends_on:
- postgres
the env
# -----------------------Backend Config------------------------------#
# Prisma Config
DATABASE_URL="postgresql://root:root@postgres:5432/postman"# or replace with your database URL"
# Auth Tokens Config
JWT_SECRET=secretcode123
TOKEN_SALT_COMPLEXITY=10
MAGIC_LINK_TOKEN_VALIDITY=3
REFRESH_TOKEN_VALIDITY=604800000
ACCESS_TOKEN_VALIDITY=86400000
SESSION_SECRET=anothersecretcode123
# Hoppscotch App Domain Config
REDIRECT_URL=http://localhost:3000
WHITELISTED_ORIGINS=http://localhost:3170,http://localhost:3000,http://localhost:3100
VITE_ALLOWED_AUTH_PROVIDERS=EMAIL
# Mailer config
MAILER_SMTP_URL="smtps://377bd90ss7c20b74@mailtrap.io:8c6bdddd01f7ad6347@sandbox.smtp.mailtrap.io"
MAILER_ADDRESS_FROM=from@example.com
# Rate Limit Config
RATE_LIMIT_TTL=60
RATE_LIMIT_MAX=100
# -----------------------Frontend Config------------------------------#
# Base URLs
VITE_BASE_URL=http://localhost:3000
VITE_SHORTCODE_BASE_URL=http://localhost:3000
VITE_ADMIN_URL=http://localhost:3100
# Backend URLs
VITE_BACKEND_GQL_URL=http://localhost:3170/graphql
VITE_BACKEND_WS_URL=wss://localhost:3170/graphql
VITE_BACKEND_API_URL=http://localhost:3170/v1
# Terms Of Service And Privacy Policy Links (Optional)
VITE_APP_TOS_LINK=https://docs.hoppscotch.io/support/terms
VITE_APP_PRIVACY_POLICY_LINK=https://docs.hoppscotch.io/support/privacy
ENABLE_SUBPATH_BASED_ACCESS=false
Environment
Production
Version
Self-hosted
cc: @balub
Hi @mtariqsajid
Thanks for reaching out! I took a look at your docker-compose.yaml
file, specifically the hoppscotch-backend
service.
I noticed that the command: pnpx prisma migrate deploy
causes the backend application to run database migrations instead of starting the application itself.
So, I suggest you not to add command
in the service. Let's hoppscotch-backend
run its way. In terms of database migration, you can follow the following way,
docker compose run --entrypoint sh hoppscotch-backend
pnpx prisma migrate deploy
Hi @mtariqsajid Thanks for reaching out! I took a look at your
docker-compose.yaml
file, specifically thehoppscotch-backend
service.I noticed that the
command: pnpx prisma migrate deploy
causes the backend application to run database migrations instead of starting the application itself.So, I suggest you not to add
command
in the service. Let'shoppscotch-backend
run its way. In terms of database migration, you can follow the following way,docker compose run --entrypoint sh hoppscotch-backend pnpx prisma migrate deploy
still not working also i don't what is the issue how to enable verbose logs
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [InstanceLoader] ConfigModule dependencies initialized +46ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [InstanceLoader] PosthogModule dependencies initialized +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [InstanceLoader] InfraConfigModule dependencies initialized +3ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [InstanceLoader] TeamInvitationModule dependencies initialized +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [InstanceLoader] AdminModule dependencies initialized +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [InstanceLoader] AuthModule dependencies initialized +0ms
hoppscotch-backend-1 | Backend Server | Running in production: true
hoppscotch-backend-1 | Backend Server | Port: 8080
hoppscotch-backend-1 | Backend Server | Mon, 22 Apr 2024 08:15:45 GMT express-session deprecated undefined resave option; provide resave option at dist/main.js:19:13
hoppscotch-backend-1 | Backend Server | Mon, 22 Apr 2024 08:15:45 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at dist/main.js:19:13
hoppscotch-backend-1 | Backend Server | Enabling CORS with production settings
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RoutesResolver] AppController {/ping}: +73ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/ping, GET} route +2ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RoutesResolver] AuthController {/auth} (version: 1): +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/providers, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/signin, POST} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/verify, POST} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/refresh, GET} (version: 1) route +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/google, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/google/callback, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/github, GET} (version: 1) route +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/github/callback, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/microsoft, GET} (version: 1) route +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/microsoft/callback, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/logout, GET} (version: 1) route +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/auth/verify/admin, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RoutesResolver] SiteController {/site} (version: 1): +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/site/setup, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/site/setup, PUT} (version: 1) route +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RoutesResolver] TeamCollectionController {/team-collection} (version: 1): +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [RouterExplorer] Mapped {/team-collection/search/:teamID, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | Initialize PubSub
hoppscotch-backend-1 | Backend Server | Stopping app in 5 seconds...
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [GraphQLModule] Mapped {/graphql, POST} route +451ms
hoppscotch-backend-1 | Backend Server | [Nest] 41 - 04/22/2024, 8:15:45 AM LOG [NestApplication] Nest application successfully started +9ms
hoppscotch-backend-1 | Backend Server | Stopping app now...
hoppscotch-backend-1 | Backend Server | SIGTERM signal received
hoppscotch-backend-1 | Exiting process because Backend Server exited with code 0
hoppscotch-backend-1 exited with code 0
@mtariqsajid, Add restart: always
in your hoppscotch-backend
service. It will resolve the issue.
@mtariqsajid, Add
restart: always
in yourhoppscotch-backend
service. It will resolve the issue.
i am not able to login in admin i try mailtrap its not working
can you help me ?
also google login not working
VITE_ALLOWED_AUTH_PROVIDERS=GOOGLE,EMAIL
even though google is specify but on login screen it still show email
email env
MAILER_SMTP_URL="smtp://b00bdd74:8ccf7ad6347@sandbox.smtp.mailtrap.io"
hoppscotch-backend-1 | Backend Server | [Nest] 40 - 04/22/2024, 3:12:38 PM LOG [RouterExplorer] Mapped {/site/setup, PUT} (version: 1) route +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 40 - 04/22/2024, 3:12:38 PM LOG [RoutesResolver] TeamCollectionController {/team-collection} (version: 1): +0ms
hoppscotch-backend-1 | Backend Server | [Nest] 40 - 04/22/2024, 3:12:38 PM LOG [RouterExplorer] Mapped {/team-collection/search/:teamID, GET} (version: 1) route +1ms
hoppscotch-backend-1 | Backend Server | Initialize PubSub
hoppscotch-backend-1 | Backend Server | [Nest] 40 - 04/22/2024, 3:12:38 PM LOG [GraphQLModule] Mapped {/graphql, POST} route +389ms
hoppscotch-backend-1 | Backend Server | [Nest] 40 - 04/22/2024, 3:12:38 PM LOG [NestApplication] Nest application successfully started +7ms
hoppscotch-backend-1 | Backend Server | Query Complexity: 7
hoppscotch-backend-1 | Backend Server | Query Complexity: 7
hoppscotch-backend-1 | Backend Server | [Nest] 40 - 04/22/2024, 3:12:57 PM ERROR [ExceptionsHandler] email/failed
hoppscotch-backend-1 | Backend Server | Error: email/failed
hoppscotch-backend-1 | Backend Server | at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:15:11)
hoppscotch-backend-1 | Backend Server | at MailerService.sendEmail (/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js:39:41)
hoppscotch-backend-1 | Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
hoppscotch-backend-1 | Backend Server | at async AuthService.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:159:9)
hoppscotch-backend-1 | Backend Server | at async AuthController.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:47:31)
hoppscotch-backend-1 | Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28
hoppscotch-backend-1 | Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17
@mirarifhasan can you help please ?
Sure @mtariqsajid
Regarding Email Error
There is a known issue (#3949) with the email-module. We are trying to resolve that as soon as possible. Until it gets resolved, you may continue logging in by enabling other SSO.
Regarding Google SSO
You have to hard reset the configuration. Execute the following cmd inside your Database container:
docker exec -it <db_container_id> psql -d hoppscotch -c "TRUNCATE \"InfraConfig\";"
# Ref: https://docs.hoppscotch.io/documentation/self-host/community-edition/admin-dashboard#hard-reset-configurations
After that run the hoppscotch-backend
with .env
(containing Google SSO configs).
After successfully login to the Admin dashboard, you can enable more SSO providers and change other configs.
Sure @mtariqsajid
Regarding Email Error There is a known issue (#3949) with the email-module. We are trying to resolve that as soon as possible. Until it gets resolved, you may continue logging in by enabling other SSO.
Regarding Google SSO You have to hard reset the configuration. Execute the following cmd inside your Database container:
docker exec -it <db_container_id> psql -d hoppscotch -c "TRUNCATE \"InfraConfig\";" # Ref: https://docs.hoppscotch.io/documentation/self-host/community-edition/admin-dashboard#hard-reset-configurations
After that run the
hoppscotch-backend
with.env
(containing Google SSO configs).After successfully login to the Admin dashboard, you can enable more SSO providers and change other configs.
Google SSO work thank you
I just remove the db and re-run the migration