Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self hosting #1

Open
astingengo opened this issue Mar 8, 2023 · 76 comments
Open

Self hosting #1

astingengo opened this issue Mar 8, 2023 · 76 comments

Comments

@astingengo
Copy link

Hi,

When do you think the self hosting it will be available [like in docker into a raspberry pi?]

@dwarf-king-hreidmar
Copy link

I come here every few weeks to check. I'm willing to pay into a bounty to make it happen!

@sunbl0ck
Copy link

I can haz self hosting?

@binaryben
Copy link

Will this work with the mobile apps and will it require a subscription if self-hosted? Many thanks for your good work!

@thecodrr
Copy link
Contributor

thecodrr commented May 1, 2023

@binaryben yes and no. Self hosting will be free (people can donate/contribute/subscribe but it won't be mandatory).

@binaryben
Copy link

@thecodrr Thats very exciting! A truely FOSS potential alternative to Standard Notes. Will definitely be looking at donating if I end up using it.

@andersonpem
Copy link

On the watch for this.

@targor
Copy link

targor commented Sep 15, 2023

When i understand this correctly, then only one point in the todo list is still open that prevents us from using the self hosting, and that would be the "Publish on DockerHub" and maybe the documentation of it? The changing of settings urls in the client wont affect the server directly right? ..

As this seems to me not so very complicated to implement, could it be that you just intent to never implement it? It now has been some time and the selfhosting is still not available. I would really love to host this thing on my own and would appreciate if you can finish the server. I know you maybe have a lot other work to do, but it would be cool if you could finish the server or.. the "uploading of the docker image to dockerhub" soon :).

@ijustyce
Copy link

When i understand this correctly, then only one point in the todo list is still open that prevents us from using the self hosting, and that would be the "Publish on DockerHub" and maybe the documentation of it? The changing of settings urls in the client wont affect the server directly right? ..

As this seems to me not so very complicated to implement, could it be that you just intent to never implement it? It now has been some time and the selfhosting is still not available. I would really love to host this thing on my own and would appreciate if you can finish the server. I know you maybe have a lot other work to do, but it would be cool if you could finish the server or.. the "uploading of the docker image to dockerhub" soon :).

After waiting for self host for more than half a year, I used outline (https://github.com/outline/outline)

@dwarf-king-hreidmar
Copy link

On a more positive note I'm happy to help with a helm chart once the image is finalized and published.

@thecodrr
Copy link
Contributor

thecodrr commented Oct 7, 2023

As this seems to me not so very complicated to implement, could it be that you just intent to never implement it? It now has been some time and the selfhosting is still not available. I would really love to host this thing on my own and would appreciate if you can finish the server. I know you maybe have a lot other work to do, but it would be cool if you could finish the server or.. the "uploading of the docker image to dockerhub" soon :).

It will be done when it will be done. There is no timeline and we have made no promises as to when this might happen. I want to be very clear, though, that we do intend to add support for self hosting and it is one of our long term goals. The good news is that things are rapidly moving towards making this a reality. The problem, currently, is this:

We haven't yet finalized the Sync API. Making the sync server self hostable before that would be a bad idea as everyone would have to do a huge migration. Once we are done with the necessary changes and things have been fully stabilized, self hosting won't take long.

I really do appreciate everyone's patience in this regard.

@dwarf-king-hreidmar
Copy link

dwarf-king-hreidmar commented Oct 7, 2023 via email

@Aiakio
Copy link

Aiakio commented Oct 8, 2023

