Comprehensive data protection for all workloads
Post Reply
Laura_Funk
Novice
Posts: 5
Liked: 1 time
Joined: May 17, 2016 9:50 pm
Full Name: Laura Funk
Contact:

GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by Laura_Funk »

Has anyone out there tried to backup GitHub Enterprise with Veeam?
I have everything working with the Veeam zip PowerShell commands and windows task scheduler.
Basically you have to connect to the GitHub Server using a ssh certificate over port 122 using the admin@server.domain command, then issue the ghe-maintenance -s to start, and -u to stop.
So I have set up a Linux key credentials with the username of admin@server.domain, passphrase for the ssh certificate and private key. The ssh port is set to 122.
I have placed several variations of .sh, .ps1, and .bat script files all that work from the service account user on the Veeam box, but none work when adding them to the application aware processing scripts, or the advanced job settings scripts.

The command to run on the Veeam server from PowerShell to turn on the maintenance is:
bash -c 'ssh -p 122 admin@server.domain ghe-maintnenace -s'

The commands to run from the Git-Bash utility on the Veeam server are:
ssh -p 122 admin@server.domain
ghe-maintenance -s

How do I tell if the credentials to connect to the GitHub Enterprise server is working, or just bad formatting of the scripts?

Thanks,
Laura
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by PTide »

Hi,
I have placed several variations of .sh, .ps1, and .bat script files all that work from the service account user on the Veeam box, but none work when adding them to the application aware processing scripts, or the advanced job settings scripts.
There is a difference between pre-job and pre-freeze script - pre-job script is executed on Veeam server, pre-freeze script is executed inside the VM and you need to have VMware tools installed on the VM for that. Which way do you prefer?

Thanks.
Laura_Funk
Novice
Posts: 5
Liked: 1 time
Joined: May 17, 2016 9:50 pm
Full Name: Laura Funk
Contact:

Re: GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by Laura_Funk »

The pre-job script would probably be less complicated than the pre-freeze that is executed inside the VM, because of the certificate authentication.
I have tried the advanced job settings/scripts/Run the following script before the job; is that the pre-job you referenced?
If so I have tried pointing it to the .sh script that works when logged into the Veeam Server, and the PowerShell script that works from the task scheduler on the Veeam server. I even turned off Run administrators in Admin Approval mode, and set the global execution policy.. I have tried setting it up as a .bat as well that also runs if executed as the backup service account on the Veeam server.
The error is that the specified executable is not a valid application for this OS platform. Which makes me think its actually trying to run the script on the GitHub server and not the Veeam Backup server?

I have also tried the pre-freeze script that is located in the Application-Aware Processing Options. Its not apparent what part fails, which makes it more difficult to troubleshoot. Just a generic script terminated with exit code 1

Thanks,
Laura
Laura_Funk
Novice
Posts: 5
Liked: 1 time
Joined: May 17, 2016 9:50 pm
Full Name: Laura Funk
Contact:

Re: GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by Laura_Funk » 1 person likes this post

I found the Combination that works with GitHub and Veeam
My missing link was that I had to start the Veeam Backup Service with the backup service account that I was logging into the console with.
That backup service account profile has to have the Git-Bash installed, path set, with the ssh keys set up and loaded into the GitHub server.
https://help.github.com/enterprise/2.6/ ... sh-access/
I was not able to get the .sh script to work directly (The specified executable is not a valid application for this OS platform) but you can call the .sh script from a .bat.
This works when calling the .bat from the Advanced Job settings under scripts. -s is for starting (setting) maintenance mode, and -u is for stopping (unsetting) the maintenance mode.

.bat file contents:

Code: Select all

@echo off
"C:\Program Files\Git\git-bash.exe" d:\scripts\StartGitMaint.sh
StartGitMaint.sh contents:

Code: Select all

Maint()
{
sleep 5
echo ghe-maintenance -s
}
Maint | ssh -p 122 admin@servername.domainname
echo complete
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by PTide »

Hi,

Sorry for the late reply. I'm glad that you've nailed it!
The error is that the specified executable is not a valid application for this OS platform. Which makes me think its actually trying to run the script on the GitHub server and not the Veeam Backup server?
So you've tried running the pre-job script as .bat, .ps1, and even .sh and all three throwed you the error ("The specified executable is not a valid application for this OS platform'), whereas all three extensions seem to work when you start them manually on Veeam server, is that correct?
Just a generic script terminated with exit code 1
Have you checked if there are any EOL characters in your .sh script file?

Thanks!
Laura_Funk
Novice
Posts: 5
Liked: 1 time
Joined: May 17, 2016 9:50 pm
Full Name: Laura Funk
Contact:

Re: GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by Laura_Funk »

Thank you for the Reply PTide!

It is working correctly with the .bat calling the .sh, just not directly calling the .sh. I'm OK with that solution. No end of line characters in the .sh.
Wanted to make sure I posted what worked incase you have other customers with a GitHub Enterprise Server.

Thanks,
Laura
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: GitHub Enterprise Maintenance mode Pre and Post Scripts

Post by PTide »

It is working correctly with the .bat calling the .sh, just not directly calling the .sh.
Just checked with QA team - some extensions (including .sh) have been mistakenly added into the drop-down list that you can see when choosing a pre-job script. Sorry for confusion.

Thank you.
Post Reply

Who is online

Users browsing this forum: Ivan239 and 139 guests