toeverything / AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
https://affine.pro
Other
37.89k stars 2.49k forks source link

​Can't start self hosted app due to 'connect ENETUNREACH' error #6029

Closed devaskim closed 1 week ago

devaskim commented 5 months ago

What happened?

I tried to deploy latest stable version on IPv6 only Ubuntu 22 VPS.

git clone https://github.com/toeverything/AFFiNE.git --branch stable

AFFINE_ADMIN_EMAIL=myemail AFFINE_ADMIN_PASSWORD="mypassword" docker compose -f ./.github/deployment/self-host/compose.yaml up

Distribution version

Web (app.affine.pro)

What browsers are you seeing the problem on if you're using web version?

Chrome

Are you self-hosting?

Relevant log output

affine_selfhosted  | running predeploy script.
affine_selfhosted  | yarn run v1.22.19
affine_selfhosted  | $ yarn prisma migrate deploy && node --import ./scripts/register.js ./dist/data/index.js run
affine_selfhosted  | $ /app/node_modules/.bin/prisma migrate deploy
affine_selfhosted  | Error: request to https://binaries.prisma.sh/all_commits/0ca5ccbcfa6bdc81c003cf549abe4269f59c41e5/debian-openssl-3.0.x/schema-engine.sha256 failed, reason: connect ENETUNREACH 172.67.4.173:443
affine_selfhosted  | error Command failed with exit code 1.
affine_selfhosted  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
affine_selfhosted  | error Command failed with exit code 1.
affine_selfhosted  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
affine_selfhosted  | node:internal/errors:865
affine_selfhosted  |   const err = new Error(message);
affine_selfhosted  |               ^
affine_selfhosted  |
affine_selfhosted  | Error: Command failed: yarn predeploy
affine_selfhosted  |     at checkExecSyncError (node:child_process:890:11)
affine_selfhosted  |     at execSync (node:child_process:962:15)
affine_selfhosted  |     at runPredeployScript (file:///app/scripts/self-host-predeploy.js:44:3)
affine_selfhosted  |     at file:///app/scripts/self-host-predeploy.js:52:1
affine_selfhosted  |     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
affine_selfhosted  |     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
affine_selfhosted  |     at async loadESM (node:internal/process/esm_loader:34:7)
affine_selfhosted  |     at async handleMainPromise (node:internal/modules/run_main:106:12) {
affine_selfhosted  |   status: 1,
affine_selfhosted  |   signal: null,
affine_selfhosted  |   output: [ null, null, null ],
affine_selfhosted  |   pid: 20,
affine_selfhosted  |   stdout: null,
affine_selfhosted  |   stderr: null
affine_selfhosted  | }
affine_selfhosted  |
affine_selfhosted  | Node.js v18.19.1
affine_selfhosted exited with code 0


### Anything else?

_No response_
fourdim commented 5 months ago

Did you enable docker ipv6 support? https://docs.docker.com/config/daemon/ipv6/ binaries.prisma.sh is available on ipv6 https://dns.google/query?name=binaries.prisma.sh&rr_type=AAAA&ecs=

devaskim commented 5 months ago

Did you enable docker ipv6 support? https://docs.docker.com/config/daemon/ipv6/

Tried with these settings, unfortunately no success.

Interesting thing is what I can download the following file with wget outside any Docker container, i.e. on the host machine.

https://binaries.prisma.sh/all_commits/0ca5ccbcfa6bdc81c003cf549abe4269f59c41e5/debian-openssl-3.0.x/schema-engine.sha256
fourdim commented 5 months ago

Did you follow the steps to Use IPv6 for the default bridge network? What is the output of the last step?

devaskim commented 5 months ago

Did you follow the steps to Use IPv6 for the default bridge network?

Yes

What is the output of the last step?

[+] Running 3/2
✔ Container affine_postgres    Recreated                                                                                                                       0.2s 
✔ Container affine_redis       Recreated                                                                                                                       0.2s 
✔ Container affine_selfhosted  Recreated                                                                                                                       0.0s 
Attaching to affine_postgres, affine_redis, affine_selfhosted
affine_redis       | 1:C 18 Mar 2024 04:52:40.786 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
affine_redis       | 1:C 18 Mar 2024 04:52:40.786 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
affine_redis       | 1:C 18 Mar 2024 04:52:40.786 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=1, just started
affine_redis       | 1:C 18 Mar 2024 04:52:40.786 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
affine_redis       | 1:M 18 Mar 2024 04:52:40.787 * monotonic clock: POSIX clock_gettime
affine_redis       | 1:M 18 Mar 2024 04:52:40.788 * Running mode=standalone, port=6379.
affine_redis       | 1:M 18 Mar 2024 04:52:40.789 * Server initialized
affine_redis       | 1:M 18 Mar 2024 04:52:40.790 * Loading RDB produced by version 7.2.4
affine_redis       | 1:M 18 Mar 2024 04:52:40.790 * RDB age 152335 seconds
affine_redis       | 1:M 18 Mar 2024 04:52:40.790 * RDB memory usage when created 0.85 Mb
affine_redis       | 1:M 18 Mar 2024 04:52:40.790 * Done loading RDB, keys loaded: 1, keys expired: 0.
affine_redis       | 1:M 18 Mar 2024 04:52:40.790 * DB loaded from disk: 0.001 seconds
affine_redis       | 1:M 18 Mar 2024 04:52:40.790 * Ready to accept connections tcp
affine_postgres    | 
affine_postgres    | PostgreSQL Database directory appears to contain a database; Skipping initialization
affine_postgres    | 
affine_postgres    | 2024-03-18 04:52:40.867 UTC [1] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
affine_postgres    | 2024-03-18 04:52:40.868 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
affine_postgres    | 2024-03-18 04:52:40.869 UTC [1] LOG:  listening on IPv6 address "::", port 5432
affine_postgres    | 2024-03-18 04:52:40.874 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
affine_postgres    | 2024-03-18 04:52:40.884 UTC [29] LOG:  database system was interrupted; last known up at 2024-03-18 04:50:34 UTC
affine_postgres    | 2024-03-18 04:52:40.907 UTC [29] LOG:  database system was not properly shut down; automatic recovery in progress
affine_postgres    | 2024-03-18 04:52:40.912 UTC [29] LOG:  redo starts at 0/19713A8
affine_postgres    | 2024-03-18 04:52:40.912 UTC [29] LOG:  invalid record length at 0/19713E0: expected at least 24, got 0
affine_postgres    | 2024-03-18 04:52:40.912 UTC [29] LOG:  redo done at 0/19713A8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
affine_postgres    | 2024-03-18 04:52:40.921 UTC [27] LOG:  checkpoint starting: end-of-recovery immediate wait
affine_postgres    | 2024-03-18 04:52:40.940 UTC [27] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.002 s, total=0.020 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/19713E0, redo lsn=0/19713E0
affine_postgres    | 2024-03-18 04:52:40.948 UTC [1] LOG:  database system is ready to accept connections
affine_selfhosted  | running predeploy script.
affine_selfhosted  | yarn run v1.22.19
affine_selfhosted  | $ yarn prisma migrate deploy && node --import ./scripts/register.js ./dist/data/index.js run
affine_selfhosted  | $ /app/node_modules/.bin/prisma migrate deploy
affine_selfhosted  | Error: request to https://binaries.prisma.sh/all_commits/5a9203d0590c951969e85a7d07215503f4672eb9/debian-openssl-3.0.x/libquery_engine.so.node.gz.sha256 failed, reason: 
affine_selfhosted  | error Command failed with exit code 1.
affine_selfhosted  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
affine_selfhosted  | error Command failed with exit code 1.
affine_selfhosted  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
affine_selfhosted  | node:internal/errors:932
affine_selfhosted  |   const err = new Error(message);
affine_selfhosted  |               ^
affine_selfhosted  | 
affine_selfhosted  | Error: Command failed: yarn predeploy
affine_selfhosted  |     at checkExecSyncError (node:child_process:890:11)
affine_selfhosted  |     at execSync (node:child_process:962:15)
affine_selfhosted  |     at runPredeployScript (file:///app/scripts/self-host-predeploy.js:44:3)
affine_selfhosted  |     at file:///app/scripts/self-host-predeploy.js:52:1
affine_selfhosted  |     at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
affine_selfhosted  |     at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
affine_selfhosted  |     at async loadESM (node:internal/process/esm_loader:28:7)
affine_selfhosted  |     at async handleMainPromise (node:internal/modules/run_main:113:12) {
affine_selfhosted  |   status: 1,
affine_selfhosted  |   signal: null,
affine_selfhosted  |   output: [ null, null, null ],
affine_selfhosted  |   pid: 20,
affine_selfhosted  |   stdout: null,
affine_selfhosted  |   stderr: null
affine_selfhosted  | }
affine_selfhosted  | 
affine_selfhosted  | Node.js v20.11.1
affine_selfhosted exited with code 0

Here is output from wget


admin@ssdnodes-den:~/affine$ wget https://binaries.prisma.sh/all_commits/5a9203d0590c951969e85a7d07215503f4672eb9/debian-openssl-3.0.x/libquery_engine.so.node.gz.sha256
--2024-03-18 04:54:42--  https://binaries.prisma.sh/all_commits/5a9203d0590c951969e85a7d07215503f4672eb9/debian-openssl-3.0.x/libquery_engine.so.node.gz.sha256
Resolving binaries.prisma.sh (binaries.prisma.sh)... 2606:4700:10::ac43:4ad, 2606:4700:10::6816:166d, 2606:4700:10::6816:176d, ...
Connecting to binaries.prisma.sh (binaries.prisma.sh)|2606:4700:10::ac43:4ad|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 93 [binary/octet-stream]
Saving to: ‘libquery_engine.so.node.gz.sha256’

libquery_engine.so.node.gz.sha256 100%[==================================================================================>] 93 --.-KB/s in 0s

2024-03-18 04:54:43 (61.3 MB/s) - ‘libquery_engine.so.node.gz.sha256’ saved [93/93]

fourdim commented 5 months ago

I mean, the output of this curl: image

devaskim commented 5 months ago
admin@ssdnodes-den:~/affine$ curl http://[::1]:80
Hostname: e6b185f04069
IP: 127.0.0.1
IP: ::1
IP: 172.17.0.2
IP: 2001:db8:1::242:ac11:2
IP: fe80::42:acff:fe11:2
RemoteAddr: [2001:db8:1::1]:50140
GET / HTTP/1.1
Host: [::1]
User-Agent: curl/7.81.0
Accept: */*
fourdim commented 5 months ago

Can I have a look at the modified version of your docker compose file?

devaskim commented 5 months ago

There are no changes, because I use default bridge network

services:
  affine:
    image: ghcr.io/toeverything/affine-graphql:stable
    container_name: affine_selfhosted
    command:
      ['sh', '-c', 'node ./scripts/self-host-predeploy && node ./dist/index.js']
    ports:
      - '3010:3010'
      - '5555:5555'
    depends_on:
      redis:
        condition: service_healthy
      postgres:
        condition: service_healthy
    volumes:
      # custom configurations
      - ~/.affine/self-host/config:/root/.affine/config
      # blob storage
      - ~/.affine/self-host/storage:/root/.affine/storage
    logging:
      driver: 'json-file'
      options:
        max-size: '1000m'
    restart: unless-stopped
    environment:
      - NODE_OPTIONS="--import=./scripts/register.js"
      - AFFINE_CONFIG_PATH=/root/.affine/config
      - REDIS_SERVER_HOST=redis
      - DATABASE_URL=postgres://affine:affine@postgres:5432/affine
      - NODE_ENV=production
      - AFFINE_ADMIN_EMAIL=${AFFINE_ADMIN_EMAIL}
      - AFFINE_ADMIN_PASSWORD=${AFFINE_ADMIN_PASSWORD}
  redis:
    image: redis
    container_name: affine_redis
    restart: unless-stopped
    volumes:
      - ~/.affine/self-host/redis:/data
    healthcheck:
      test: ['CMD', 'redis-cli', '--raw', 'incr', 'ping']
      interval: 10s
      timeout: 5s
      retries: 5
  postgres:
    image: postgres
    container_name: affine_postgres
    restart: unless-stopped
    volumes:
      - ~/.affine/self-host/postgres:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U affine']
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      POSTGRES_USER: affine
      POSTGRES_PASSWORD: affine
      POSTGRES_DB: affine
      PGDATA: /var/lib/postgresql/data/pgdata

But I tested both with adding network

 networks:
   ip6net:
     enable_ipv6: true
     ipam:
       config:
         - subnet: 2001:0DB8::/112
devaskim commented 4 months ago

@fourdim do you have any other ideas?

fourdim commented 4 months ago

@fourdim do you have any other ideas?

I'm sorry but I don't have any ideas.

jovazxc commented 4 months ago

i'm facing the same problem, any thoughts about it ?

affine_selfhosted  | Error: request to https://binaries.prisma.sh/all_commits/5a9203d0590c951969e85a7d07215503f4672eb9/debian-openssl-3.0.x/schema-engine.sha256 failed, reason:
affine_selfhosted  | error Command failed with exit code 1.
affine_selfhosted  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
affine_selfhosted  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
affine_selfhosted  | error Command failed with exit code 1.
affine_selfhosted  | node:internal/errors:984