-
Notifications
You must be signed in to change notification settings - Fork 221
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
System tmp directory is not always same as remote ssh deployment #106
Comments
Thanks for the proposal, @aranw. I wonder if it's possible for the participants to pick their own temporary directory? This would be a preferable solution to adding another configuration option just for temp directory access. WDYT @rgrandl. This sounds like a great first project for one of our community members. |
Yeah that's kind of what I was thinking by the configuration option. Users of the ssh deployer could then state what temp directory to use overriding the default Edit: Another possible solution would be to expand the site locations to be another struct where users can set both ip/hostnames and a temp directory? |
Thanks @aranw for the proposal. I agree with @spetrovic77, it would be nice if we don't have to embed the temp directory in the config. We need the temp directory name per location in 2 places:
Would it be better if we would get the temp directories from each machine and then copy the binary accordingly to each of these? The pros of this approach is that the config is as simple as it is now. The cons is that we may need to do an extra ssh command to each location to get their temp directory name, and keep track of that at the manager (which doesn't seem that bad). |
When I was looking into this I couldn't find a reliable source for retrieving the temporary directory. On my current Ubuntu 22.04.2 LTS installation I have however found the This is the output from Ubuntu 22.04.2 LTS
It is also apparently available on macOS as well https://ss64.com/osx/mktemp.html |
Nice. It would be great if we can do this instead of adding a new field in the config. This sounds great to me. |
I'll get to work implementing this and removing the config stuff instead 👍🏻 |
Sounds great. Thanks @aranw for working on this. |
@rgrandl after investigating the weaver/internal/tool/ssh/deploy.go Line 144 in 262d632
I don't know enough about how you run the app binaries just yet but am guessing this Maybe it'll make more sense to just change weaver/internal/tool/ssh/deploy.go Line 143 in 262d632
to remoteDepDir := filepath.Join("/tmp", dep.Id)
This should work across all unix/posix servers |
@aranw I think that using I think what you can do is as follows:
Note: https://github.com/ServiceWeaver/weaver/blob/main/internal/tool/ssh/deploy.go#L142 - this might be a bug. I don't remember why we did that, but I think it's safe to ignore it. I will send a fix, once I try it out on multiple machines. Do you mind checking if the deployment works on multiple machines if you comment this line (in case you have access to a cluster)? I would avoid hardcoding |
Hey @rgrandl sorry for the slow reply. I've been busy last week or so now with other stuff Just getting back into this and looking into If I understand your proposed solution I'll end up with a unique path per ssh location but looking at the current code there is no way to represent that and I'll need to make a few changes so that I can track a location and it's path for use by the manager? |
Hi @aranw that's correct. |
Hi. What is the current status of the implementation? Cheers. |
Can I try to help you and solve the problem with you? |
Issue
This issue was also partly discussed on #100
When deploying from macOS the operating system defaults to a
/var/folders/*
temporary directory and this will not work with unix systemsRight now the ssh deployer pulls the temp directory via
os.TempDir()
weaver/internal/tool/ssh/deploy.go
Line 143 in 35727ae
Determining the correct temp directory is not the easiest thing for example the "canonical environment variable in Unix and POSIX" TMPDIR environment variable is not always set
Comparing this to macOS I get the following output
Proposed Solution
To fix this I propose introducing an additional configuration option to the ssh deployer allowing for this variable to be override from the default
/tmp
which should work both on macOS and Unix systemsThis new configuration option can be added to the
sshConfigSchema
type as a string and defaults to/tmp
weaver/internal/tool/ssh/deploy.go
Lines 181 to 183 in 35727ae
The new tmp directory variable can then be passed into the
Deployment
weaver/runtime/protos/runtime.proto
Lines 104 to 106 in 35727ae
That is used by the
copyBinaries
funcweaver/internal/tool/ssh/deploy.go
Line 136 in 35727ae
The new tmp directory will be used on the following line instead of
os.TempDir()
weaver/internal/tool/ssh/deploy.go
Line 143 in 35727ae
Configuration would look as follows
Of course if the
tmp_dir
is omitted then it would default to/tmp
which works for both unix and posix systemsHopefully that explains the issue and a possible solution to the issue. Let me know your thoughts on this and whether you feel like should do something differently?
The text was updated successfully, but these errors were encountered: