Open tessus opened 6 years ago
An idea how this could be implemented:
database.sqlite
to default.sqlite
default.sqlite
--profile xyz
is specified, create and/or use database xyz.sqlite
Or you could use separate profile directories (default
, xyz
, …) in .config/joplin(-desktop)
.
That would be super useful indeed! Example use-case:
I use Joplin for various topics, I would like to be able to sync my "work" notes while at work without having to sync my personal ones for instances. On my phone, on the other hand, I do not want my "work" notes (because they are useless there and for obvious security reasons).
@tessus I saw your comment on the forum, is the --profile
option implemented? Is it documented somewhere?
is the
--profile
option implemented?
Yes.
Is it documented somewhere?
Nope, not that I'm aware of.
Could you please briefly explain how it works? Is it similar to Firefox profile (dedicated folder and config for each profile)?
Edit: and is it stable/safe to use?
Can we please move the discussion to the forum? I'd like to keep this for the feature request.
any progress on that so we can run multi instances of joplin?
my current work around is that i use 2 virtual machines
@b1n4ryj4n not that I am aware of. I don't know what @laurent22's current opinion about this is. Maybe you can add a comment in the corresponding topic on the forum and also click on the above (1st post).
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "backlog" and I will leave it open. Thank you for your contributions.
This is definitely still relevant to anyone who wants to separate "Work" and "Personal" notes, share a computer, and many other use-cases.
By the way, what's the purpose of having multiple sync targets for work and personal? Can't you use one notebook (with sub-notebooks) for work and another one for personal? Even if multiple sync targets were supported, that's how it would look on the sidebar: one folder per sync target. Just trying to understand what's actually needed.
I love Joplin, and it instantly became my preferred manner of keeping notes, but I don't want my coworkers (or work IT) potentially having access to my personal notes which can contain sensitive information. At the same time, I sometimes work from home or get calls at odd hours, and it's necessary for me to be able to access my work notes from a home system, or even mobile (which is much more difficult than running a second copy in dev mode).
Allowing a particular folder to have a different sync target would potentially be useful, especially in mobile. If I could assign my Work folder to be a separate sync target, that would resolve my issue. I could use that sync target alone at work, and add it as a folder at home.
Having separate sync targets in separate folders would also provide the additional benefit of being able to move notes between targets, though I don't know what would happen to their history entries in this case. My greater concern would be tags. If I have around 30 home tags, and around 30 work tags, having them mix around would make it harder to find things, particularly in the case where I use my work tags only a few days a month. There's also the question of what happens to other top level folders by default, if no sync target is defined. I would definitely be happy with an approach along these lines if it can address these various issues. A second instance just seemed to be the simpler method, to me.
I hope this better explains my use case, however, and I'd be happy to answer any other questions you may have.
Ok I think I got a bit confused between multiple sync target support, and multiple instance support. The first one would be insanely complex, but the second is do-able. @tessus, I forgot what was the state of the discussion for this? I believe that's what we got to:
Just use the existing --profile
flag to point to one profile or another.
Internally, do the multiple instance check based on the profile. If I launch joplin --profile ~/work
and then joplin --profile ~/perso
it works. However, if I launch again joplin --profile ~/work
again the multi-instance check prevents the app from starting a second instance.
We need a memory lock or some way to share memory to allow checking if an app with a given profile is running or not.
As bonus, we should change the Joplin icon background depending the profile. If no profile is specified, we use the default blue, if one is set, we dynamically change the colour so that it's easy to know which is which in the system tray.
I think that's all we would need, is that right?
Yes, I figured that multi-instance would be far more possible. I'm quite happy with the --profile solution. I can simply create different shortcuts to launch my different profiles. The only issue I see is that there is in fact a check of some sort to prevent opening multiple instances (which is not done in dev mode -- I seem to remember being able to run multiple dev mode instances). Splitting that check up properly so it's bound to the profile dir rather than just the application itself should solve the whole thing.
I like your icon idea. Perhaps even a setting for icon color at some point. (I think there's some kind of theme system already, which manual overrides might fit into?)
I don't think there's anything else required that you haven't already listed.
I would definitely appreciate the ability to easily use multiple profiles at once, so thank you very much for taking the time to look into this.
@laurent22 yes, you almost remember correctly. But it's just the first part. This helps with the desktop app, but not with mobile. The next step is to add a UI option to switch profiles. The hardest part of this is to reset all the states to zero (as if the app was not running), but the rest should be fairly easy..
For the desktop app a memory lock would do the trick. Unfortunately shared memory is not available for nodejs thus we have a problem.
The only thing I could find is https://www.npmjs.com/package/mmap-object, although I haven't checked if we could really use it. It might be easier to write a new module that uses shm_open instead of mmap. (Scratch that, I have no idea how to do that on Windows. I can do it on macOS and Linux, but I am lost in the Windows area.)
Please do not use --profile. Let users create more then one sync target inside the software and assing sync target to the notebook holding notes and todos. Assing a color to the sync target and the displayed data out of it.
@tessus, right it's true that the mobile app also needs to be supported. There's a package to restart a RN app so maybe we could use that: https://www.npmjs.com/package/react-native-restart Internally it would be best if it still works the same with the app pointing to one folder or another.
@laurent22
Internally it would be best if it still works the same with the app pointing to one folder or another.
right, the question is, how do we handle that? e.g. if we had a structure like so:
.config/joplin(-desktop)/
profile1/
profile2/
we could scan the one parent directory to retrieve all profile names and present them in the UI.
@vsatmydynipnet as you have seen from previous comments, this would be very complicated to implement. Joplin was not designed to do that, so making this possible would mean a major rewrite and refactoring of the code. I doubt that anyone (I'm pretty sure that would have to be Laurent though) has the time to do that.
@laurent22 Even something like .config/joplin(-desktop)/profile1/profile.name
could be used as meta data file for retrieving the profile name. The structure I suggested is only necessary to scan recursively, otherwise we'd need some array with profile directories (and the question is who fills that array? the user via a setting?)
@tessus Something like what Firefox does with its profiles.ini would work nicely. Joplin can add any new profile the user creates or specifies to some json or similar file, perhaps even with its path, if I want to put it somewhere special as an advanced user. This method works for both simple and advanced users.
@laurent22 There are certainly a lot of potentially useful features here, but rather than getting too bogged down in them, I would suggest as a first step, to simply make --profile
work correctly. Everything else is dependent on this functionality anyway, and it would allow us to make use of the feature right away while everything else is nailed down.
Swiching profiles
To switch profile, save a value to Setting table called "next_profile_id", then close and restart the app. When the app starts it loads "profile.ini", then checks the value of "next_profile_id", and uses that to choose and load the right profile.
Locking per profile
Could you implement it in a way, that in the "switch" menu you can choose to
This would be very nice and would solve most of the questions about multiple instances / multiple sync targets etc. From my very top level view, this should be possible, because you have to implement the per-profile-locking anyway.
What is your opinion laurent?
I also need this feature. I think there are two ways to implement it, both have been mentioned above.
Please lets create different sync targets, set a default target and assign notebooks to sync targets. That way one can have all of his notes, private, company, charity, whatever in one display. Thank you.
Is there any new about this feature? Is the --profile option working? It would be so useful for us.
Thanks in advance.
Hello the --profile is working but this is only half way since you have to close one session and open the other. It would be great to switch profiles from "within" the application.
There's a discussion about it to try to narrow down the spec: https://discourse.joplinapp.org/t/gsoc-idea-support-for-multiple-profiles/6333/41?u=laurent Feel free to contribute to it, and let us know how you think the multiple profile feature should work.
For the record, the --profile
flag is an internal one used for development, so you might run into troubles when using it.
Thanks for the update, I did not knew that it is for dev only -- it works fine, as of now Even more a point for me to please vote up for using what now different profiles, instances... e.g just to split work notes from private notes. Or if I missed to point how to best do this .. I'd be happy about some explainations
The thing is that we're focusing on the solution (multiple profile support) and not so much on the problem, which for me is not well defined.
Multiple notebooks, one for work, one for personal, for example would achieve "multiple profiles" for many users. If that's not sufficient, what's missing? Perhaps there's some simple feature that can be added to solve the issue, without the complexity of multiple physical profiles.
Hello @laurent22 thanks for the answer, let me elaborate the problem. To split eg. work and private in two notebooks works perfectly well. But not always you want to have your private notebook (and its subnotebooks) visble when you use Joplin also for work related issues. An other point is to separate project, when we stay with work. E.g. attachments will be stored in the same folder for all notebooks, this might not be wanted when you think of completely different projects. In case you want to archive a project you can do this on various ways via the export but the data (as in attachments) will stay, so if this would be split, we could zip and archive. And a further point is that the risk of loss is less high when you split an more than one profile(?) since we than have an underlying sqllite db per profile. I tried to summarize the usse cases from others mentioned here an mine , so if someone wants to add on please do so. I hope that makes to problem area more clear and of cause I hope that this can be solved. Joplin is a great tool - thanks for that. Michael
Hi Laurent,
I am starting to use Joplin on work and I want to use it as a company tool. We have a bunch of different projects and each project has its documentation. And each user works on a few projects only, so the user should only be able to read and change the documentation for the projects that works on.
If the profile point of view is quite difficult to implement, I think that we could solve this issue just with multiple synchronization paths. Because we use Sharepoint for the documentation and we could just synchronise a folder via One Drive with our disk and then synchronise Joplin with the file path option. I think that could solve our problem,
Thanks in advance.
@laurent22,
I work in the public sector. Everything I create in the course of my work is a public record. I also work on a combination of shared and personal systems and would like to be able to sync my work-related notes, and sometimes need these on my personal system for off-hours emergencies.
I keep personal notes for myself, including very personal data such as health related data and personal financial information. I need to sync this to multiple devices, and sometimes need to reference these from my non-shared work system (such as for making appointments during normal business hours, or updating my journal over lunch).
The result of these two things is that I need to be able to access two separate sets of notes, on separate sync profiles, at the same time, on multiple computers. Due to the private nature of some of my personal notes, I could not use a solution (such as multiple notebooks with sub-notebooks) that mixes search results, as I do not wish to share my personal health and financial information with my coworkers while I am searching for documentation to assist them with a work-related issue, and I certainly do not wish to mix sensitive personal information with public records. I also could not use a solution (such as multiple notebooks with sub-notebooks) that mixes sync targets. I do not wish to store personal information on shared work computers, but need my work-related notes available at those locations.
I currently solve this problem by using one instance of Joplin with --env dev --profile $HOME/personal/.joplin
. I set one profile to light theme, and one to dark theme. This allows me to easily use both sets of notes as needed, without concerns relative to syncing private information to shared devices or mixing search results in screen-share settings. Unfortunately, this leaves me with no solution in regards to the mobile application. I can either have my personal notes, or my work notes, on my phone, which is not ideal. In the past I have solved this by building my own copy of the Joplin Android app and installing it side-by-side with the official version. This has proven too much effort to maintain, so I currently am forced to accept this limitation.
Whatever the solution may be, I do not believe it can satisfy my use case without the following features:
By far the simplest solution to this problem, from my perspective, is making --profile
work as a first-class feature. The only change required to fully support this workflow is simply to change the "only one running instance" lock to a "only one running instance of a specific profile" lock. I do not believe that this solution is mutually exclusive with any other solution that may come later. I feel that this relatively small change, if possible, will provide a very helpful first step to improve usability while other more integrated solutions are evaluated and discussed, and given its nature, it would not be terribly likely interfere with any later solution, or prove in any way difficult to revert at a later date. This does not address the mobile application, but that area necessarily requires the development of a more complex solution and this slight improvement to an existing feature would greatly aid desktop users. I feel that many people would benefit from this small improvement to --profile
.
I hope that this more comprehensive description of my use-case is helpful in understanding the general desire for this feature, as well as determining what shape it should take. I am happy to answer any questions related to my workflow.
Thanks everyone for the feedback. It's good to know about some use case like this as indeed it makes it clear that a solution with multiple profiles would be necessary to support some of these. I don't know when it will be done, but it's relatively high priority.
I also am very interested in the profile feature and having multiple instances. I really love Joplin, but I currently have a major usability issue with it.
Specifically I have my work account notebooks which are synced to my work approved hosting solution, and I have my private notebooks which are, of course, not hosted on my work server. As a result of this, I currently have to do jump through hoops in order to switch between my work notebooks and private ones.
Having the profiles and multiple instances would certainly work great for this. It would allow total separation of the 'notebook workspaces' so to speak, and would allow assigning a synchronization target to each profile. It also opens the doors to all sorts of other use cases and situations such as multiple users on one system account, notebooks hosted on an encrypted server vs ones that aren't, freelance notebooks vs hobby ones, etc.
Besides that one hurdle, I want to end on the note that Joplin is an extremely helpful and a great piece of software; I now use daily for just about everything from work, to side gigs, to personal life. Keep up the excellent work!
I fully agree with everything in this post. Same use case and Joplin is Great!
Yes, lets hope that @laurent22 can find some time to implement this great feature. This is highly needed and will get lots of love :-)
I recently came across Joplin, and started using it pretty frequently to sync personal notes across my devices through my NC server, but the lack of being able to connect notebooks to different synchronization destinations makes it hard to use in a work environment.
I work primarily in the IT-sector where I work for several companies, and I also run some companies of my own in addition to my personal projects. Being able to sync all my notebooks to all my devices, but also sync selected notebooks to selected destination(s) would for sure make my workdays more efficient. I have co-workers and employees who need access to my relevant notes, but I've done a temporary workaround where I have semi-public shares in a federated NC-network which gives people access to the information they need, and nothing more. But again, having some sort of option in-application for this would be highly appreciated, and I'm looking forward to seeing this implemented.
Keep up the great work on Joplin!
Being able to sync all my notebooks to all my devices, but also sync selected notebooks to selected destination(s) would for sure make my workdays more efficient
I think that could done using notebook sharing in Joplin Server. You would create for example one user per company, as well as a personal user, then you would use notebook sharing to give access to specific notebooks to only certain users. I'm not sure that would cover all cases but that could help.
that could done using notebook sharing in Joplin Server. You would create for example one user per company, as well as a personal user, then you would use notebook sharing to give access to specific notebooks to only certain users.
Haven't looked into the Joplin servers yet, but I'll give that a try, thanks for the suggestion!
Hi,
Where are we on the status of sync multiple instances ?
It would be nice to have the possibility to sync from different nextcloud instances for example, different notebook. It would also give the user the ability to copy a notebook from one instance to another even. Is that what was defined as impossible to accomplish without reworking the whole app or was that the second case ?
I don't think multiple profiles still need to be implemented now that it can be done using notebook sharing in Joplin Server. As anyone who needs multiple profiles gave this a try?
Or if you think that the notebook sharing technique doesn't cover all cases, please let me know.
laurent22 I do not think that this solves the problem. running joplin using webdav on my owncloud server where my phone, tablet, notebook,linux rdp server and my desktop has acccess. my friends and colleges does the same, some on different webdav servers, some on the same. nearly all use owncloud and nextcloud as data store. setting up one joplin server for all of us would be impossible, and even some would setup their joplin server and these server would be able to federate, not all would add an additional server.
IMHO the only real solution is to be able to sync against different WebdAV providers, then one is able to share e.g. owncloud account 1 with users group 1 and nextcloud account 2 with users group 2, where no group is needed, user group are people having access to some WebDAV provider.
That way you have a solutiton share notes with different people/groups of people on unlimited WedDAV providers, without a complex share and permission setup.
@laurent22, neither I think that the initial problem is solved - though the server add some cool options. Like others wrote before the use case is to separate e.g. work and private notes which are not necessary shared with any one else. So this ends in two local instances / profiles. Switching between is a pain since you need to stop the app and restart with an other profile. It might be possible to share with myself, I did not got this from the description. In this case the current implementation might be a solution. I just didn't got the big picture. The notes need to be local and shared via a server which is maximal a private NAS not access able out of the local lan.. In case this is possible, I'd be happy to read how to get that setup.
I guess the post I linked wasn't clear - it's not about sharing notebooks with someone else, it's about sharing it with yourself using different accounts.
The result is that:
The idea is to create specific accounts for specific roles, and to share with them only the relevant notebooks. So you could even have a personal account that only has access to personal notes (and not the work ones) if needed. I hope that makes sense.
Note that all this cannot be done using the generic sync targets, such as WebDAV, since it requires some server side logic, which is why it's only supported by Joplin Server.
Make sense and will work well when I want on a work-pc only have access to the work related stuff On an other pc I need to have work and private stuff all in one to be able access both and share it. That is not exactly the idea, I like to keep it stuff separate but quickly accessible. So not switching to an other user, or closing and opening a app. I might misunderstood, my current understanding is that this is not possible.
I still think that the idea to this request is different and I still reall hope that it is possible to implement it like it is handled in an email client.
That way you can combine notes on different servers/providers and sharing is done server side, e.g. adding access for another user to the WebDAV account lets this user also work in this notebook.
I have the problem, that lot of my friends use Joplin, but we are unable to share notebook in different groups on different servers.
I hope this was understandable explained. I sm native German language.
Hi, I was really interested in this issue, and I confirm that the new Joplin Server fully answer my needs : I will share my work notebook with myself and it will be perfect! Bruno
Joplin Server is useful, but it does not solve the problem.
I encountered another form of this problem yesterday. I wanted to make a shortcut my wife could use to open her own notes when borrowing my PC. Sharing various notebooks to different users that represent myself is not a good solution. I do not wish to search her notes every time I try to search mine.
I would be satisfied with a command line argument (other than --env dev
) that disables the check for "only open one instance of Joplin at a time". This would require caution from me in order to not open the same profile more than once. If you change the check to be "only open one instance of the specific Joplin profile at a time", it will completely solve the problem. I do not understand the check well enough to know how hard that is. I do know that the check can be disabled completely. It is disabled completely by --env dev
. The problem with using --env dev
is that it also opens the debug interface, which would confuse my wife when she borrows my PC. I already use --env dev
for my work related notes.
State files or an entry in the db can be dangerous. If Joplin were not closed properly, the lock would stay in place and one would have to manually clean that state.
In other languages I'd check, if the db was used by a process already. I do not know, if this can be done with JS. But maybe there's a sqlite command how many connections are present. That would be the easiest way.
For me what Laurent has described in: https://github.com/laurent22/joplin/issues/591#issuecomment-877698584 would be a good solution. However, this requires that I install Joplin Server and migrate my current setup. Without any success I was looking for a description for the installation of Joplin server and also for the migration. If this exists, can someone please point me to the right spot? I would like to give this a try. Sorry if this is a little off-topic.
@tessus, I see. I understand the difficulty there. I've done some more digging, and it seems like you're currently using some magic locking provided by electron, which doesn't support this easily, so you currently get this for free, but can't get more than one.
I dug down into the depths of the electron source code to find out how this was done, and whether it was configurable. It seems it is not, as it uses locking from the underlying Chrome process that your app runs in.
That said, it appears that there is a solution after all, for those of us who need this. I will share that method here for others in need. It does not solve the problem in the context of the mobile app. A method for switching profiles by restarting the app would still be useful there. This does solve the problem for desktop users.
Normally, when you run an AppImage such as the Joplin AppImage, it will store its settings and data under your normal user profile. As we all are well aware, there is only one user profile and so there can be only one set of data. This is not necessarily true. An AppImage can be easily configured to use a separate, isolated user profile (home directory, for you Linux folks). I have tested, and this solves our "run multiple instance" problem. While I have only tested this on Linux, as it is specifically a supported feature of AppImage, it should work the same elsewhere.
If you create a folder with the same name as your AppImage file, but with .home
added to the end, the AppImage, when launched, will use this as your user profile directory. This is intended for portable apps, but is useful to us here.
I downloaded the current version of Joplin, Joplin-2.1.8.AppImage
, and saved it in a temporary directory. I created the directory Joplin-2.1.8.AppImage.home
right next to it. I was able to run this copy of my AppImage while my real, everyday copy of Joplin was open. Then I edited some of the default notes.
I made a copy of Joplin-2.1.8.AppImage
named OtherJoplin-2.1.8.AppImage
, in the same temporary directory that I created for testing. I created the directory OtherJoplin-2.1.8.AppImage.home
right next to it. I was able to run this copy of my AppImage while the previous Joplin-2.1.8.AppImage
was already running. I got a fresh profile with a fresh set of notes, running at the same time as my other copies of Joplin.
By keeping multiple copies of the Joplin AppImage file, and using these "portable" data directories, it is possible to have as many, completely separate, copies of Joplin open as you want without them interfering with each other.
Here is the documentation on AppImage's "portable mode" feature.
It may be slightly clunky, and it doesn't solve the problem for Mobile, but this feature seems to solve the problem entirely on Desktop.
Applications
Summary:
Scope instance to the profile, so multiple apps could run, each with different profiles.
Specification
Having the same app supports or load multiple profiles cannot be done without a massive refactoring, so it's unlikely to happen.
Instead what we can do is provide a way to switch profiles from the app:
Changing the structure of the profile directory
Currently, the profile is organised like this:
If we want to support multiple profiles, the config directory should be changed like so (in a way similar to Firefox or Thunderbird multi-profile support):
The PROFILE_ID_x directories will be named with a UUID and contain the same profile as above with the "resources" and "database.sqlite" file.
profile.ini
will tell what profiles are available. It's content will be like this (same as Firefox):Swiching profiles
To switch profile, save a value to Setting table called "next_profile_id", then close and restart the app. When the app starts it loads "profile.ini", then checks the value of "next_profile_id", and uses that to choose and load the right profile.
Locking per profile
Each app needs to make sure that a given profile can only be open by one application, so there should be form of lock. If a profile is locked, it means it's already opened by another application, so the current application should close.
Locking should be implemented in such a way that if an app crashes, the lock is released. So probably some form of in-memory lock.
Desktop implementation
To restart the app use the built-in Electron function: https://electronjs.org/docs/api/app#apprelaunchoptions
Mobile implementation
On mobile, give a try to this package to restart the app: https://www.npmjs.com/package/react-native-restart
See also
https://discourse.joplinapp.org/t/can-i-run-a-second-instance-of-joplin/110