Comments (23)
I was able to complete this just using the GraphQL API, but it requires quite a bit of tinkering to do. Looking forward to the email documentation is completed. In short if anybody else needs it:
https://localhost:3010/graphql
Go to settings and enable:
"request.credentials": "include"
This makes cookies work in the playground so you can login and do operations.
Sign up with a second account:
mutation {
signUp(email: "[email protected]", name: "Second", password: "123") {
id
}
}
Sign into the first account and create an invite
mutation {
signIn(email: "[email protected]", password:"123") {
id
name
}
}
Find your workspace ID, in the browser make sure it's cloud synced then copy the id in the url http://localhost/workspace/<id>/
Then create an invite, this will return an ID, take note of it
mutation {
invite(
email: "[email protected]"
permission: Admin
sendInviteMail: false
workspaceId: "xxx-xxx-xx-xxx-xxx"
)
}
Sign into the second account
mutation {
signIn(email: "[email protected]", password:"123") {
id
name
}
}
Then accept the invite
mutation {
acceptInviteById(
inviteId: "copy-id-from-invite-mutation"
sendAcceptMail: false
workspaceId: "your-workspace-id"
)
}
Anyway, that was my approach for now.
from affine.
It's actually quite simple to configure the mailing service. After deployment, I took a look inside the configuration directory which includes a file named affine.env.js
containing all possible environment variable keys. Here's the section responsible for getting the SMTP config:
MAILER_HOST: 'mailer.host',
MAILER_PORT: ['mailer.port', 'int'],
MAILER_USER: 'mailer.auth.user',
MAILER_PASSWORD: 'mailer.auth.pass',
MAILER_SENDER: 'mailer.from.address',
MAILER_SECURE: ['mailer.secure', 'boolean'],
So you just need to pass in these environment variables during startup and all should be good.
from affine.
You should need to configure the mail service on the selfhost docker, we are preparing a document about this.
from affine.
We have a new document about all configurable environment variables.
https://docs.affine.pro/docs/self-host-affine/run-affine-with-custom-options
from affine.
By the way, I see that AFFiNE Cloud storage is 10GB, and there is a storage limit for self hosted?
from affine.
selfhost should have unlimited storage.
I haven't tested it yet, but if you encounter storage size limitations it should be a bug and you can open an issue.
from affine.
It's actually quite simple to configure the mailing service. After deployment, I took a look inside the configuration directory which includes a file named
affine.env.js
containing all possible environment variable keys. Here's the section responsible for getting the SMTP config:MAILER_HOST: 'mailer.host', MAILER_PORT: ['mailer.port', 'int'], MAILER_USER: 'mailer.auth.user', MAILER_PASSWORD: 'mailer.auth.pass', MAILER_SENDER: 'mailer.from.address', MAILER_SECURE: ['mailer.secure', 'boolean'],
So you just need to pass in these environment variables during startup and all should be good.
Hi, I tried your solution but not working for me. I want to configure gmail.
Can you help me ?
from affine.
@Jycreyn I managed to get the mailing service working with Gmail.
You have the MAILER_HOST
and MAILER_PORT
correct.
MAILER_USER
needs to be your email address
MAILER_PASSWORD
is the app password that I set using this docs: https://support.google.com/accounts/answer/185833?hl=en
I didn't have to set MAILER_SENDER
.
from affine.
Yeah, I used app password. You did not use "MAIL_SECURE" either ?
thanks
from affine.
@Jycreyn no, I didn't
from affine.
you left spaces in the password ?
from affine.
@Jycreyn no, the password should be the 16 digits characters without spaces.
from affine.
And not working
password is the 16 digit without the spacesn user is my email.
Anything wrong ?
Need to add something in docker compose ?
from affine.
@Jycreyn did you add those environment variable to your docker compose file?
It should look like this for the environment variable of the affine container:
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}
- AFFINE_SERVER_HOST=${AFFINE_SERVER_HOST}
- AFFINE_SERVER_PORT=${AFFINE_SERVER_PORT}
- AFFINE_SERVER_HTTPS=${AFFINE_SERVER_HTTPS}
- MAILER_HOST=${MAILER_HOST}
- MAILER_PORT=${MAILER_PORT}
- MAILER_USER=${MAILER_USER}
- MAILER_PASSWORD=${MAILER_PASSWORD}
from affine.
Mhh no, i forgot to put it in docker compose. fck me ...
I see "affine server https" u managed to put it in HTTPS without reverse proxy ?
from affine.
Okay mailer is working I can invite people !!
Thank you !
I'm missing something about HTTPS, i put the AFFINE_SERVER_HTTPS to true but not working; SSL error it's still in HTTP. What do i need to add ?
And also maybe you know, i can only have 3 members ? even in self host ? and for storage the same limited to 10gb in self?
Again thank you so much for you'r help
from affine.
@Jycreyn Ah, I forgot to exclude those variables in my example. AFFINE_SERVER_HOST
, AFFINE_SERVER_PORT
, and AFFINE_SERVER_HTTPS
are extra variables that I added myself and are not related to the mailing service.
To answer your question, yes. I use Cloudflared to expose my AFFiNE container publicly using my own domain, and it works with HTTPS; hence the extra variables above. It is out of the topic of this issue, so I will just add the docs here.
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/
from affine.
@Jycreyn As for the members limit, I only added one other member and haven't added more. You can try adding more and let me know how it goes :). Also, I'm not sure about the storage limit.
from affine.
It's actually quite simple to configure the mailing service. After deployment, I took a look inside the configuration directory which includes a file named
affine.env.js
containing all possible environment variable keys. Here's the section responsible for getting the SMTP config:MAILER_HOST: 'mailer.host', MAILER_PORT: ['mailer.port', 'int'], MAILER_USER: 'mailer.auth.user', MAILER_PASSWORD: 'mailer.auth.pass', MAILER_SENDER: 'mailer.from.address', MAILER_SECURE: ['mailer.secure', 'boolean'],
So you just need to pass in these environment variables during startup and all should be good.
you sure these configuration items are included?
didn't see it in this link
https://docs.affine.pro/docs/self-host-affine
from affine.
you sure these configuration items are included? didn't see it in this link https://docs.affine.pro/docs/self-host-affine
Yes, those are the environment variables accessed by the app. We can add that to the container environment variables, and the app will be able to use them. We just need to add those in the docs, as it seems like it's still in progress.
from affine.
services:
affine:
image: ghcr.io/toeverything/affine-graphql:canary
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
- /volume1/docker/affine/config:/root/.affine/config
# blob storage
- /volume1/docker/affine/storage:/root/.affine/storage
#logging:
#driver: 'json-file'
#options:
#max-size: '1000m'
restart: unless-stopped
environment:
#- NODE_OPTIONS=--es-module-specifier-resolution=node
- 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_SERVER_HTTPS=false
- AFFINE_ADMIN_EMAIL=***
- AFFINE_ADMIN_PASSWORD=***
#- SERVER_FLAVOR=selfhosted
- MAILER_HOST=smtp.163.com
- MAILER_PORT=25
- MAILER_USER=***
- MAILER_PASSWORD=***
redis:
image: redis
container_name: affine_redis
restart: unless-stopped
volumes:
- /volume1/docker/affine/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:
- /volume1/docker/affine/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
send email error
{
"errors": [
{
"message": "Failed to send invite email. Please try again.",
"locations": [
{
"line": 3,
"column": 3
}
],
"path": [
"invite"
],
"extensions": {
"code": 500,
"status": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
use /graphql
same error
from affine.
@fish-uncle Sorry for the late reply.
According to this error, there may be a issue with your email configuration.
Are there any relevant error logs on the server?
Use docker compose tail
to check the server logs.
from affine.
services: affine: image: ghcr.io/toeverything/affine-graphql:canary 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 - /volume1/docker/affine/config:/root/.affine/config # blob storage - /volume1/docker/affine/storage:/root/.affine/storage #logging: #driver: 'json-file' #options: #max-size: '1000m' restart: unless-stopped environment: #- NODE_OPTIONS=--es-module-specifier-resolution=node - 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_SERVER_HTTPS=false - AFFINE_ADMIN_EMAIL=*** - AFFINE_ADMIN_PASSWORD=*** #- SERVER_FLAVOR=selfhosted - MAILER_HOST=smtp.163.com - MAILER_PORT=25 - MAILER_USER=*** - MAILER_PASSWORD=*** redis: image: redis container_name: affine_redis restart: unless-stopped volumes: - /volume1/docker/affine/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: - /volume1/docker/affine/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
send email error
{ "errors": [ { "message": "Failed to send invite email. Please try again.", "locations": [ { "line": 3, "column": 3 } ], "path": [ "invite" ], "extensions": { "code": 500, "status": "INTERNAL_SERVER_ERROR" } } ], "data": null }
use
/graphql
same error
I noticed that you are using a consumer-grade email provider.
For this type of email provider (including gmail, outlook, etc.), if you want to directly use the username-password method, you need to generate an "application-specific password".
For Google , you can generate here: https://myaccount.google.com/apppasswords
For other email providers, you may need to find related options in the settings
from affine.
Related Issues (20)
- windows controls missing in all page route HOT 2
- Reference to other Blocks HOT 8
- Custom font families HOT 2
- Emails sent have a non-usable action button HOT 4
- Shortcut ⌥+S stands for "ś" in Polish HOT 3
- Images that support markdown syntax HOT 3
- Can't login when upgrading to beta HOT 7
- Create Collection cannot be exited with ESC HOT 1
- TypeError: Cannot read properties of undefined (reading 'history') HOT 1
- error: always show 5xx wrong HOT 4
- React ErrorBoundary TypeError: Cannot read properties of undefined (reading 'match') HOT 2
- Self-hosted: add config for turn off signup feature HOT 2
- selfhost: Upgrade to 0.13 stable causes unhealthy postgres HOT 3
- feature Implementation: Preview Link Document in Popover or New Window HOT 3
- Enhance OFFLINE app prefer workflow for "Cloud Synced Workspaces" HOT 3
- Impossible to self-host AFFiNE stable/canary HOT 7
- The position of menubar icon when unfolding is not correct, comparing to the web version HOT 2
- add self-hosted plan for self-hosted flavor HOT 29
- The app flashes a white screen on startup HOT 5
- Suggestions for sidebar area adjustments HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from affine.