@binaryben yes and no. Self hosting will be free (people can donate/contribute/subscribe but it won't be mandatory).

Does that mean, pro features will be available on the self-hosted version without paying for a subscription?

@rainyskye
Copy link

Does that mean, pro features will be available on the self-hosted version without paying for a subscription?

As far as I can see yes.

u/thewisefarmerr - "Well, if someone would be willing, the could use Notesnook 100% for free by self hosting everything and enabling pro features on the clients."

Source: https://www.reddit.com/r/opensource/comments/x3ds2w/notesnook_is_now_open_source/impmrul/

@Mekacher-Anis
Copy link

updates on this? keep up the great work!!

@bleomycin
Copy link

Has there been any public update on the status of this? I have been a paying customer of Notesnook since Sept 2022 entirely because self hosting was listed as a coming soon feature. I wanted to support that development. I actually barely even use the app and continue to pay for this reason.

I never expected self hosting to remove all license fee's and want it purely to have full control of my data. I know I'm not alone in feeling a bit nervous that this may never get implemented due to the lack of updates on this topic for so long. I'm sure many of us would very much appreciate some form of official communication about this feature one way or the other.

@thecodrr
Copy link
Contributor

thecodrr commented Mar 9, 2024

@bleomycin thank you for your support; we really do appreciate it. I understand your frustration but I assure you that we 100% want to make self hosting of Notesnook possible. The current roadmap looks like this:

  1. v3 release
  2. Self hosting
  3. Third party audit

Please note that there are no planned/promised dates for any of the above so everyone's patience is really appreciated.

@Littleweisheit
Copy link

@bleomycin thank you for your support; we really do appreciate it. I understand your frustration but I assure you that we 100% want to make self hosting of Notesnook possible. The current roadmap looks like this:

1. v3 release

2. Self hosting

3. Third party audit

Please note that there are no planned/promised dates for any of the above so everyone's patience is really appreciated.

v3 has been released, looks like self-hosting is on the way!

@binaryben
Copy link

v3 has been released, looks like self-hosting is on the way!

Hmm, maybe… The option to add a URL to a self-hosted server seems to be missing from the iOS app now.

Can anyone confirm if it’s still there but just moved?

@thecodrr
Copy link
Contributor

An update for those waiting: v3 release is done. Next step (after we enter a little bit more stable territory with v3) is self hosting as promised.

@luisogandob
Copy link

Great product! I just discovered today. Self hosting will put the cherry on this. Several products out there doesn't charge for self host in order to get more users that recommend the product to impulse the paid hosted version. To be real, this can easily compete with EverNote and not all users can host a functional server.

@mackerel225
Copy link

This is another app I stumbled upon, I like how simple it is with the encryption it provides, I see that fully self-hosting solution is not yet available, as far as I follow this is the only bit that is remaining - notesnook-sync-server (the main server?). That is okay, take the time to develop this properly. I just hope that the project can maintain both, people wishing to self-host and customers willing to pay to grow the project if that is what leads are after. I also hope it will keep its privacy focused approach and not go after fancy-like buzzwords, i.e. AI

@codenyte
Copy link

codenyte commented Jul 1, 2024

Any updates?

@gyrex
Copy link

gyrex commented Jul 29, 2024

Can the devs provide an update as to when the self hosting portion of NotesNook will likely be available please?

@Kofl
Copy link

Kofl commented Jul 30, 2024

v1.0-alpha.1 was just released

@slarrain
Copy link

The alpha release is great news.
Seems that the "may never get released" theory might not be becoming true.
Looking forward to a Beta release that I can test on my NAS and report back.
Keep up the good work!

@thecodrr
Copy link
Contributor

thecodrr commented Aug 29, 2024

Everyone who can try out and test the self hosted instance of Notesnook can do so now with v3.0.16 of the clients and v1.0-alpha.7 of the server. Please let me know how the whole process goes, what issues you face, what can be improved etc. This is still very experimental so things will definitely change.

Self hosting guide (draft): https://monogr.ph/66add1680f119badfa65686f/

@azoller1
Copy link

azoller1 commented Aug 29, 2024

Ok, I have attempted to set everything up and everything appears to be running ok for all of the containers, but I am not sure if the app is connecting properly. I am testing on my android device with the lates version which is v3.0.15 for mobile as of now. I am able to put in my 3 connection URLs and is successful when testing everything. Then, I restart the app and I assume I just create a new account, so I did. Should changes be syncing now to my own instances or notesnook cloud? There doesn't seem to be any indication of files syncing when looking over my container logs. The email sent for signup wasn't sent from the "FROM" address defined in my .env file. I will try out the desktop app shortly.

Current plan only shows Basic as well.

@dyw770
Copy link
Contributor

dyw770 commented Aug 30, 2024

image
image
It seems to be not working properly. Did I make a mistake?

@dyw770
Copy link
Contributor

dyw770 commented Sep 4, 2024

And after, that work for you @dyw770 ? Does it call on the right URL ?
Or it's like me :
image

@fze015 like you. this is a bug. You can try modifying the URL of the notesnook and compiling it yourself. I have successfully compiled and implemented self hosting.

I don't get it.怎么搞的?我反向代理是Nginx Proxy Manager 搞的不知道那儿出问题了。

我是直接把网页端和桌面端里面的默认的url给改成了自己的托管服务器地址, 然后编译, 再自己托管网页端.

是程序有bug?

对, 他web端的设置服务器地址没有生效, 所以设置了没用, 如果你现在想要用这个只能自己编译web端.

图片 貌似修复了

修复了也得等他更新, 不知道啥时候会更新.

@azoller1
Copy link

azoller1 commented Sep 4, 2024

Still don't think I can get this working. I am using https and I am testing my connection/endpoints and the app says connected successfully. The app restarts and then I go to create an account and it still appears to be creating an account with notesnook cloud. There appears to be no indication of the custom servers being used within the app itself or the container logs.

@s0llvan
Copy link

s0llvan commented Sep 5, 2024

Still don't think I can get this working. I am using https and I am testing my connection/endpoints and the app says connected successfully. The app restarts and then I go to create an account and it still appears to be creating an account with notesnook cloud. There appears to be no indication of the custom servers being used within the app itself or the container logs.

Did you read the previous answers ? you need to build the web application from the repository to make it work

@tcheronneau
Copy link

After building it and successfully connect it to my custom services.
But when I try to login I get an error in the identity logs.
First a warning about CORS validation (but it's empty so it should accept everything).
Then a fail :

fail: IdentityServer4.Validation.TokenValidator[0]
      Checking for expected scope IdentityServerApi failed

Did I miss something ?

@dyw770
Copy link
Contributor

dyw770 commented Sep 5, 2024

After building it and successfully connect it to my custom services. But when I try to login I get an error in the identity logs. First a warning about CORS validation (but it's empty so it should accept everything). Then a fail :

fail: IdentityServer4.Validation.TokenValidator[0]
      Checking for expected scope IdentityServerApi failed

Did I miss something ?

This log doesn't seem to affect anything

@tcheronneau
Copy link

Hum ok but I never get any email so I cannot login.
I'm checking the postfix logs and nothing appear.

@dyw770
Copy link
Contributor

dyw770 commented Sep 5, 2024

Hum ok but I never get any email so I cannot login. I'm checking the postfix logs and nothing appear.

access signup page.

@tcheronneau
Copy link

Now I feel really dumb :) Thanks !

@phil9309
Copy link

phil9309 commented Sep 9, 2024

Still don't think I can get this working. I am using https and I am testing my connection/endpoints and the app says connected successfully. The app restarts and then I go to create an account and it still appears to be creating an account with notesnook cloud. There appears to be no indication of the custom servers being used within the app itself or the container logs.

I'm having the same problem. Everything connected fine, but I see no sign of usage and the account itself says I'm on the basic plan. Now what? I don't know how or why building the webapp myself would solve this, because I'm trying to use desktop and mobile apps, not the webapp.

@thecodrr
Copy link
Contributor

thecodrr commented Sep 9, 2024

It'll be fixed in the upcoming version. So hang on till then.

@azoller1
Copy link

azoller1 commented Oct 9, 2024

Just wanted to comment that I've been running everything smoothly for the past week or so after the most recent client app updates. Thanks again!

@ibaraki-douji
Copy link

Hello there, so i setup the self-hosted to test on a dev environment and everything worked out of the box.
The only issue i saw was the monograph URL when publishing was the original "https://monogr.ph/" URL and not the slef-hosted one defined with "MONOGRAPH_PUBLIC_URL".

Also fun fact, i didn't setup any SMTP server, and, i was able to register without issues, and as long as you change the 2FA to an application before you log out, it works (yes i was in need to comment out some lines in the compose to make it work tho)

@dyw770
Copy link
Contributor

dyw770 commented Oct 23, 2024

@ibaraki-douji Please take a look here, Monograph URL customization is being merged. https://github.com/streetwriters/notesnook/pull/6697

@codenyte
Copy link

The link is broken, it's the wrong repo

I think you meant this one streetwriters/notesnook#6697

@OiCkilL
Copy link

OiCkilL commented Oct 29, 2024

Updated to the latest version, identity-server down.

Unhandled exception. System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode : Primary } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/notesnook-db:27017" }", EndPoint: "Unspecified/notesnook-db:27017", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.
 ---> System.Net.Sockets.SocketException (00000005, 0xFFFDFFFF): Name does not resolve
   at System.Net.Dns.GetHostEntryOrAddressesCore(String, Boolean, AddressFamily, Nullable`1 )
   at System.Net.Dns.GetHostAddresses(String, AddressFamily)
   at MongoDB.Driver.Core.Connections.TcpStreamFactory.ResolveEndPoints(EndPoint initial)
   at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.BinaryConnection.Open(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnection(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.ServerMonitor.Heartbeat(CancellationToken cancellationToken)", LastHeartbeatTimestamp: "2024-10-29T07:15:36.7861252Z", LastUpdateTimestamp: "2024-10-29T07:15:36.7861289Z" }] }.
   at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.IClusterExtensions.SelectServerAndPinIfNeeded(ICluster cluster, ICoreSessionHandle session, IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Bindings.ReadPreferenceBinding.GetReadChannelSource(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Bindings.ReadBindingHandle.GetReadChannelSource(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableReadContext.Initialize(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableReadContext.Create(IReadBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.FindOperation`1.Execute(IReadBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteReadOperation[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperation[TResult](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperation[TResult](IClientSessionHandle session, IReadOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.FindSync[TProjection](IClientSessionHandle session, FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.<>c__DisplayClass48_0`1.<FindSync>b__0(IClientSessionHandle session)
   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.FindSync[TProjection](FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
   at MongoDB.Driver.FindFluent`2.ToCursor(CancellationToken cancellationToken)
   at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
   at AspNetCore.Identity.Mongo.Migrations.Migrator.Apply[TUser,TRole,TKey](IMongoCollection`1 migrationCollection, IMongoCollection`1 usersCollection, IMongoCollection`1 rolesCollection)
   at AspNetCore.Identity.Mongo.MongoIdentityExtensions.AddIdentityMongoDbProvider[TUser,TRole,TKey](IServiceCollection services, Action`1 setupIdentityAction, Action`1 setupDatabaseAction, IdentityErrorDescriber identityErrorDescriber)
   at AspNetCore.Identity.Mongo.MongoIdentityExtensions.AddIdentityMongoDbProvider[TUser](IServiceCollection services, Action`1 setupIdentityAction, Action`1 setupDatabaseAction)
   at Streetwriters.Identity.Startup.ConfigureServices(IServiceCollection services) in /src/Streetwriters.Identity/Startup.cs:line 78
   at System.RuntimeMethodHandle.InvokeMethod(Object, Void**, Signature, Boolean)
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object, Span`1, BindingFlags)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object, BindingFlags, Binder, Object[], CultureInfo)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
   at Microsoft.AspNetCore.Hosting.MethodInfoExtensions.InvokeWithoutWrappingExceptions(MethodInfo , Object, Object[] )
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object, IServiceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object, IServiceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type , HostBuilderContext, IServiceCollection, Object )
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass7_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Streetwriters.Identity.Program.Main(String[] args) in /src/Streetwriters.Identity/Program.cs:line 41
   at Streetwriters.Identity.Program.<Main>(String[] args)

@dyw770
Copy link
Contributor

dyw770 commented Oct 29, 2024

@OiCkilL check the status of notesnook-db container

@whatstevedid
Copy link

Is there a working way of disabling signups on self-hosted? The variable within the .env file doesn’t seem to do it.

It’s pretty much the only thing holding me back from leaving the server online.

@OiCkilL
Copy link

OiCkilL commented Oct 29, 2024

@OiCkilL check the status of notesnook-db container

notesnook-db also down. work with rebuild.

2024/10/29 15:14:49,stderr,  see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814

2024/10/29 15:14:49,stderr,  see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2

2024/10/29 15:14:49,stderr,  see https://jira.mongodb.org/browse/SERVER-54407

2024/10/29 15:14:49,stderr,"WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
"
$ grep -o 'avx[^ ]*' /proc/cpuinfo
avx
avx2
avx
avx2
avx
avx2
avx
avx2
avx
avx2
avx
avx2
avx
avx2
avx
avx2

@Christovftw
Copy link

Mega thanks for the streetwriters team for pushing self hosting out into alpha! I've been trying to get this up and running today and was running into a similar problem as @OiCkilL with identity-server :
#1 (comment)

2024-10-29T17:13:00.736427855Z Unhandled exception. System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode : Primary } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", Type : "ReplicaSet", State : "Connected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/notesnook-db:27017" }", EndPoint: "Unspecified/notesnook-db:27017", ReasonChanged: "Heartbeat", State: "Connected", ServerVersion: 7.0.0, TopologyVersion: { "processId" : ObjectId("67211625f05dbe0936cc7f25"), "counter" : NumberLong(0) }, Type: "ReplicaSetGhost", WireVersionRange: "[0, 21]", LastHeartbeatTimestamp: "2024-10-29T17:12:50.6156992Z", LastUpdateTimestamp: "2024-10-29T17:12:50.6157008Z" }] }.
2024-10-29T17:13:00.736500991Z    at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
2024-10-29T17:13:00.736506802Z    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
2024-10-29T17:13:00.736510819Z    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
2024-10-29T17:13:00.736514666Z    at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
2024-10-29T17:13:00.736518123Z    at MongoDB.Driver.Core.Clusters.IClusterExtensions.SelectServerAndPinIfNeeded(ICluster cluster, ICoreSessionHandle session, IServerSelector selector, CancellationToken cancellationToken)
2024-10-29T17:13:00.736521599Z    at MongoDB.Driver.Core.Bindings.ReadPreferenceBinding.GetReadChannelSource(CancellationToken cancellationToken)
2024-10-29T17:13:00.736524835Z    at MongoDB.Driver.Core.Bindings.ReadBindingHandle.GetReadChannelSource(CancellationToken cancellationToken)
2024-10-29T17:13:00.736528142Z    at MongoDB.Driver.Core.Operations.RetryableReadContext.Initialize(CancellationToken cancellationToken)
2024-10-29T17:13:00.736533301Z    at MongoDB.Driver.Core.Operations.RetryableReadContext.Create(IReadBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
2024-10-29T17:13:00.736536838Z    at MongoDB.Driver.Core.Operations.FindOperation`1.Execute(IReadBinding binding, CancellationToken cancellationToken)
2024-10-29T17:13:00.736540555Z    at MongoDB.Driver.OperationExecutor.ExecuteReadOperation[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)
2024-10-29T17:13:00.736544162Z    at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperation[TResult](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
2024-10-29T17:13:00.736564238Z    at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperation[TResult](IClientSessionHandle session, IReadOperation`1 operation, CancellationToken cancellationToken)
2024-10-29T17:13:00.736568316Z    at MongoDB.Driver.MongoCollectionImpl`1.FindSync[TProjection](IClientSessionHandle session, FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
2024-10-29T17:13:00.736571672Z    at MongoDB.Driver.MongoCollectionImpl`1.<>c__DisplayClass48_0`1.<FindSync>b__0(IClientSessionHandle session)
2024-10-29T17:13:00.736575910Z    at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
2024-10-29T17:13:00.736579317Z    at MongoDB.Driver.MongoCollectionImpl`1.FindSync[TProjection](FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)
2024-10-29T17:13:00.736582843Z    at MongoDB.Driver.FindFluent`2.ToCursor(CancellationToken cancellationToken)
2024-10-29T17:13:00.736586129Z    at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
2024-10-29T17:13:00.736589606Z    at AspNetCore.Identity.Mongo.Migrations.Migrator.Apply[TUser,TRole,TKey](IMongoCollection`1 migrationCollection, IMongoCollection`1 usersCollection, IMongoCollection`1 rolesCollection)
2024-10-29T17:13:00.736593293Z    at AspNetCore.Identity.Mongo.MongoIdentityExtensions.AddIdentityMongoDbProvider[TUser,TRole,TKey](IServiceCollection services, Action`1 setupIdentityAction, Action`1 setupDatabaseAction, IdentityErrorDescriber identityErrorDescriber)
2024-10-29T17:13:00.736597380Z    at AspNetCore.Identity.Mongo.MongoIdentityExtensions.AddIdentityMongoDbProvider[TUser](IServiceCollection services, Action`1 setupIdentityAction, Action`1 setupDatabaseAction)
2024-10-29T17:13:00.736600837Z    at Streetwriters.Identity.Startup.ConfigureServices(IServiceCollection services) in /src/Streetwriters.Identity/Startup.cs:line 78
2024-10-29T17:13:00.736604163Z    at System.RuntimeMethodHandle.InvokeMethod(Object, Void**, Signature, Boolean)
2024-10-29T17:13:00.736607169Z    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
2024-10-29T17:13:00.736610163Z    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object, Span`1, BindingFlags)
2024-10-29T17:13:00.736613339Z    at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object, BindingFlags, Binder, Object[], CultureInfo)
2024-10-29T17:13:00.736616525Z    at System.Reflection.RuntimeMethodInfo.Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
2024-10-29T17:13:00.736619491Z    at Microsoft.AspNetCore.Hosting.MethodInfoExtensions.InvokeWithoutWrappingExceptions(MethodInfo , Object, Object[] )
2024-10-29T17:13:00.736622477Z    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object, IServiceCollection)
2024-10-29T17:13:00.736625683Z    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
2024-10-29T17:13:00.736629269Z    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object, IServiceCollection)
2024-10-29T17:13:00.736643726Z    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
2024-10-29T17:13:00.736647674Z    at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type , HostBuilderContext, IServiceCollection, Object )
2024-10-29T17:13:00.736651240Z    at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass7_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
2024-10-29T17:13:00.736655689Z    at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
2024-10-29T17:13:00.736669815Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
2024-10-29T17:13:00.736673571Z    at Streetwriters.Identity.Program.Main(String[] args) in /src/Streetwriters.Identity/Program.cs:line 41
2024-10-29T17:13:00.736676757Z    at Streetwriters.Identity.Program.<Main>(String[] args)

Notably my notesnook-db has a number of different messages, trying to pick out the most relevant ones based on timestamps:

2024-10-29T17:12:59.831504144Z {"t":{"$date":"2024-10-29T17:12:59.831+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:35548","uuid":{"uuid":{"$uuid":"b3da6a29-9b2f-4a49-8d69-b032d02afc02"}},"connectionId":44,"connectionCount":5}}
2024-10-29T17:12:59.835119987Z {"t":{"$date":"2024-10-29T17:12:59.834+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn44","msg":"client metadata","attr":{"remote":"127.0.0.1:35548","client":"conn44","negotiatedCompressors":[],"doc":{"application":{"name":"mongosh 2.3.0"},"driver":{"name":"nodejs|mongosh","version":"6.8.0|2.3.0"},"platform":"Node.js v20.16.0, LE","os":{"name":"linux","architecture":"x64","version":"3.10.0-327.22.2.el7.x86_64","type":"Linux"},"env":{"container":{"runtime":"docker"}}}}}
2024-10-29T17:12:59.901487437Z {"t":{"$date":"2024-10-29T17:12:59.901+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:35550","uuid":{"uuid":{"$uuid":"3f943daa-4e47-4001-b6ef-b0eda7ee7b77"}},"connectionId":45,"connectionCount":6}}
2024-10-29T17:12:59.914925983Z {"t":{"$date":"2024-10-29T17:12:59.914+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:35552","uuid":{"uuid":{"$uuid":"225449a2-34d9-4f91-b7a7-84f99b667ce1"}},"connectionId":46,"connectionCount":7}}
2024-10-29T17:12:59.915097252Z {"t":{"$date":"2024-10-29T17:12:59.914+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn45","msg":"client metadata","attr":{"remote":"127.0.0.1:35550","client":"conn45","negotiatedCompressors":[],"doc":{"application":{"name":"mongosh 2.3.0"},"driver":{"name":"nodejs|mongosh","version":"6.8.0|2.3.0"},"platform":"Node.js v20.16.0, LE","os":{"name":"linux","architecture":"x64","version":"3.10.0-327.22.2.el7.x86_64","type":"Linux"},"env":{"container":{"runtime":"docker"}}}}}
2024-10-29T17:12:59.915239115Z {"t":{"$date":"2024-10-29T17:12:59.915+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn46","msg":"client metadata","attr":{"remote":"127.0.0.1:35552","client":"conn46","negotiatedCompressors":[],"doc":{"application":{"name":"mongosh 2.3.0"},"driver":{"name":"nodejs|mongosh","version":"6.8.0|2.3.0"},"platform":"Node.js v20.16.0, LE","os":{"name":"linux","architecture":"x64","version":"3.10.0-327.22.2.el7.x86_64","type":"Linux"},"env":{"container":{"runtime":"docker"}}}}}
2024-10-29T17:12:59.918692867Z {"t":{"$date":"2024-10-29T17:12:59.918+00:00"},"s":"I",  "c":"NETWORK",  "id":6788700, "ctx":"conn45","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":3}}
2024-10-29T17:12:59.926663317Z {"t":{"$date":"2024-10-29T17:12:59.926+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:35554","uuid":{"uuid":{"$uuid":"f730552a-d14c-47dc-9b37-63b9e27fe214"}},"connectionId":47,"connectionCount":8}}
2024-10-29T17:12:59.927264093Z {"t":{"$date":"2024-10-29T17:12:59.927+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn47","msg":"client metadata","attr":{"remote":"127.0.0.1:35554","client":"conn47","negotiatedCompressors":[],"doc":{"application":{"name":"mongosh 2.3.0"},"driver":{"name":"nodejs|mongosh","version":"6.8.0|2.3.0"},"platform":"Node.js v20.16.0, LE","os":{"name":"linux","architecture":"x64","version":"3.10.0-327.22.2.el7.x86_64","type":"Linux"},"env":{"container":{"runtime":"docker"}}}}}
2024-10-29T17:12:59.932069779Z {"t":{"$date":"2024-10-29T17:12:59.931+00:00"},"s":"I",  "c":"NETWORK",  "id":6788700, "ctx":"conn47","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":4}}
2024-10-29T17:13:00.002381722Z {"t":{"$date":"2024-10-29T17:13:00.002+00:00"},"s":"W",  "c":"QUERY",    "id":23799,   "ctx":"ftdc","msg":"Aggregate command executor error","attr":{"error":{"code":26,"codeName":"NamespaceNotFound","errmsg":"Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [local.oplog.rs] not found."},"stats":{},"cmd":{"aggregate":"oplog.rs","cursor":{},"pipeline":[{"$collStats":{"storageStats":{"waitForLock":false,"numericOnly":true}}}],"$db":"local"}}}
2024-10-29T17:13:00.100541764Z {"t":{"$date":"2024-10-29T17:13:00.100+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn44","msg":"Connection ended","attr":{"remote":"127.0.0.1:35548","uuid":{"uuid":{"$uuid":"b3da6a29-9b2f-4a49-8d69-b032d02afc02"}},"connectionId":44,"connectionCount":7}}
2024-10-29T17:13:00.100612325Z {"t":{"$date":"2024-10-29T17:13:00.100+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn47","msg":"Connection ended","attr":{"remote":"127.0.0.1:35554","uuid":{"uuid":{"$uuid":"f730552a-d14c-47dc-9b37-63b9e27fe214"}},"connectionId":47,"connectionCount":6}}
2024-10-29T17:13:00.100864895Z {"t":{"$date":"2024-10-29T17:13:00.100+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn45","msg":"Connection ended","attr":{"remote":"127.0.0.1:35550","uuid":{"uuid":{"$uuid":"3f943daa-4e47-4001-b6ef-b0eda7ee7b77"}},"connectionId":45,"connectionCount":5}}
2024-10-29T17:13:00.100972665Z {"t":{"$date":"2024-10-29T17:13:00.100+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn46","msg":"Connection ended","attr":{"remote":"127.0.0.1:35552","uuid":{"uuid":{"$uuid":"225449a2-34d9-4f91-b7a7-84f99b667ce1"}},"connectionId":46,"connectionCount":4}}
2024-10-29T17:13:00.829927051Z {"t":{"$date":"2024-10-29T17:13:00.829+00:00"},"s":"I",  "c":"-",        "id":20883,   "ctx":"conn43","msg":"Interrupted operation as its client disconnected","attr":{"opId":41750}}
2024-10-29T17:13:00.829967215Z {"t":{"$date":"2024-10-29T17:13:00.829+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn42","msg":"Connection ended","attr":{"remote":"172.22.0.4:55778","uuid":{"uuid":{"$uuid":"472e6bee-b0f1-4e53-b942-91c609920ce9"}},"connectionId":42,"connectionCount":3}}
2024-10-29T17:13:00.830013873Z {"t":{"$date":"2024-10-29T17:13:00.829+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn43","msg":"Connection ended","attr":{"remote":"172.22.0.4:55780","uuid":{"uuid":{"$uuid":"ce1e8e94-cd4e-41ad-9d13-b88dbeef2644"}},"connectionId":43,"connectionCount":2}}
2024-10-29T17:13:01.004163854Z {"t":{"$date":"2024-10-29T17:13:01.001+00:00"},"s":"W",  "c":"QUERY",    "id":23799,   "ctx":"ftdc","msg":"Aggregate command executor error","attr":{"error":{"code":26,"codeName":"NamespaceNotFound","errmsg":"Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [local.oplog.rs] not found."},"stats":{},"cmd":{"aggregate":"oplog.rs","cursor":{},"pipeline":[{"$collStats":{"storageStats":{"waitForLock":false,"numericOnly":true}}}],"$db":"local"}}}
2024-10-29T17:13:02.002462590Z {"t":{"$date":"2024-10-29T17:13:02.001+00:00"},"s":"W",  "c":"QUERY",    "id":23799,   "ctx":"ftdc","msg":"Aggregate command executor error","attr":{"error":{"code":26,"codeName":"NamespaceNotFound","errmsg":"Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [local.oplog.rs] not found."},"stats":{},"cmd":{"aggregate":"oplog.rs","cursor":{},"pipeline":[{"$collStats":{"storageStats":{"waitForLock":false,"numericOnly":true}}}],"$db":"local"}}}
2024-10-29T17:13:03.002456326Z {"t":{"$date":"2024-10-29T17:13:03.001+00:00"},"s":"W",  "c":"QUERY",    "id":23799,   "ctx":"ftdc","msg":"Aggregate command executor error","attr":{"error":{"code":26,"codeName":"NamespaceNotFound","errmsg":"Unable to retrieve storageStats in $collStats stage :: caused by :: Collection [local.oplog.rs] not found."},"stats":{},"cmd":{"aggregate":"oplog.rs","cursor":{},"pipeline":[{"$collStats":{"storageStats":{"waitForLock":false,"numericOnly":true}}}],"$db":"local"}}}

The identity-server container then exits after this error.

I also see this pop up every few seconds in the logs within notesnook-db:

2024-10-29T17:13:18.255112548Z {"t":{"$date":"2024-10-29T17:13:18.254+00:00"},"s":"I",  "c":"-",        "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"ReadConcernMajorityNotAvailableYet: Read concern majority reads are currently not possible.","nextWakeupMillis":12600}}

All other containers are healthy and running with the notable exception of the server-setup-s3 exits as I think expected based on the logs, the server-initiatite-rs0 exits as well with this log, possibly related to the above logs in the identity server

2024-10-29T17:06:46.666326567Z Current Mongosh Log ID:  672116260c954c28d95e739b
2024-10-29T17:06:46.686378993Z Connecting to:           mongodb://notesnook-db:27017/?directConnection=true&appName=mongosh+2.3.0
2024-10-29T17:06:46.928662359Z MongoNetworkError: connect ECONNREFUSED 172.22.0.2:27017

server-validate has also exited but that looks like a clean exit based on the logs.

I managed to get the notesnook instance up and running by restarting the initiate-rs0 container after everything else had been running for a few minutes, then restarting the identity-server, however the original error still comes up but it seems it doesn't "break" the container anymore if the rs0 server is running.
I then tried to connect to the instance using the Windows desktop app and get a "Could not connect to Sync server" error. I've verified the ports are open on the VPS I'm running on, I can hit the IP and those ports in a browser and get a blank page (not an error), I've also verified ports 5264, 6264, 7264, 9000 are all open as needed but still can't connect.

Any ideas? I realise we're in alpha and so support is limited, but happy to help add to documentation or troubleshoot as needed if I can help.

@allentd
Copy link

allentd commented Oct 30, 2024

@Christovftw did you use https?

Took me several hours to realize the initiate-rs0 has to exit properly (code 0) otherwise identity server won't start.

@dyw770
Copy link
Contributor

dyw770 commented Oct 30, 2024

@OiCkilL Your platform does not support running MongoDB in Docker This is usually caused by incorrect settings of the PVE virtual machine platform. You can try searching for this issue on search engines

@dyw770
Copy link
Contributor

dyw770 commented Oct 30, 2024

@Christovftw You can manually enter the notesnook-db container and execute the following command to initialize MongoDB After successful initialization, everything should become normal

mongosh mongodb://notesnook-db:27017
rs.initiate();
rs.status();

@Christovftw
Copy link

@Christovftw You can manually enter the notesnook-db container and execute the following command to initialize MongoDB After successful initialization, everything should become normal

mongosh mongodb://notesnook-db:27017
rs.initiate();
rs.status();

Thanks, sadly this didn't help - though for anyone else who comes across this and needs to enter the db container, you can use the command docker exec -it notesnook-server-notesnook-db-1 sh

The notesnook-db container returned the error MongoServerError[AlreadyInitialized]: already initialized when trying to run rs.initiate();
Then I get this from rs.status();:

{
  set: 'rs0',
  date: ISODate('2024-11-04T21:43:08.955Z'),
  myState: 1,
  term: Long('3'),
  syncSourceHost: '',
  syncSourceId: -1,
  heartbeatIntervalMillis: Long('2000'),
  majorityVoteCount: 1,
  writeMajorityCount: 1,
  votingMembersCount: 1,
  writableVotingMembersCount: 1,
  optimes: {
    lastCommittedOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    lastCommittedWallTime: ISODate('2024-11-04T21:43:05.161Z'),
    readConcernMajorityOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    appliedOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    durableOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    lastAppliedWallTime: ISODate('2024-11-04T21:43:05.161Z'),
    lastDurableWallTime: ISODate('2024-11-04T21:43:05.161Z')
  },
  lastStableRecoveryTimestamp: Timestamp({ t: 1730756575, i: 2 }),
  electionCandidateMetrics: {
    lastElectionReason: 'electionTimeout',
    lastElectionDate: ISODate('2024-11-04T21:12:55.044Z'),
    electionTerm: Long('3'),
    lastCommittedOpTimeAtElection: { ts: Timestamp({ t: 0, i: 0 }), t: Long('-1') },
    lastSeenOpTimeAtElection: { ts: Timestamp({ t: 1730754699, i: 1 }), t: Long('2') },
    numVotesNeeded: 1,
    priorityAtElection: 1,
    electionTimeoutMillis: Long('10000'),
    newTermStartDate: ISODate('2024-11-04T21:12:55.057Z'),
    wMajorityWriteAvailabilityDate: ISODate('2024-11-04T21:12:55.064Z')
  },
  members: [
    {
      _id: 0,
      name: 'notesnook-db:27017',
      health: 1,
      state: 1,
      stateStr: 'PRIMARY',
      uptime: 1815,
      optime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
      optimeDate: ISODate('2024-11-04T21:43:05.000Z'),
      lastAppliedWallTime: ISODate('2024-11-04T21:43:05.161Z'),
      lastDurableWallTime: ISODate('2024-11-04T21:43:05.161Z'),
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      electionTime: Timestamp({ t: 1730754775, i: 1 }),
      electionDate: ISODate('2024-11-04T21:12:55.000Z'),
      configVersion: 1,
      configTerm: 3,
      self: true,
      lastHeartbeatMessage: ''
    }
  ],
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1730756585, i: 1 }),
    signature: {
      hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0),
      keyId: Long('0')
    }
  },
  operationTime: Timestamp({ t: 1730756585, i: 1 })
}

I noted above and here that HTTPS is required, so I'm now running using a certbot cert, but the desktop app still gives me the error Could not connect to Sync server when hitting test connection.

Image

The server is running on a VPS running Ubuntu 22.04, the client is running the Windows Notesnook app.
Local client logs look like this:

2024-11-04T21:54:23.568Z | INFO | Auto sync requested [150868ms] 
2024-11-04T21:54:23.569Z | INFO | [notesnook-web]: Sync status updated: completed [2ms] 
2024-11-04T21:54:26.575Z | INFO | [notesnook-web]: Sync status updated: synced [3006ms] 
2024-11-04T21:56:13.387Z | INFO | [notesnook-web]: Database initialization took 155.00ms [180ms] 
2024-11-04T21:56:47.467Z | INFO | [notesnook-web]: Database initialization took 145.90ms [167ms] 
2024-11-04T21:57:25.637Z | INFO | [notesnook-web]: Database initialization took 144.90ms [164ms] 

Any other thoughts?

@valantur
Copy link

valantur commented Nov 4, 2024

With all services are healthy, for some reason the desktop app can't contact the server.

The developer tools show this, after clicking on Test Connection:
Image

And this is the line of code that it's failing:

const` v = await fetch(`${u}/version`).then(w=>w.json()).catch(()=>{}

Even though I can point the browser to https://server/version and see the JSON response.
On the server side, this may be related:

notesnook-server-1  | fail: Microsoft.AspNetCore.Server.Kestrel[13]
notesnook-server-1  |       Connection id "0HN7T3QM3I54P", Request id "0HN7T3QM3I54P:00000001": An unhandled exception was thrown by the application.
notesnook-server-1  |       System.FormatException: 'version' is not a valid 24 digit hex string.
notesnook-server-1  |          at MongoDB.Bson.ObjectId.Parse(String s)
notesnook-server-1  |          at Streetwriters.Data.Repositories.Repository`1.GetAsync(String id)
notesnook-server-1  |          at Notesnook.API.Controllers.MonographsController.GetMonographAsync(String id) in /src/Notesnook.API/Controllers/MonographsController.cs:line 116
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
notesnook-server-1  |       --- End of stack trace from previous location ---
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
notesnook-server-1  |          at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
notesnook-server-1  |          at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
notesnook-server-1  |          at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
notesnook-server-1  |          at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext)
notesnook-server-1  |          at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1)```

Any ideas on how to solve this?

@phil9309
Copy link

phil9309 commented Nov 7, 2024

After the latest update I'm locked out of my notes on all my devices, because I dont get the 2FA-Emails anymore.

My previous Gmail config was not working after the update, so I tried sendgrid but no luck either, and I don't know why. The settings are correct, because using SMTP Test Tool (https://www.gmass.co/smtp-test) I get the emails correctly.

Please help me, as I can't access my notes anymore now :(

I have the newest docker-compose.yml from here and the servers are all healthy.

This is my .env:

INSTANCE_NAME=self-hosted-notesnook-instance

NOTESNOOK_API_SECRET=XXXXXXXXXXXXXX

DISABLE_SIGNUPS=false

SMTP_USERNAME=XXXXXXXXXXX

SMTP_PASSWORD=XXXXXXXXXXXX

SMTP_HOST=smtp.sendgrid.net

SMTP_PORT=465

AUTH_SERVER_PUBLIC_URL=https://identitynotes.XXXXXX.com

NOTESNOOK_APP_PUBLIC_URL=https://app.notesnook.com

Can anyone help me?

EDIT:

I rolled back to v1.0-alpha.8, that made my 2FA work again. I cant get it to work in the beta versions.

@Littleweisheit
Copy link

And after, that work for you @dyw770 ? Does it call on the right URL ?
Or it's like me :
image

@fze015 like you. this is a bug. You can try modifying the URL of the notesnook and compiling it yourself. I have successfully compiled and implemented self hosting.

I don't get it.怎么搞的?我反向代理是Nginx Proxy Manager 搞的不知道那儿出问题了。

我是直接把网页端和桌面端里面的默认的url给改成了自己的托管服务器地址, 然后编译, 再自己托管网页端.

是程序有bug?

对, 他web端的设置服务器地址没有生效, 所以设置了没用, 如果你现在想要用这个只能自己编译web端.

图片 貌似修复了

修复了也得等他更新, 不知道啥时候会更新.

我搞不懂这个服务器搭建,Nginx Proxy Manager怎么设置都不行,不知道我错在哪儿,可以在搞个教程吗?我VPS、域名都有

@bfcns
Copy link

bfcns commented Dec 1, 2024

I made the docker instance running, but seems like the desktop client does not even try to connect it. No outgoing connections when clicking the test button.

@allentd
Copy link

allentd commented Dec 3, 2024

@Christovftw You can manually enter the notesnook-db container and execute the following command to initialize MongoDB After successful initialization, everything should become normal

mongosh mongodb://notesnook-db:27017
rs.initiate();
rs.status();

Thanks, sadly this didn't help - though for anyone else who comes across this and needs to enter the db container, you can use the command docker exec -it notesnook-server-notesnook-db-1 sh

The notesnook-db container returned the error MongoServerError[AlreadyInitialized]: already initialized when trying to run rs.initiate(); Then I get this from rs.status();:

{
  set: 'rs0',
  date: ISODate('2024-11-04T21:43:08.955Z'),
  myState: 1,
  term: Long('3'),
  syncSourceHost: '',
  syncSourceId: -1,
  heartbeatIntervalMillis: Long('2000'),
  majorityVoteCount: 1,
  writeMajorityCount: 1,
  votingMembersCount: 1,
  writableVotingMembersCount: 1,
  optimes: {
    lastCommittedOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    lastCommittedWallTime: ISODate('2024-11-04T21:43:05.161Z'),
    readConcernMajorityOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    appliedOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    durableOpTime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
    lastAppliedWallTime: ISODate('2024-11-04T21:43:05.161Z'),
    lastDurableWallTime: ISODate('2024-11-04T21:43:05.161Z')
  },
  lastStableRecoveryTimestamp: Timestamp({ t: 1730756575, i: 2 }),
  electionCandidateMetrics: {
    lastElectionReason: 'electionTimeout',
    lastElectionDate: ISODate('2024-11-04T21:12:55.044Z'),
    electionTerm: Long('3'),
    lastCommittedOpTimeAtElection: { ts: Timestamp({ t: 0, i: 0 }), t: Long('-1') },
    lastSeenOpTimeAtElection: { ts: Timestamp({ t: 1730754699, i: 1 }), t: Long('2') },
    numVotesNeeded: 1,
    priorityAtElection: 1,
    electionTimeoutMillis: Long('10000'),
    newTermStartDate: ISODate('2024-11-04T21:12:55.057Z'),
    wMajorityWriteAvailabilityDate: ISODate('2024-11-04T21:12:55.064Z')
  },
  members: [
    {
      _id: 0,
      name: 'notesnook-db:27017',
      health: 1,
      state: 1,
      stateStr: 'PRIMARY',
      uptime: 1815,
      optime: { ts: Timestamp({ t: 1730756585, i: 1 }), t: Long('3') },
      optimeDate: ISODate('2024-11-04T21:43:05.000Z'),
      lastAppliedWallTime: ISODate('2024-11-04T21:43:05.161Z'),
      lastDurableWallTime: ISODate('2024-11-04T21:43:05.161Z'),
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      electionTime: Timestamp({ t: 1730754775, i: 1 }),
      electionDate: ISODate('2024-11-04T21:12:55.000Z'),
      configVersion: 1,
      configTerm: 3,
      self: true,
      lastHeartbeatMessage: ''
    }
  ],
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1730756585, i: 1 }),
    signature: {
      hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0),
      keyId: Long('0')
    }
  },
  operationTime: Timestamp({ t: 1730756585, i: 1 })
}

