Octopus 2.6 Command line restore

Hi

Having to DR restore my Octopus 2.6 and am changing how it is hosted etc.

I want to be able to “reset” a blank Octopus server image from backups - i.e. download last known good backup and command line restore the system.

Server image would have Octopus installed - but with no environments, projects etc and then I would simply restore the octobak - is there a command line syntax that will do this?

I found references to Raven.Smuggler.exe - but I am not sure that is “enough” - i.e. is that just the DB and not supporting “bits”?

Any guidance gratefully received.

Hi Stuart,

If you follow the instructions here, at the bottom of the page, instead of pressing the green Restore button, you click the Show script link you will get the list of commands that we execute to restore a backup to Octopus.

Hope that helps!

Henrik

Thanks - will let you know how I get on

Stuart

Hi

Sorry but am hitting an issue with Octopus and scripting. Following on from
the scripting restore link you gave me

If I run:

(From within cmd/bat file so the double % is made into one %)

NET stop octopusdeploy
FOR /F “”“delims=|”"" %%I IN (‘DIR “”“c:\S3Source*.octobak”"" /B /O:D’) DO
SET NewestFile=%%I
"C:\Octopus\Octopus.Server.exe" restore -instance “OctopusServer” -file
C:\S3Source%NewestFile% -master-key “123”

So from DOS

NET stop octopusdeploy
FOR /F “”“delims=|”"" %I IN (‘DIR “”“c:\S3Source*.octobak”"" /B /O:D’) DO
SET NewestFile=%I
"C:\Octopus\Octopus.Server.exe" restore -instance “OctopusServer” -file
C:\S3Source%NewestFile% -master-key “123”

The Dos version works.

The bat/CMD script generates the correct Octopus command but returns:

“Cannot start service from the command line or a debugger. A Windows
Service must first be installed (using installutil.exe) and then started
with the ServerExplorer, Windows Services Administrative tool or the NET
START command.”

I’ve tried different users including Administrator for the script, tried as
scheduled task, tried as a AWS Cloudformation script, always the same
response “Cannot start service …”

But it works from DOS…

I am “so close” to having the whole project closed. This one command is
proving problematic. I’ve seen stuff on-line regarding --console but that
seems to apply to tentacle(s); Its obviously possible as you do it from the
Octopus Manager App…

Banging my head - hoping you can help.

Happy to write a .NET app if needed - just need to be able to script the
Octopus DB restore.

Thanks
Stuart

Hi Stuart,

Can you try passing --console when calling Octopus.Server.exe to force it to run as a console application instead of service…

Hope that helps!

Henrik

Thanks - works a treat

Stuart

Hi Stuart,

Great to hear!

Thank you and kind regards,
Henrik