keystonejs / keystonejs/keystone

Encountering Connection Timeout Issue in Docker Container on Server Without Internet Access

Open
#9,073 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10k
Forks
1.3k
Avg merge
19h 14m
Merged PRs (30d)
19

Description

### Issue Description:
When running Keystone in a Docker container on a server without internet access, I encountered a connection timeout issue related to downloading openssl(I have installed openssl in `Dokcerfile` with `RUN apt-get update -y && apt-get install -y openssl`).

### Steps to Reproduce:

1. Build Docker image with the following Dockerfile
```
FROM node:18 AS builder
WORKDIR /src
COPY package.json yarn.lock /src/
RUN yarn install --ignore-scripts
COPY . /src

FROM node:18-slim
RUN apt-get update -y && apt-get install -y openssl
WORKDIR /app
COPY --from=builder /src/ /app/
EXPOSE 3000
CMD [ "yarn", "dev" ]
```
2. Run the container in a server without internet access.
Error Message:
```
yarn run v1.22.19
$ concurrently "keystone dev" "npm run build:css"
[1]
[1] > keystone-app@1.0.2 build:css
[1] > tailwindcss -i ./admin/styles/input.css -o ./admin/styles/output.css --watch
[1]
[1]
[1] Rebuilding...
[1]
[1] Done in 265ms.
[0] ✨ Starting Keystone
[0] ⭐️ Server listening on 0.0.0.0:3000 (http://localhost:3000/)
[0] ⭐️ GraphQL API available at /api/graphql
[0] ✨ Generating GraphQL and Prisma schemas
[0] FetchError: request to https://binaries.prisma.sh/all_commits/4bc8b6e1b66cb932731fb1bdbbc550d1e010de81/debian-openssl-3.0.x/migration-engine.sha256 failed, reason: connect ETIMEDOUT 172.67.4.173:443
[0] at ClientRequest. (/app/node_modules/@prisma/engines/dist/index.js:22625:14)
[0] at ClientRequest.emit (node:events:517:28)
[0] at ClientRequest.emit (node:domain:489:12)
[0] at TLSSocket.socketErrorListener (node:_http_client:501:9)
[0] at TLSSocket.emit (node:events:517:28)
[0] at TLSSocket.emit (node:domain:489:12)
[0] at emitErrorNT (node:internal/streams/destroy:151:8)
[0] at emitErrorCloseNT (node:internal/streams/destroy:116:3)
[0] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[0] type: 'system',
[0] errno: 'ETIMEDOUT',
[0] code: 'ETIMEDOUT'
[0] }
[0] keystone dev exited with code 1
```
### Expected Behavior:
The application should run successfully in a Docker container even without internet access.

### Additional Information:
**package.json**
```json
{
"name": "keystone-app",
"version": "1.0.2",
"private": true,
"scripts": {
"dev": "concurrently \"keystone dev\" \"npm run build:css\"",
"start": "keystone start",
"build": "keystone build",
"postinstall": "keystone build --no-ui --frozen",
"build:css": "tailwindcss -i ./admin/styles/input.css -o ./admin/styles/output.css --watch"
},
"dependencies": {
"@keystone-6/auth": "^7.0.0",
"@keystone-6/core": "^5.0.0",
"@keystone-6/fields-document": "^7.0.0",
"env-var": "^7.4.1",
"typescript": "^4.9.5"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"concurrently": "^8.2.2",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.1"
}
}

```
**Related issue** https://github.com/prisma/prisma/issues/19729

Contributor guide

Open the contributing guide

Research direction

Start with the two-stage Dockerfile and package.json scripts, then trace the `keystone dev` startup step that generates Prisma schemas. Reproduce the failure in an offline container and compare it with Prisma issue 19729; done should mean the application starts without an unavailable network download.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, node.js, typescript
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.