Table of contents
Introduction
It is possible to use the hosting of attachments in the cloud so they are available at all times. Backups are already in place in the cloud, but some customers who have important processes in Octopus prefer to have a local copy of the attachments in case their external network fails or if Octopus is not available.
AttachmentDownloader allows you to download all Octopus attachments from the cloud to the local network.
References
How It Works
The AttachmentDownloader program allows you to download all the hosted attachments of a team manually or automatically using a Windows scheduled task.
The program runs for one team at a time and downloads the files to the attachment folder configured for that team.
Prerequisites
- Have attachments hosted by Octopus.
-
Create an Octopus system account that will be used to run the task. See OctopusSystem Account information.
- Creating a folder to download the attachments on the local network.
- If the DB contains more than one team, a different folder is recommended for each team.
- The full folder path must be added to the configuration of each team that uses AttachmentDownloader from Tools > Options > 3- Important general options > Network directory containing the attached files.
- The rights for Octopus users of each team must be allocated based on the use to be made.
A folder was already configured in the options that probably still contains attachments that have not yet been uploaded to the cloud.
It is important not to change the path of this folder.
The goal of having a local copy in addition to the already-hosted copy is not to modify the files locally, but to access them in the event of a failure.
AttachmentDownloader should be used with the ForceReplaceFiles parameter to ensure that the local copy is up to date.
As the local copy will be overwritten on the next download, we must ensure that changes to the attachments are returned in Octopus or temporarily stored elsewhere during an outage.
How to Use AttachmentDownloader
AttachmentDownloader is a program that runs from a command line (DOS). It is designed to be easy to automate.
To run the ESI.Octopus.AttachmentDownloaderApp.exe program, you must open a Dos prompt and position yourself in the Octopus folder. Subsequently, enter the command line. (See Command Line Examples).
By default the Octopus folder is located in C:\Program Files\Octopus OR \%homepath%\AppData\Local\Octopus.
Examples of folders where Octopus can be located:
- For Windows 7 and +
- C:\Users\slevesque\AppData\Local\Octopus.
- For Windows XP
- C:\Documents and Settings\slevesque\Local Settings\Application Data\Octopus.
What you need to know:
Each time the program is run a .LOG file is created in this format; ToolName_YYYYMMDD_HHMMSS.log
- For example AttachmentDownloader_20190618_105242.log.
Use this file to see the results of the command execution and errors if there are any.
Also see the OctopusTools | Maintenance of log files article about the importance of the log file management.
Parameters
There are many available parameters, of which 3 are mandatory, to execute AttachmentDownloader:
Mandatory Parameters
- /Login
- Octopus Username.
- /Password
- Octopus Password.
- /Team
- The number of the team's attachments to download.
- By default, IT is team number 1.
- Howto find the team number?
Example: ESI.Octopus.AttachmentDownloaderApp.exe /Login:system /Password:octo /Team:1
Optional Parameters
- /ForceReplaceFiles
- Although this parameter is not mandatory, logically it should always be used to ensure that the local copy of the attachment is up-to-date.
- Overwrites the old copy of an attachment with the cloud version.
- Without this setting, AttachmentDownloader will simply add the new attachments without updating the ones that have already been uploaded.
- /LogFilePath
- To replace the location of the log file. By default, the file is named AttachmentDownloaderApp_AAAAMMJJ_HHMMSS.log and will be located in the Octopus folder.
- If you move the file to another folder, make sure this folder exists (the system cannot create the folder).
- Furthermore the path must contain the name of the file.
- To learn more about the location of Octopus files, see the OctopusInstallation Folder article.
Example : /LogFilePath:C:\LogFiles\AttachmentDownloaderJournal.log
- /WaitKeyPress
- Allows to force the activation of a key press after the import is executed. Meaning the DOS window will be shown until a key is pressed.
-
This option is useful when doing tests to make sure there are no problems with the command line.
-
Note that this parameter should not be used in a recurring task.
- /PurgeLogs
- Can automatically erase old log files
- The parameter is used to determine how many days of log files that you want to keep.
- For more information, see the OctopusTools | Maintenance of log files.
Examples
- Command line for downloading attachments with basic parameters.
ESI.Octopus.AttachmentDownloaderApp.exe /Login:system /Password:octo /Team:1 /ForceReplaceFiles
- Command line for downloading attachments with optional parameters.
ESI.Octopus.AttachmentDownloaderApp.exe /Login:system /Password:octo /Team:1 /ForceReplaceFiles /WaitKeyPress /LogFilePath:G:\ABCFolder
Automate AttachmentDownloader
Refer to the WindowsScheduled Task article to find out how to automate downloads with AttachmentDownloader.
Operation Log File
During execution, AttachmentDownloader creates a log file in addition to the results returned on screen. This log is saved in the AttachmentDownloaderApp_AAAAMMJJ_HHMMSS.log file and it is located in the Octopus folder from where AttachmentDownloader is run.
Thank you, your message has been sent.