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

Enable Portable Mode in Blueprint #276

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

vladarama
Copy link

@vladarama vladarama commented Jul 10, 2023

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:

  1. Create a data folder at the root of your Blueprint install directory
  2. Copy the following and paste it into a subfolder inside data called user-data:
    • Windows: %userprofile%/.theia-blueprint
    • Linux: ~/.theia-blueprint
    • macOS: ~/.theia
  3. Copy the following and paste it into a subfolder inside data called app-data:
    • Windows: %appdata%/Theia Blueprint
    • Linux: $HOME/.config/Theia Blueprint
    • macOS: $HOME/Library/Application Support/Theia Blueprint

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:
eclipse-theia/theia#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

Reminder for reviewers

@JonasHelming
Copy link
Contributor

@marcdumais-work Ping?

@marcdumais-work
Copy link
Contributor

marcdumais-work commented Sep 1, 2023

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).

@marcdumais-work
Copy link
Contributor

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).

@marcdumais-work
Copy link
Contributor

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.

This commit addresses review commments and adds caching to
avoid reading and writing to the disk too often.

Signed-off-by: Vlad Arama <[email protected]>
@kittaakos
Copy link
Contributor

@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.

@vladarama
Copy link
Author

@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 ?

@vladarama
Copy link
Author

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.

@marcdumais-work
Copy link
Contributor

@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?

@vladarama
Copy link
Author

Yep it has been added in eclipse-theia/theia@bf93b29

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.

@marcdumais-work
Copy link
Contributor

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.

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.

@vladarama
Copy link
Author

vladarama commented Nov 27, 2023

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.

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

Successfully merging this pull request may close these issues.

Make it a portable IDE like VSCode.
4 participants