I noted above and here that HTTPS is required, so I'm now running using a certbot cert, but the desktop app still gives me the error Could not connect to Sync server when hitting test connection.

Image

The server is running on a VPS running Ubuntu 22.04, the client is running the Windows Notesnook app. Local client logs look like this:

2024-11-04T21:54:23.568Z | INFO | Auto sync requested [150868ms] 
2024-11-04T21:54:23.569Z | INFO | [notesnook-web]: Sync status updated: completed [2ms] 
2024-11-04T21:54:26.575Z | INFO | [notesnook-web]: Sync status updated: synced [3006ms] 
2024-11-04T21:56:13.387Z | INFO | [notesnook-web]: Database initialization took 155.00ms [180ms] 
2024-11-04T21:56:47.467Z | INFO | [notesnook-web]: Database initialization took 145.90ms [167ms] 
2024-11-04T21:57:25.637Z | INFO | [notesnook-web]: Database initialization took 144.90ms [164ms] 

Any other thoughts?

Did you manage to get it working?

Try mapping every port to their own subdomain, so we can just put "https://sync.domain.com" in the Notesnook settings.

I made the docker instance running, but seems like the desktop client does not even try to connect it. No outgoing connections when clicking the test button.

Might just be a connection issue between server and your device if everything is running, see if you have it all done below.

  • Localhost only work within the same device
  • HTTPS is required
  • And I think a valid SSL cert is also required to connect the Android app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests