theia-blueprint
theia-blueprint copied to clipboard
Enable Portable Mode in Blueprint
Portable Mode in Theia Blueprint
Fixes: #270
Creating a data
folder at the root of a Theia Blueprint application install (next to the executable) will make it portable. So all of the app data and user data will get written to the data
folder instead of their default locations.
The .theia-blueprint
folder is moved from the user’s home directory (%userprofile%
or ~/
) to a folder called user-data
inside the data
folder. user-data
contains all of the settings, preferences and extensions.
In addition, all of the application data which is stored by default inside a Theia Blueprint
folder in (%appdata%
or ~/.config
) is moved to a folder called app-data
inside the data
folder. app-data
contains all of the application’s cache and layout information.
How to Start (User Guide)
Windows, Linux, MacOS
Download and run the correct Theia Blueprint for your platform.
During the installation wizard, select the download location for the Blueprint application. After the install is finished, navigate to the download location and create a data
folder. The file folder should look similar to the following:
- TheiaBlueprint (or application name)
- TheiaBlueprint.exe
- data
- ...
As such, all of the data created by Theia Blueprint will be stored inside the data
folder, more specifically inside user-data
and app-data
.
Updating Theia Blueprint Portable
Download the latest Theia Blueprint version and run the installer. Copy and paste your current data
folder to the root of the directory where you installed the latest version of Blueprint. This should update your application.
Migrate to Portable Mode
If you want to make an existing installation of Blueprint portable, you can do so with the following steps:
- Create a
data
folder at the root of your Blueprint install directory - Copy the following and paste it into a subfolder inside
data
calleduser-data
:- Windows:
%userprofile%/.theia-blueprint
- Linux:
~/.theia-blueprint
- macOS:
~/.theia
- Windows:
- Copy the following and paste it into a subfolder inside
data
calledapp-data
:- Windows:
%appdata%/Theia Blueprint
- Linux:
$HOME/.config/Theia Blueprint
- macOS:
$HOME/Library/Application Support/Theia Blueprint
- Windows:
This should make your existing installation portable.
How to test
The following changes only makes the user-data
portable (settings, preferences, recent workspace ...)
For the app-data
to be made portable, the following PR should be merged, published to npm and the dependencies updated:
https://github.com/eclipse-theia/theia/pull/12690
You can test that the portable-mode is functional by packaging a new Theia Blueprint application using yarn
and then yarn electron package
. Then, you can run the executable and create a data
folder at the download location. This should write all the user data from ~/.theia-blueprint
to data/user-data
.
Review checklist
- [x] as an author, I have thoroughly tested my changes and carefully followed the review guidelines
Reminder for reviewers
- as a reviewer, I agree to behave in accordance with the review guidelines
@marcdumais-work Ping?
Generally, I like how small the code change is for this. The concern I have is not related to the code as such, but how to present and document this feature in the correct light, to set reasonable expectations.
The equivalent vscode feature is documented to work only with the ".zip" install "package", which is natural for the end-user to install somewhere, where they have write permissions. i.e. often under they own home folder. I suspect vscode does that to avoid as much as possible the permissions problems that would occur if the user tried the procedure on a globally-installed instance of vscode (i.e. installed from a .msi on Windows, .deb on Debian/Ubuntu Linux).
One little peculiarity we have vs vscode I think, is that on Linux one can generate a .AppImage package for a Theia app, that's static and cannot be modified - in consequence it will not be possible to create the "data" folder, under the app's install folder, in this case (not for the end-user anyway).
a thought: we could do like vscode and officially support portable mode only for "zip" packages. I think we could provide these packages by zipping the "prepackage folder" , generated by "yarn electron package:preview", which we already do in Jenkins CI (we may be skipping built-ins download for efficiency ATM, which would need revert).
FYI, @vladarama will be back in a few weeks, working part-time. If this is wanted sooner, I think he would not mind, if someone took it over.
@vladarama, the current code is a full copy-paste of the default Theia code except for the .theia
and .theia-blueprint
. Can Blueprint not pick up the Theia changes as is with the next version? If this copy-pasting is needed from Theia to Theia Blueprint, most likely all other Theia-based electron apps must do the same, so something is wrong with the env variable server customizability.
@kittaakos Good point, I agree. I think Blueprint should be able to pickup the changes with the next release.
Any thoughts on removing TheiaBlueprintEnvVariableServer
and directly using the one from Theia @marcdumais-work ?
a thought: we could do like vscode and officially support portable mode only for "zip" packages. I think we could provide these packages by zipping the "prepackage folder" , generated by "yarn electron package:preview", which we already do in Jenkins CI (we may be skipping built-ins download for efficiency ATM, which would need revert).
I think this is the right way to go, it is a lot simpler to do for the end-user.
@kittaakos Good point, I agree. I think Blueprint should be able to pickup the changes with the next release.
Any thoughts on removing
TheiaBlueprintEnvVariableServer
and directly using the one from Theia @marcdumais-work ?
I think this feature could be added in Theia directly - is that what you meant?
Yep it has been added in https://github.com/eclipse-theia/theia/commit/bf93b2910d8fcee7e3a9f9768194f49191fb552f
I think we can just use EnvVariablesServerImpl
from Theia directly which would make Blueprint portable. Then, we would be able to remove theia-blueprint-variables-server.ts
and everything should work correctly unless I am missing something.
I think we can just use
EnvVariablesServerImpl
from Theia directly which would make Blueprint portable. Then, we would be able to removetheia-blueprint-variables-server.ts
and everything should work correctly unless I am missing something.
If we remove theia-blueprint-variables-server.ts
, can Blueprint still have its own, customized config folder? I'll let you look into the details.
Here is an update:
Removing theia-blueprint-variables-server.ts
and using Theia's EnvVariableServer
causes all the user-data to be written to .theia
instead of .theia-blueprint
which would be a breaking change.
As for the customizability of the EnvVariableServer
, Theia-based applications using Theia's env server directly would not have to make any changes for their application to be portable, since the .theia
folder is still used for the user-data by default.
Blueprint is different since we are using a custom EnvVariableServer
to write the user-data to .theia-blueprint
instead of writing it to .theia
. For this reason, we cannot use Theia's own env server directly without causing breaking changes. Therefore, this PR is needed.