SSH deployment linux

I’m trying to deploy via SSH to a vanilla Ubuntu 14.04 instance on Digital Ocean.
The package is correctly transferring, but there’s an error when Calamari deploy-package is run.

This is the log (package names changed)

17:44:27 Verbose | Stream transfer complete
17:44:27 Verbose | Requesting upload…
17:44:28 Verbose | Beginning streaming transfer of calamari-deploy-package.sh to .octopus\OctopusServer\Work\20160706164426-501
17:44:28 Verbose | Stream transfer complete
17:44:28 Verbose | Octopus Deploy: Calamari version 3.1.30+Branch.master.Sha.4c2061d40a5d12bee23badefb01e540ccc4776c0
17:44:29 Info | Deploying package: /root/.octopus/OctopusServer/Files/example.1.0.31.nupkg-bf7ed4d7-c638-4ded-89af-c6c9e71b2e3b
17:44:29 Error | System.NullReferenceException: Object reference not set to an instance of an object
17:44:29 Error | at System.IO.Packaging.Package.LoadRelationships () [0x00000] in :0
17:44:29 Error | at System.IO.Packaging.Package.get_Relationships () [0x00000] in :0
17:44:29 Error | at System.IO.Packaging.Package.GetRelationshipsByType (System.String relationshipType) [0x00000] in :0
17:44:29 Verbose | Adding journal entry:
17:44:29 Verbose |
17:44:29 Error | at Calamari.Integration.Packages.LightweightPackageExtractor.ProcessManifest (System.IO.Packaging.Package package) [0x00000] in :0
17:44:29 Error | at Calamari.Integration.Packages.LightweightPackageExtractor.GetMetadata (System.String packageFile) [0x00000] in :0
17:44:29 Error | at Calamari.Deployment.Conventions.ExtractPackageConvention.Install (Calamari.Deployment.RunningDeployment deployment) [0x00000] in :0
17:44:29 Error | at Calamari.Deployment.ConventionProcessor.RunInstallConventions () [0x00000] in :0
17:44:29 Error | at Calamari.Deployment.ConventionProcessor.RunConventions () [0x00000] in :0
17:44:29 Error | Running rollback conventions…
17:44:29 Error | System.ArgumentNullException: Argument cannot be null.
17:44:29 Error | Parameter name: path
17:44:29 Error | at System.IO.FileSystemInfo.CheckPath (System.String path) [0x00000] in :0
17:44:29 Error | at System.IO.DirectoryInfo…ctor (System.String path, Boolean simpleOriginalPath) [0x00000] in :0
17:44:29 Error | at System.IO.DirectoryInfo…ctor (System.String path) [0x00000] in :0
17:44:29 Error | at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:.ctor (string)
17:44:29 Error | at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.EnumerateFiles (System.String parentDirectoryPath, System.String[] searchPatterns) [0x00000] in :0
17:44:29 Error | at Calamari.Integration.Scripting.PackagedScriptRunner.FindScripts (Calamari.Deployment.RunningDeployment deployment) [0x00000] in :0
17:44:29 Error | at Calamari.Integration.Scripting.PackagedScriptRunner.RunScripts (Calamari.Deployment.RunningDeployment deployment) [0x00000] in :0
17:44:29 Error | at Calamari.Deployment.Conventions.RollbackScriptConvention.Rollback (Calamari.Deployment.RunningDeployment deployment) [0x00000] in :0
17:44:29 Error | at Calamari.Deployment.ConventionProcessor.RunRollbackConventions () [0x00000] in :0
17:44:29 Error | at Calamari.Deployment.ConventionProcessor.RunConventions () [0x00000] in :0
17:44:29 Error | at Calamari.Commands.DeployPackageCommand.Execute (System.String[] commandLineArguments) [0x00000] in :0
17:44:30 Verbose | Disposing SFTP connection…
17:44:30 Verbose | Disposing SSH connection…
17:44:30 Fatal | The remote script failed with exit code 100

Hi Alex,

We have had a few other reports (here and here) of this and those reports seems to have been as a result of their package being quite large (with a large amount of files). Can I ask how big your package is?

There is a workaround that resolved the issue for the other customers,

  1. tar all your app files
  2. pack the tar file into a nuget package
  3. use the deploy nuget package step to extract the tar file from the package
  4. untar the tar file using a post-deploy/custom script

