How correctly deploy code to another machine?

I am developing a package on my laptop. But I actually need it to run a server. So what I do is to test the code locally until it’s ready, and then rsync the package folder to the server.

It works when I first tried it yesterday. But now I made some new changes, synchronized the code again, and the modification does not work on the sever. It always runs the code from yesterday on the sever, even if I have checked the source code has been correctly synchronized.

I tried to delete .julia/complied/v1.1/mypackge. I tried to remove my own package from default environment and add it again. Nothing seems to work.

What can be the reason for such bizarre problem? I guess I must have messed up package system somehow.

I also see this line when I run update in package mode

Updating git-repo `/home/myname/somepahte/mypackage

Could it has something to do with git? I am using it to tracking my code and the .git folder in the package is also copied to the server.

What should be a proper way to synchronize code to another machine?

You may find this discussion useful:

TL;DR: I am using a repository with Manifest.toml committed for the project.

1 Like

Yeah, l can also do that.

But do You register your package in the server’s home environment using Pkg.add(“yourpackage”)?

Yes, I pkg> add the package (that has nothing to do with registration).

Basically my workflow is this: make sure it works on my laptop (tests pass, results with toy dataset look satisfactory, estimation converges for simulated data). Then I push to the repo (a private one on Gitlab), and just do a

pkg> up

on the server and I am ready to run the computation.

I e-mail myself (using a bash script calling mailx) when done and retrieve the results (also via git, in a separate repository, just a bunch of CSV files).

2 Likes

Thanks. Now I see what’s wrong in my original attempt.

It’s not enough to have the code of the package updated on the remote server. Since the package has been added to the default environment, I need to run

pkg> up

Otherwise in the default environment, julia will run the old code.