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

[Export] Add one-click deploy over SSH for the desktop exports. #63312

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jul 22, 2022

Adds one-click deploy and remote debug option for desktop targets, similar to the same feature for Android and Web.

  • Add ZIP export option for Linux and Windows.
  • Add one-click deploy over SSH for Linux, macOS and Windows targets.
remote_debug.mov

TODO:

  • Support for Linux targets.
  • Support for macOS targets (the same as Linux, with exception for bundle run command).
  • Support for Windows targets (Windows 10+ should have SSH server as a standard OS component, but mktemp and unzip should be replaced with PowerShell equivalents). The built-in version of OpenSSH is running as a service and cannot access a desktop session, therefor task scheduler is used to start / terminate the uploaded project.
  • Cleanup temp files on remote after finishing debug session.
  • Add editor settings to set custom paths for scp and ssh.
  • Replace ugly 16x16 bitmap "run" icons with the scalable SVGs.

Related proposals godotengine/godot-proposals#4897, godotengine/godot-proposals#2608, not exactly the same but should simplify testing on the portables like Steam Deck, or multiple platforms in general.

Required tools / config to use this:

  • SSH with non-interactive authentication (e.g., key based auth controlled by ssh-agent).
  • For Unix targets: kill, mktemp, rm, unzip commands/utilities available and in path.
  • For Linux, additional environment variables for desktop session might be needed (can set in export options), by default it's setting only DISPLAY=:0;
  • For Windows: PowerShell installed (installed by default), target user must have active desktop session and have permission to use task scheduler (enabled by default for all users, but might be blocked via Group Policy).

@Calinou
Copy link
Member

Calinou commented Jul 22, 2022

I suppose this also addresses godotengine/godot-proposals#1072 to an extent.

Replace ugly 16x16 bitmap "run" icons with the scalable SVGs.