It’s not an ideal solution, but due to a bug in mono, it’s the best we can do currently.

I hope that helps!

Thank you and best regards,
Henrik

Hi Henrik,

It’s not a huge package – 5.14MB, 188 files.

I’ll see if I can make it work following the steps you mentioned, I had wondered if it was a configuration issue. It’s not that obvious how you specify an “install directory” with an SSH deployment, am I right in thinking that a custom install directory is required?
I have tried a few combinations of paths for this step, but there’s no validation on path separators or format so I wasn’t sure if I messed something up.

Thanks

Hi Henrik,

I tried to zip the files – the package seems to install ok (running Calamari directly on the server to test) but I get the same error… any ideas?

Thanks

root@y3sloans-droplet:~/.octopus/OctopusServer# Calamari/3.1.30/Calamari.exe deploy-package --package Files/y3sloans.1.1.36.nupkg ##octopus[stdout-verbose]
Octopus Deploy: Calamari version 3.1.30+Branch.master.Sha.4c2061d40a5d12bee23badefb01e540ccc4776c0
##octopus[stdout-default]
Deploying package: /root/.octopus/OctopusServer/Files/y3sloans.1.1.36.nupkg
##octopus[stdout-verbose]
Extracting package to: /root/Applications/y3sloans/1.1.36_2
Extracted 2 files
##octopus[stdout-default]
##octopus[setVariable name=“UGFja2FnZS5JbnN0YWxsYXRpb25EaXJlY3RvcnlQYXRo” value=“L3Jvb3QvQXBwbGljYXRpb25zL3kzc2xvYW5zLzEuMS4zNl8y”]
##octopus[stdout-verbose]
The package has been installed to: /root/Applications/y3sloans/1.1.36_2
If you would like the package to be installed to an alternative location, please specify the variable 'Octopus.Action.Package.CustomInstallationDirectory’
Adding journal entry:

Adding journal entry:

System.ArgumentNullException: Argument cannot be null.
Parameter name: path
at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in :0
at Calamari.Integration.FileSystem.CalamariPhysicalFileSystem.EnsureDirectoryExists (System.String directoryPath) [0x00000] in :0
at Calamari.Deployment.Journal.DeploymentJournal.Write (IEnumerable`1 elements) [0x00000] in :0
at Calamari.Deployment.Journal.DeploymentJournal.AddJournalEntry (Calamari.Deployment.Journal.JournalEntry entry) [0x00000] in :0
at Calamari.Commands.DeployPackageCommand.Execute (System.String[] commandLineArguments) [0x00000] in :0
at Calamari.Program.Execute (System.String[] args) [0x00000] in :0

Hi Alex,

No you don’t have to use a custom install directory, we will use our default extract directory as the install directory if a custom one hasn’t been specified (if you did want to use a custom install directory you would have to specify it using *unix path separators). From the log you pasted, it looks like the package successfully extracted but then failed when trying to add an entry to the DeploymentJournal.xml file (this could be due to missing variables as you ran it directly from the command line).

Did you try to run the deployment with the .zip file from Octopus?

Thank you,
Henrik

Hi Henrik,

Zipping the files and then unpacking them using the post deployment script seems to work.

The output messages from Calamari are a bit vague! I set up a ubuntu vm with mono develop and stepped through the Calamari code, but like you said I was missing the expected variables and there were problems writing the journal (also was a problem where the deployment would fail on the ExtractPackageToApplicationDirectoryConvention as it was a minimal VM and there was only ~480MB free space, and there’s a hard coded 500MB error condition in the code which I think is overridden by another variable…)

Anyway, thanks for your help. I’m really impressed with the Octopus Deploy stack so far. Now it’s deploying our .Net stuff to Windows and our static sites to Linux I’m happy to invest a lot more time in the platform.

Hi Alex,

Great to hear you got it working! We added a couple of extra system level variables that allow you to either prevent health checks running at all (OctopusSkipFreeDiskSpaceCheck) or modify the free disk space megabytes to check for (OctopusFreeDiskSpaceOverrideInMegaBytes) to let customers override our default behaviour with health checks.

Thank you and best regards,
Henrik