AFFiNE icon indicating copy to clipboard operation
AFFiNE copied to clipboard

Cannot get Affine server to run properly

Open InfamousUser opened this issue 1 year ago • 9 comments

What happened?

Following these instructions: https://docs.affine.pro/docs/self-host-affine results in errors when running the compose command. The terms AFFINE_ADMIN_EMAIL and AFFINE_ADMIN_PASSWORD are not recognized as commands. I tried specifying them inside the compose.yaml file, instead of the variables, then the system goes up, but then I get "Failed to send email. Please try again." upon entering username...

I tried pruning, I tried re-pulling fresh containers, no effect.

I selected wrong distribution version because right one isn't available.

Distribution version

Web (app.affine.pro)

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

Chrome, Firefox

Are you self-hosting?

  • [x] Yes

Relevant log output

No response

Anything else?

Using Docker 4.33.1 on Windows 10.

InfamousUser avatar Aug 11 '24 21:08 InfamousUser

Issue Status: 🆕 *Untriaged

*🆕 Untriaged

The team has not yet reviewed the issue. We usually do it within one business day. Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md

This is an automatic reply by the bot.

affine-issue-bot[bot] avatar Aug 11 '24 21:08 affine-issue-bot[bot]

I have the same issue on unraid and docker-compose. New self hosted deployments seem to be broken on stable.

BlackthornYugen avatar Aug 11 '24 21:08 BlackthornYugen

I'm running into this issue as well. Prompt when logging in: Unable to "send email", and invalid password

iwlqsi avatar Aug 12 '24 07:08 iwlqsi

Same issue

tasnim0tantawi avatar Aug 12 '24 08:08 tasnim0tantawi

we will fix it soon

forehalo avatar Aug 12 '24 08:08 forehalo

同样的问题 image

GengGode avatar Aug 12 '24 15:08 GengGode

I got the same issue in my self-host setup, it prompts "Failed to send email. Please try again." message when trying to logon. Affine Version is: 0.16.1

sinomind avatar Aug 13 '24 05:08 sinomind

same here

daawen avatar Aug 13 '24 09:08 daawen

@forehalo same here using the latest stable...

DHS1001 avatar Aug 14 '24 00:08 DHS1001

we will fix it soon

I could find same error when i copied original 'compose.yaml' file and deployed in portable. But there's no problem when i deployed manually 'compose.yaml' file which is in .github/deployment/self-host folder. Just want to let you know. Version 0.16.3 stable.

zetstream33 avatar Aug 14 '24 08:08 zetstream33

I could find same error when i copied original 'compose.yaml' file and deployed in portable.

In portable what?

But there's no problem when i deployed manually 'compose.yaml' file

What is "deployed manually"?

InfamousUser avatar Aug 14 '24 09:08 InfamousUser

we are trying the best to make selfhost instances work as expected and hopefully this PR could do it for us #7875.

I will tag a docker image asap after this pr gets merged

forehalo avatar Aug 14 '24 11:08 forehalo

Hi, I got Affine docker running with Unraid. First I installed the Docker Compose custom app. image

The docker compose feature is at the bottom of the docker page: image

I grabbed the docker compose yml from repo and only changed the paths for config, storage, redis and postgresql.

My compose file for Unraid:

services:
  affine:
    image: ghcr.io/toeverything/affine-graphql:canary
    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
      - /mnt/user/appdata/affine_selfhosted/config:/root/.affine/config
      # blob storage
      - /mnt/user/appdata/affine_selfhosted/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}
      # - [email protected]
      # - AFFINE_ADMIN_PASSWORD="affine"
      # Telemetry allows us to collect data on how you use the affine. This data will helps us improve the app and provide better features.
      # Uncomment next line if you wish to quit telemetry.
      - TELEMETRY_ENABLE=false
  redis:
    image: redis
    container_name: affine_redis
    restart: unless-stopped
    volumes:
      - /mnt/user/appdata/affine_selfhosted/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:
      - /mnt/user/appdata/affine_selfhosted/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

The Docker Compose feature of Unraid let you configure Environment variables with an .env file. But this does not work. In my config folder (mine: /mnt/user/appdata/affine_selfhosted/config there is a .env file (maybe hidden)). There I entered all my variables. Including for admin email and password. This worked.

I also got the error message "failed to send email". For this I used my gmail account. But should also work with other email providers.

Here's my .env file:

AFFINE_SERVER_PORT=3010
AFFINE_SERVER_HOST=192.168.10.4
AFFINE_SERVER_HTTPS=false
# DATABASE_URL="postgres://affine@localhost:5432/affine"

# Administrator e-Mail
AFFINE_ADMIN_EMAIL=<email address>

# Administrator Password
AFFINE_ADMIN_PASSWORD="<password>"

# Email server domain
MAILER_HOST=smtp.gmail.com

# Email server port
MAILER_PORT=587

# Email login user
[email protected]

# Email password
MAILER_PASSWORD="<Google app password"

# Postgres server Url
# DATABASE_URL=<your_database_url>

# Redis server domain/ip
# REDIS_SERVER_HOST=<your_redis_server_host>

# Redis server port
# REDIS_SERVER_PORT=<your_redis_server_port>

# Redis server user
# REDIS_SERVER_USER=<your_redis_server_user>

# Redis server password
# REDIS_SERVER_PASSWORD=<your_redis_server_password>

# Redis server database (0-20 number only)
# REDIS_SERVER_DATABASE=<your_redis_server_database>

# Email sender (not available for consumer mail service like gmail/outlook)
# MAILER_SENDER=<your_mailer_sender>

Then I got a link via email to login. I didn't got the option to login via password. In the meanwhile I can login with password. I guess I hat set the password again within the GUI.

I hope this information helps.

pyrox82 avatar Aug 15 '24 08:08 pyrox82