You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi
I've successfully set up a self-hosted runner on a Windows Server 2019 VM. How would you set it up so that it starts on boot and restarts on failure?
Ok, this is what I did. Assuming we have the agent in d:\bb...
Copy-Item amd64/prunsrv.exe d:\bb\bin\
Copy-Item prunmgr.exe d:\bb\bin\
New-Item -ItemType Directory -Path d:\bb\logs
param (
[string]$accountUuid = $(throw "-accountUuid is required."),
[string]$repositoryUuid = "",
[string]$runnerUuid = $(throw "-runnerUuid is required."),
[string]$OAuthClientId = $(throw "-OAuthClientId is required."),
[string]$OAuthClientSecret = $(throw "-OAuthClientSecret is required."),
[string]$workingDirectory = $(throw "-workingDirectory is required."),
[string]$serviceUser = $(throw "-serviceUser is required."),
[string]$servicePassword = $(throw "-servicePassword is required."),
[string]$runnerEnvironment = "PRODUCTION",
[string]$scheduledStateUpdateInitialDelaySeconds = "0",
[string]$scheduledStateUpdatePeriodSeconds = "30",
[string]$cleanupPreviousFolders = "false",
[string]$logPath = "../logs"
)
if (-not (Get-Command -name "java" -CommandType Application -errorAction SilentlyContinue))
{
Write-Error "Java not installed"
break
}
$argList = @("install",
"BitBucketRunner",
"--Install=D:\bb\bin\prunsrv.exe",
"--Startup=auto",
"--Classpath=runner.jar",
"--StartClass=com.atlassian.pipelines.runner.core.ApplicationImpl",
"--StartMethod=main",
"--StopClass=com.atlassian.pipelines.runner.core.ApplicationImpl",
"--StopMethod=main",
'--DisplayName="Bitbucket Runner"',
'--Description="Bitbucket Runner Service"',
"--StartMode=jvm",
"--StopMode=jvm",
"--Jvm=auto",
"--ServiceUser=$serviceUser",
"--ServicePassword=$servicePassword",
"++JvmOptions=-Dbitbucket.pipelines.runner.account.uuid=$accountUuid",
"++JvmOptions=-Dbitbucket.pipelines.runner.repository.uuid=$repositoryUuid",
"++JvmOptions=-Dbitbucket.pipelines.runner.uuid=$runnerUuid",
"++JvmOptions=-Dbitbucket.pipelines.runner.environment=$runnerEnvironment",
"++JvmOptions=-Dbitbucket.pipelines.runner.oauth.client.id=$OAuthClientId",
"++JvmOptions=-Dbitbucket.pipelines.runner.oauth.client.secret=$OAuthClientSecret",
"++JvmOptions=-Dbitbucket.pipelines.runner.directory.working=$workingDirectory",
"++JvmOptions=-Dbitbucket.pipelines.runner.runtime=windows-powershell",
"++JvmOptions=-Dbitbucket.pipelines.runner.scheduled.state.update.initial.delay.seconds=$scheduledStateUpdateInitialDelaySeconds",
"++JvmOptions=-Dbitbucket.pipelines.runner.scheduled.state.update.period.seconds=$scheduledStateUpdatePeriodSeconds",
"++JvmOptions=-Dbitbucket.pipelines.runner.cleanup.previous.folders=$cleanupPreviousFolders"
"++JvmOptions=-Dfile.encoding=UTF-8",
"++JvmOptions=-Dsun.jnu.encoding=UTF-8",
"--JvmMs=256",
"--JvmMx=1024",
"--JvmSs=4000",
"--LogPath=$logPath",
"--LogPrefix=bitbucket-agent",
"--StdOutput=$logPath\stdout.log",
"--StdError=$logPath\stderr.log")
$params = @{
FilePath = "prunsrv"
ArgumentList = $argList
}
$p = Start-Process @params -NoNewWindow -Wait
$argList = @("delete",
"BitBucketRunner")
$params = @{
FilePath = "prunsrv"
ArgumentList = $argList
}
$p = Start-Process @params -NoNewWindow -Wait
.\install.ps1 -accountUuid '{*****}' -runnerUuid '{*****}' -OAuthClientId ***** -OAuthClientSecret ***** -workingDirectory '..\temp' -serviceUser DOMAIN\user -servicePassword ***
I can't get my service to start after following this installation procedure. procmon requires an Oracle JDK properly installed in the registry but Bitbucket runner only works with OpenJDK. How did you do it? Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the Eclipse Adoptium Java version and then
1. Added this JAVA_HOME to environment variables:
C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot
2. Added to PATH:
C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot\bin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @fernando_arias ,
welcome to the Atlassian community!
You need to install a service. Please take a look to the following article https://confluence.atlassian.com/bitbucketserver/start-and-stop-bitbucket-776640144.html
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Fabio
Looks like the answer is for running Bitbucket as a service, but I'm talking about a Bitbucket Windows runner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.