Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jenkins on Heroku

Jenkins on Heroku

  1. Download jenkins.war
  2. Create pom.xml (it'll be pretty much empty)
  3. Create Procfile to do 'java -jar jenkins.war' etc...

Deploy!

<?xml version="1.0" encoding="UTF-8"?>
<!--
Just need a plain and mostly empty pom.xml for Heroku to detect that this is a Java application
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>helloworld</artifactId>
</project>
# Only listen on http; disable ajp and https
web: java -jar jenkins.war --httpPort=$PORT --ajp13Port=-1 --httpsPort=-1
@manishcompro
Copy link

manishcompro commented Dec 31, 2012

Hi

I exactly performed the above steps. Created the git and deployed the git on heroku. It acknowledged me about the build is successful and the application has been deployed. But when i ran the application. It displayed application error.

Please advise, if i am missing any step.

@jacksonhull
Copy link

jacksonhull commented Jan 20, 2013

Have you had any issues with:
a) running multiple dynos with Jenkins
b) getting the git keys to work from the plugin. using keys:add didn't work for me as the key isn't used when the plugin attempts to clone from Github
thanks

@larsburgess
Copy link

larsburgess commented Mar 8, 2013

I found having just the Procfile in the git repo to be sufficient and using the heroku-deploy plugin works:

https://devcenter.heroku.com/articles/war-deployment

However, since jenkins uses the filesystem for job & build data, you can't use it for much. Have you overcome this limitation somehow?

@jimmyeisenhauer
Copy link

jimmyeisenhauer commented Apr 5, 2013

any thoughts on file system issue? lose all config when restart

@rajiteh
Copy link

rajiteh commented Jan 16, 2014

Anyone had any luck with the config file missing issue? I've set the $JENKINS_HOME variable to /app/.jenkins but still no use.

@rajiteh
Copy link

rajiteh commented Jan 16, 2014

Anyone had any luck with the config file missing issue? I've set the $JENKINS_HOME variable to /app/.jenkins but still no use.

@rajiteh
Copy link

rajiteh commented Jan 16, 2014

Anyone had any luck with the config file missing issue? I've set the $JENKINS_HOME variable to /app/.jenkins but still no use.

@rajiteh
Copy link

rajiteh commented Jan 16, 2014

Anyone had any luck with the config file missing issue? I've set the $JENKINS_HOME variable to /app/.jenkins but still no use.

@spudnic
Copy link

spudnic commented Mar 7, 2015

Seems to work like a charm for me. I have a very hacky solution which is to add the .jenkins/... directly to the git repo. https://github.com/spudnic/herkou-jenkins For obvious reasons this is not the most secure way to do it but it does work. The tricky part is that any plugins or job configurations that I want to do need to I have to do them locally and then cp from my ~/.jenkins/ to REPO/.jenkins....

@gabrielruiu
Copy link

gabrielruiu commented Mar 29, 2015

Worked perfect for me. Thanks!

@skarllot
Copy link

skarllot commented Mar 17, 2016

I tried without success, too many moving parts.
I got OpenShift: https://hub.openshift.com/quickstarts/98-jenkins-server

@tmichels-brightplan
Copy link

tmichels-brightplan commented Mar 23, 2016

Was anyone able to fix this?I tried what @spudnic suggested and it works but any update I make to the jobs does not get persisted after I restart the dyno. Thinking it was the write permission on the .jenkins file I did changed the writer permission (chmod -r 777) but still no change persisted. I am leaning toward using AWS.

@maheshwarimani1991
Copy link

maheshwarimani1991 commented Jan 10, 2017

Tried deploying the app to heroku. Deployed successfully. On Jenkins page its asking for Administrator password. Where can I find the same. Please suggest.

@Vaults1
Copy link

Vaults1 commented Jan 29, 2017

Did this work for anyone? @maheshwarimani1991 I think the password is password.

@HongQuanTo
Copy link

HongQuanTo commented Mar 2, 2017

@maheshwarimani1991 password is store on ~/.jenkins or $JENKINS_HOME. However, if you first start or restart dyno, you can access its log to get the pass code.
heroku logs --app your-app-name

@samueltc
Copy link

samueltc commented Mar 31, 2017

How do you persist configuration?

@rahil11
Copy link

rahil11 commented Sep 9, 2017

@HongQuanTo where exactly we have to run this command "heroku logs --app your-app-name" ?

@satty1987
Copy link

satty1987 commented Dec 27, 2017

I have deployed jenkins on heroku and deployed successfully and accessing jenkins on heroku but after 4 5 hours it is asking for Administrator password

Copy link

ghost commented May 14, 2018

Any news today for the ephemeral problem on Heroku?

@abrahamcalf
Copy link

abrahamcalf commented Jun 15, 2018

@satnam348 I am facing the same issue, after 4 or 5 hours it is asking me for the Administrator password. Anyone know why?

@Chityanj
Copy link

Chityanj commented May 12, 2019

To get initial password restart the Dyno and type
heroku logs --app your-app-name where you installed heroku cli

For preventing it to sleep register site here
https://kaffeine.herokuapp.com

@deepakkoirala
Copy link

deepakkoirala commented Jan 19, 2020

Where does the jenkins create its configuration files in heroku after it has been deployed using this approach.

Since Heroku is not persisting the configuration files after restart so I want to keep all these configuration files inside the git. So after restart I do not need to configure again and it will pick from the config files. Is it possible ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment