notesnook-sync-server
notesnook-sync-server copied to clipboard
WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
I'm using the Docker image on a Proxmox server with a N5105 CPU which doesn't appear to have AVX instructions and I'm getting the error below when the MongoDB container attempts to start:
WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
see https://jira.mongodb.org/browse/SERVER-54407
see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814
Is it possible to run an older version of MongoDB for Notesnook? Or is there another workaround someone could offer if possible please?
Many thanks in advance.
You can try using an older version of mongodb. Just need to modify the docker-compose.yml file. But it does not guarantee that Notesnook can run normally.
notesnook-db:
image: mongo:You version
initiate-rs0:
image: mongo:You version
You can try using an older version of mongodb. Just need to modify the docker-compose.yml file. But it does not guarantee that Notesnook can run normally.
Thanks for your response. I found a docker image of MongoDB which doesn't require AVX but now I'm getting some other errors.
notesnook-db
/opt/bitnami/mongodb/scripts/entrypoint.sh: line 31: exec: --: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
notesnook-initiate-rs0
/bin/sh: 1: mongosh: not found
You can try using version 4.4.9
notesnook-db:
image: mongo:4.4.9
initiate-rs0:
image: mongo:4.4.9
command:
- -c
- |
mongo mongodb://notesnook-db:27017 <<EOF
rs.initiate();
rs.status();
EOF
If the identity-server connection db times out, you can manually initialize MongoDB once.
docker compose exec -it notesnook-db /bin/bash
mongo mongodb://notesnook-db:27017
rs.initiate();
rs.status();
Exit Container and exec
docker compose up -d
This does not guarantee complete normal operation. Good luck to you
Are you sure the CPU doesn't have AVX support?
If it a VM, just use "Host" flag. CPU tab when creating a VM, or Hardware > Processors > Type to edit existing VM.
In order to have approximately the same version as expected (7.0.14, since 7.0.12 doesn't build correctly on debian bookworm), I've made a Docker file (see attached archive). Untar it and run sudo DOCKER_BUILDKIT=0 docker build -t mymongo7012 .
It'll literally takes days to build. But in the end, you'll get an image with mongoDB 7.0.14 on your computer.
You'll then need to use this compose file instead for self hosting:
x-server-discovery: &server-discovery
NOTESNOOK_SERVER_PORT: 5264
NOTESNOOK_SERVER_HOST: notesnook-server
IDENTITY_SERVER_PORT: 8264
IDENTITY_SERVER_HOST: identity-server
SSE_SERVER_PORT: 7264
SSE_SERVER_HOST: sse-server
SELF_HOSTED: 1
IDENTITY_SERVER_URL: ${AUTH_SERVER_PUBLIC_URL}
NOTESNOOK_APP_HOST: ${NOTESNOOK_APP_PUBLIC_URL}
x-env-files: &env-files
- .env
services:
validate:
image: vandot/alpine-bash
entrypoint: /bin/bash
env_file: *env-files
command:
- -c
- |
required_vars=(
"INSTANCE_NAME"
"NOTESNOOK_API_SECRET"
"DISABLE_SIGNUPS"
"SMTP_USERNAME"
"SMTP_PASSWORD"
"SMTP_HOST"
"SMTP_PORT"
"AUTH_SERVER_PUBLIC_URL"
"NOTESNOOK_APP_PUBLIC_URL"
"MONOGRAPH_PUBLIC_URL"
"ATTACHMENTS_SERVER_PUBLIC_URL"
)
for var in "$${required_vars[@]}"; do
if [ -z "$${!var}" ]; then
echo "Error: Required environment variable $$var is not set."
exit 1
fi
done
echo "All required environment variables are set."
restart: "no"
notesnook-db:
image: localhost:5000/mymongo7012:latest
pull_policy: missing
ports:
- 27017:27017
hostname: notesnook-db
volumes:
- /srv/Files/Notesnook/db:/data/db
- /srv/Files/Notesnook/db:/data/configdb
networks:
- notesnook
entrypoint: /bin/bash /usr/local/bin/docker-entrypoint.sh
command: --replSet rs0 --bind_ip_all
depends_on:
validate:
condition: service_completed_successfully
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo mongodb://localhost:27017 --quiet
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
initiate-rs0:
image: localhost:5000/mymongo7012:latest
pull_policy: missing
networks:
- notesnook
depends_on:
- notesnook-db
entrypoint: /bin/sh
command:
- -c
- |
mongo mongodb://notesnook-db:27017 <<EOF
rs.initiate();
rs.status();
EOF
notesnook-s3:
image: minio/minio:RELEASE.2024-07-29T22-14-52Z
ports:
- 9009:9000
- 9090:9090
networks:
- notesnook
volumes:
- /srv/Files/Notesnook/s3:/data/s3
environment:
MINIO_BROWSER: "on"
depends_on:
validate:
condition: service_completed_successfully
env_file: *env-files
command: server /data/s3 --console-address :9090
healthcheck:
test: timeout 5s bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
setup-s3:
image: minio/mc:RELEASE.2024-07-26T13-08-44Z
depends_on:
- notesnook-s3
networks:
- notesnook
entrypoint: /bin/bash
env_file: *env-files
command:
- -c
- |
until mc alias set minio http://notesnook-s3:9000/ ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin}; do
sleep 1;
done;
mc mb minio/attachments -p
identity-server:
image: streetwriters/identity:latest
ports:
- 8264:8264
networks:
- notesnook
env_file: *env-files
depends_on:
- notesnook-db
healthcheck:
test: wget --tries=1 -nv -q http://localhost:8264/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
MONGODB_CONNECTION_STRING: mongodb://notesnook-db:27017/identity?replSet=rs0
MONGODB_DATABASE_NAME: identity
notesnook-server:
image: streetwriters/notesnook-sync:latest
ports:
- 5264:5264
networks:
- notesnook
env_file: *env-files
depends_on:
- notesnook-s3
- setup-s3
- identity-server
healthcheck:
test: wget --tries=1 -nv -q http://localhost:5264/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
MONGODB_CONNECTION_STRING: mongodb://notesnook-db:27017/?replSet=rs0
MONGODB_DATABASE_NAME: notesnook
S3_INTERNAL_SERVICE_URL: "http://notesnook-s3:9000/"
S3_INTERNAL_BUCKET_NAME: "attachments"
S3_ACCESS_KEY_ID: "${MINIO_ROOT_USER:-minioadmin}"
S3_SERVICE_URL: "${ATTACHMENTS_SERVER_PUBLIC_URL}"
S3_REGION: "us-east-1"
S3_BUCKET_NAME: "attachments"
sse-server:
image: streetwriters/sse:latest
ports:
- 7264:7264
env_file: *env-files
depends_on:
- identity-server
- notesnook-server
networks:
- notesnook
healthcheck:
test: wget --tries=1 -nv -q http://localhost:7264/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
monograph-server:
image: streetwriters/monograph:latest
ports:
- 6264:3000
env_file: *env-files
depends_on:
- notesnook-server
networks:
- notesnook
healthcheck:
test: wget --tries=1 -nv -q http://localhost:3000/api/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
API_HOST: http://notesnook-server:5264/
PUBLIC_URL: ${MONOGRAPH_PUBLIC_URL}
networks:
notesnook:
Follow the steps discussed in #20 (except for this docker compose file) and it works
In order to have approximately the same version as expected (7.0.14, since 7.0.12 doesn't build correctly on debian bookworm), I've made a Docker file (see attached archive). Untar it and run
sudo DOCKER_BUILDKIT=0 docker build -t mymongo7012 .It'll literally takes days to build. But in the end, you'll get an image with mongoDB 7.0.14 on your computer.
Thanks for your response! Is there some way to build this and host the docker image somewhere so we don't have to build this manually over days?
I don't know, if and how I could pack the image I've built and where to store it. If you have a short how to I can do that and upload it on a file sharing website for your convenience.
Are you sure the CPU doesn't have AVX support?
If it a VM, just use "Host" flag. CPU tab when creating a VM, or Hardware > Processors > Type to edit existing VM.
I'm positive the N5105 CPU doesn't have any AVX instructions: https://www.reddit.com/r/MiniPCs/comments/146vlzq/comment/jnxamyb/
You can download my image from here
Untar the image and use docker image load mymongo7014 to load it into your machine and the docker script above to set up your own server.
I ran into this yesterday while trying to get Sync Server running on my Synology NAS. I'm going to try using an older version of Mongo for now.
I was able to get this up and running on my Synology NAS (DS220+) with several changes to the Docker Compose script:
MongoDB (notesnook-db)
- Downgraded image from mongo:7.0.x → mongo:4.4.9 (no AVX requirement for Celeron J4025).
- Changed all calls from mongosh → mongo (4.4.9 uses legacy shell).
- Adjusted healthcheck syntax to be compatible with Mongo 4.4.9:
test: echo 'try { rs.status() } catch(e) { rs.initiate() }; db.runCommand({ping:1}).ok' | mongo --quiet mongodb://localhost:27017 - Verified the container became healthy after these changes.
Replica Set Initialization (initiate-rs0)
- Ensured it waits until MongoDB is healthy before running (depends_on with condition: service_healthy).
- Modified the command to force a primary election and wait until rs.status().myState == 1.
- Changed mongosh → mongo for 4.4.9 compatibility.
And here is the complete Docker Compose script:
x-server-discovery: &server-discovery
NOTESNOOK_SERVER_PORT: 5264
NOTESNOOK_SERVER_HOST: notesnook-server
IDENTITY_SERVER_PORT: 8264
IDENTITY_SERVER_HOST: identity-server
SSE_SERVER_PORT: 7264
SSE_SERVER_HOST: sse-server
SELF_HOSTED: 1
IDENTITY_SERVER_URL: ${AUTH_SERVER_PUBLIC_URL}
NOTESNOOK_APP_HOST: ${NOTESNOOK_APP_PUBLIC_URL}
x-env-files: &env-files
- stack.env
services:
validate:
image: vandot/alpine-bash
entrypoint: /bin/bash
env_file: *env-files
command:
- -c
- |
required_vars=(
"INSTANCE_NAME"
"NOTESNOOK_API_SECRET"
"DISABLE_SIGNUPS"
"SMTP_USERNAME"
"SMTP_PASSWORD"
"SMTP_HOST"
"SMTP_PORT"
"AUTH_SERVER_PUBLIC_URL"
"NOTESNOOK_APP_PUBLIC_URL"
"MONOGRAPH_PUBLIC_URL"
"ATTACHMENTS_SERVER_PUBLIC_URL"
)
for var in "$${required_vars[@]}"; do
if [ -z "$${!var}" ]; then
echo "Error: Required environment variable $$var is not set."
exit 1
fi
done
echo "All required environment variables are set."
restart: "no"
notesnook-db:
image: mongo:4.4.9
hostname: notesnook-db
volumes:
- /volume1/docker/notesnook/db:/data/db
- /volume1/docker/notesnook/configdb:/data/configdb
networks:
- notesnook
command: --replSet rs0 --bind_ip_all
depends_on:
validate:
condition: service_completed_successfully
healthcheck:
test: echo 'try { rs.status() } catch(e) { rs.initiate() }; db.runCommand({ping:1}).ok' | mongo --quiet mongodb://localhost:27017
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
initiate-rs0:
image: mongo:4.4.9
networks:
- notesnook
depends_on:
notesnook-db:
condition: service_healthy
entrypoint: /bin/sh
command:
- -c
- |
mongo --host notesnook-db <<EOF
cfg = rs.conf() || {_id: "rs0", members: [{ _id: 0, host: "notesnook-db:27017" }]};
try { rs.initiate(cfg) } catch(e) { print("RS already initiated") };
while(rs.status().myState != 1) { print("Waiting for PRIMARY"); sleep(2); };
printjson(rs.status());
EOF
restart: "no"
notesnook-s3:
image: minio/minio:RELEASE.2024-07-29T22-14-52Z
ports:
- 9009:9000
- 9090:9090
networks:
- notesnook
volumes:
- /volume1/docker/notesnook/s3:/data/s3
environment:
MINIO_BROWSER: "on"
depends_on:
validate:
condition: service_completed_successfully
env_file: *env-files
command: server /data/s3 --console-address :9090
healthcheck:
test: timeout 5s bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
setup-s3:
image: minio/mc:RELEASE.2024-07-26T13-08-44Z
depends_on:
- notesnook-s3
networks:
- notesnook
entrypoint: /bin/bash
env_file: *env-files
command:
- -c
- |
until mc alias set minio http://notesnook-s3:9000 ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin}; do
sleep 1;
done;
mc mb minio/attachments -p
identity-server:
image: streetwriters/identity:latest
ports:
- 8264:8264
networks:
- notesnook
env_file: *env-files
depends_on:
- notesnook-db
healthcheck:
test: wget --tries=1 -nv -q http://localhost:8264/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
MONGODB_CONNECTION_STRING: mongodb://notesnook-db:27017/identity?replSet=rs0
MONGODB_DATABASE_NAME: identity
notesnook-server:
image: streetwriters/notesnook-sync:latest
ports:
- 5264:5264
networks:
- notesnook
env_file: *env-files
depends_on:
- notesnook-s3
- setup-s3
- identity-server
healthcheck:
test: wget --tries=1 -nv -q http://localhost:5264/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
MONGODB_CONNECTION_STRING: mongodb://notesnook-db:27017/?replSet=rs0
MONGODB_DATABASE_NAME: notesnook
S3_INTERNAL_SERVICE_URL: "http://notesnook-s3:9000"
S3_INTERNAL_BUCKET_NAME: "attachments"
S3_ACCESS_KEY_ID: "${MINIO_ROOT_USER:-minioadmin}"
S3_ACCESS_KEY: "${MINIO_ROOT_PASSWORD:-minioadmin}"
S3_SERVICE_URL: "${ATTACHMENTS_SERVER_PUBLIC_URL}"
S3_REGION: "us-east-1"
S3_BUCKET_NAME: "attachments"
sse-server:
image: streetwriters/sse:latest
ports:
- 7264:7264
env_file: *env-files
depends_on:
- identity-server
- notesnook-server
networks:
- notesnook
healthcheck:
test: wget --tries=1 -nv -q http://localhost:7264/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
monograph-server:
image: streetwriters/monograph:latest
ports:
- 6264:3000
env_file: *env-files
depends_on:
- notesnook-server
networks:
- notesnook
healthcheck:
test: wget --tries=1 -nv -q http://localhost:3000/api/health -O- || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 60s
environment:
<<: *server-discovery
API_HOST: http://notesnook-server:5264
PUBLIC_URL: ${MONOGRAPH_PUBLIC_URL}
networks:
notesnook:
I was able to get this up and running on my Synology NAS (DS220+) with several changes to the Docker Compose script:
MongoDB (notesnook-db)
- Downgraded image from mongo:7.0.x → mongo:4.4.9 (no AVX requirement for Celeron J4025).
- Changed all calls from mongosh → mongo (4.4.9 uses legacy shell).
- Adjusted healthcheck syntax to be compatible with Mongo 4.4.9:
test: echo 'try { rs.status() } catch(e) { rs.initiate() }; db.runCommand({ping:1}).ok' | mongo --quiet mongodb://localhost:27017- Verified the container became healthy after these changes.
Thanks mate! This is awesome - I'll give it a crack. Do you imagine that there'd be any ongoing issues running mongo v4x?