Feel free to use platform-icons.zip (which I've made over 1 year ago, but never got to work within Godot itself).

@bruvzg
Copy link
Member Author

bruvzg commented Jul 24, 2022

Feel free to use platform-icons.zip (which I've made over 1 year ago, but never got to work within Godot itself).

Changed platform icons to this set, and run icons to the gray version of them (+ added UWP icon), also using SVG icons fixes icon scaling in the hiDPI mode.

Before After
Screenshot 2022-07-24 at 13 31 34 Screenshot 2022-07-24 at 14 03 22
Screenshot 2022-07-24 at 13 31 24 Screenshot 2022-07-24 at 23 23 22

@bruvzg bruvzg force-pushed the one_click branch 2 times, most recently from 6ee7595 to ea5678d Compare July 25, 2022 11:25
@bruvzg bruvzg changed the title [WIP, Export] Add one-click deploy over SSH for the desktop exports. [Export] Add one-click deploy over SSH for the desktop exports. Jul 27, 2022
@bruvzg
Copy link
Member Author

bruvzg commented Jul 27, 2022

I suppose this also addresses godotengine/godot-proposals#1072 to an extent.

Screenshot 2022-07-27 at 13 42 04

With the full set of remote debug options enabled, toolbar become quite cluttered, so I guess some sort of UI redesign might be necessary. And running projects using local export templates might be desired, as well (you can use this PR for this by connecting to the localhost, but it's definitely not a proper solution).

@bruvzg bruvzg marked this pull request as ready for review July 28, 2022 14:56
@bruvzg bruvzg requested review from a team as code owners July 28, 2022 14:56
@aaronfranke
Copy link
Member

I've already commented in godotengine/godot-proposals#2124, but I would rather use macOS Finder icon for macOS. The Apple logo is too generic, and it could be confused for iOS at a glance.

macos-flat-noborders.zip

@BAndiT1983
Copy link

Works great on Steam Deck! Stepping through the script code in debug sessions is working fine too.

  • Is this feature still "work in progress"? No updates for a while, so decided to ask
  • Are there plans to enable the stop button? Currently it's disabled, at least in my build, so stopping the session is only possible through stop and uninstall
  • Is it possible to add something like rsync, to avoid uninstalling of the files and to upload the diffs between sessions? Maybe there is already something and I've missed it

Could adjust some things too, but would be good to know the state first

@bruvzg
Copy link
Member Author

bruvzg commented Dec 27, 2022

Is this feature still "work in progress"? No updates for a while, so decided to ask

Oh, I completely forgot to mark is as ready after adding script templates to the export options. Rebased, and will re-test it to make sure everything is still working tomorrow.

Are there plans to enable the stop button? Currently it's disabled, at least in my build, so stopping the session is only possible through stop and uninstall

It's the same for Android and Web, so probably no.

Is it possible to add something like rsync, to avoid uninstalling of the files and to upload the diffs between sessions? Maybe there is already something and I've missed it

No, it's not supported. Should be easy to add, but since it's uploading the project as a single zip, it probably won't do much.

Add one-click deploy over SSH for the desktop exports.
Add ZIP export option for Linux and Windows.
Change export plugin icons to SVG format.
@bruvzg bruvzg marked this pull request as ready for review December 29, 2022 07:42
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! I'll merge after beta 12 (releasing tomorrow) so we have a few days to test before the next beta.

@akien-mga akien-mga dismissed reduz’s stale review January 13, 2023 00:17

Changes not needed, misunderstanding.

@akien-mga akien-mga merged commit 3dffe0b into godotengine:master Jan 13, 2023
@akien-mga
Copy link
Member

Thanks!

@bruvzg bruvzg deleted the one_click branch January 13, 2023 17:19
@eh-jogos
Copy link

Is there any documentation on how to get this working?

I work on a linux machine and would like to one click deploy to a windows device. I tried the latest one click deploy page, but it seems to be the same one as the 3.x stable version https://docs.godotengine.org/en/latest/tutorials/export/one-click_deploy.html

@BlackDragonBE
Copy link

All this does for me on the Steam Deck is creating an empty directory in /tmp:

Creating temporary directory...
/tmp/tmp.AY7eTuMc16

This really needs some documentation.

@BAndiT1983
Copy link

Works for me on SteamDeck, was following the docs by @akien-mga and @bruvzg above, what were your steps to set the connection up?

@BlackDragonBE
Copy link

BlackDragonBE commented Feb 19, 2023

@BAndiT1983
Probbaly something I'm doing wrong then. Any help would be greatly appreciated!
Here's what I'm doing:

  1. I've set up SSH, created a ssh key pair on the deck and copied the key over to my ~/.ssh folder. I've tested the connection in Powershell and I can connect via ssh without having to provide a password.
  2. In my Godot project, I've added a Linux export, checked Enabled for SSH Remote Deploy and entered the Host.
  3. I added this to Extra Args SSH and Extra Args SCP respectively:
-o StrictHostKeyChecking=no -o IdentitiesOnly=yes -t
-o StrictHostKeyChecking=no
  1. On the Steam Deck I switch to desktop mode and execute these commands via SSH:
export DISPLAY=:0
rm -f ~/.Xauthority
touch ~/.Xauthority
magic_file=$(ps aux | grep Xorg | grep auth | sed "s/.*-auth \([^ ]*\) .*/\1/")
magic=$(xauth -f "$magic_file" list | sed "s/.*\($DISPLAY.*\)/\1/")
xauth add $magic
  1. I try to do a remote (with Debug > Remote Debug enabled), but all I get is this in my output:
Creating temporary directory...
/tmp/tmp.o7yKIuQ3C3

When I check on the deck, there is indeed a new tmp folder in /tmp, but it's empty.
I thought it might be a SCP issue, but when I run SCP manually to copy a test zip, it works fine, just not via Godot.

Thanks!

EDIT: I did some more digging around and changing the scp path to something nonsensical in the editor settings doesn't throw an error, while changing the ssh path does. This leads me to believe that the SCP commands aren't even called after the temporary folder is created.

EDIT 2: I tried running with the --verbose flag, and here's the output:

Creating temporary directory...
Executing: ssh -p 22 -q -o LogLevel=error -o BatchMode=yes -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -t deck@dragondeck mktemp -d
Exit code: 259, Output: /tmp/tmp.S8HHzrMm3p

/tmp/tmp.S8HHzrMm3p

@BAndiT1983
Copy link

Will cross-check when i get to my Deck, but overall it looks correct at first glance

@BlackDragonBE
Copy link

I'm still getting the same issue as detailed in #63312 (comment)
A directory in /tmp is created and that's it. Can anyone else using Windows test if it works for them?

@BAndiT1983
Copy link

BAndiT1983 commented Apr 12, 2023

Sorry for long absence (work and other stuff came in-between), have finally checked under Windows and the export (in Godot 4.02) is also not starting automatically on Deck, tried to run the exported app from the /tmp/tmp..., but it fails, at least the files are transferred. Will analyse why it SIGSEGVs there. Does it run on your Deck?

Edit: Export from Linux didn't start either, but at least the exported app is starting, needs also some investigation on the reasons, as it's the same project just transferred from different OSes.

Edit 2: Executed Godot editor under Linux with --verbose argument and got following log while deploying to the Deck, something changed (on whichever side) in the meantime it seems, as this process worked just fine in February.

Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org
Authorization required, but no authorization protocol specified

ERROR: X11 Display is not available
   at: DisplayServerX11 (platform/linuxbsd/x11/display_server_x11.cpp:5331)
Authorization required, but no authorization protocol specified


(zenity:10012): Gtk-WARNING **: 17:18:17.397: cannot open display: :0
ERROR: Unable to create DisplayServer, all display drivers failed.
   at: setup2 (main/main.cpp:2018)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools11BucketLargeE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools12BucketMediumE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools11BucketSmallE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: BUG: Unreferenced static string to 0: interface_added
   at: unref (core/string/string_name.cpp:131)

Edit 3: As quick workaround you can also use xhost +si:localuser:$USER in the Desktop mode (reference: 89luca89/distrobox#409). Didn't require any further commands on my SD. Will also check what's the matter under Windows

@BAndiT1983
Copy link

Same workaround from Edit 3 in the comment above is also valid for deployments from Windows. Am not getting any display error or similar, it just doesn't start after deploying files, but after using xhost line it starts just fine via remote deployment.

@BlackDragonBE
Copy link

BlackDragonBE commented Apr 14, 2023

@BAndiT1983
I've executed xhost +si:localuser:$USER on the deck and tried again, but all it does in Godot after trying remote deployement is this:

Creating temporary directory...
/tmp/tmp.4mx2BhRDMn

With --verbose:

Creating temporary directory...
Executing: ssh -p 22 -q -o LogLevel=error -o BatchMode=yes -o StrictHostKeyChecking=no deck@dragondeck mktemp -d
Exit code: 259, Output: /tmp/tmp.x1UKLSSUKn

/tmp/tmp.x1UKLSSUKn

Nothing happens on the deck.
Can you share your export settings?

EDIT 1: I've checked the tmp directories on the deck, and they're all empty.

@BlackDragonBE
Copy link

Update: I was trying it on Godot 4.0.0, after updating to Godot 4.0.2 it works perfectly!

@BAndiT1983
Copy link

BAndiT1983 commented Apr 14, 2023

If it stalls with Creating temporary directory... then the connection settings are not correct, had this behaviour too, when the IP address or SSH settings were wrong. The feature works great when it works, but additional error handling or logging would be helpful.

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

Successfully merging this pull request may close these issues.

9 participants