Difference between revisions of "Jenkins"
From Wasya Wiki
(→Install) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | === Install | + | = Other = |
+ | |||
+ | Service: | ||
+ | |||
+ | /lib/systemd/system/jenkins.service | ||
+ | |||
+ | = Install = | ||
From: http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/ | From: http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/ | ||
Line 11: | Line 17: | ||
sudo apt-get install jenkins | sudo apt-get install jenkins | ||
− | == | + | = Configure = |
+ | |||
* install git plugin in jenkins | * install git plugin in jenkins | ||
* link to the git repo | * link to the git repo | ||
Line 23: | Line 30: | ||
** disable cobertura in pom.xml | ** disable cobertura in pom.xml | ||
* From: http://blog.arungupta.me/setup-local-nexus-repository-deploying-war-from-maven-techtip74/ | * From: http://blog.arungupta.me/setup-local-nexus-repository-deploying-war-from-maven-techtip74/ | ||
+ | |||
+ | = Troubleshoot = | ||
+ | |||
+ | == Out of Memory == | ||
+ | |||
+ | # /etc/default/jenkins | ||
+ | JAVA_ARGS="-Xmx2048m" | ||
+ | |||
+ | and | ||
+ | |||
+ | sudo service jenkins restart | ||
+ | |||
+ | == password reset == | ||
+ | /var/lib/jenkins/users/username/config.xml | ||
+ | <passwordHash>#jbcrypt:$2a$10$razd3L1aXndFfBNHO95aj.IVrFydsxkcQCcLmujmFQzll3hcUrY7S</passwordHash> | ||
+ | The password is test | ||
+ | |||
+ | == better password reset == | ||
+ | From: https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-reset-jenkins-admin-users-password/ | ||
+ | sudo vi /var/lib/jenkins/config.xml | ||
+ | <useSecurity>false</useSecurity> | ||
+ | sudo service jenkins restart # or | ||
+ | sudo systemctl restart jenkins | ||
+ | |||
+ | * Click on People on the left-hand navigation menu. | ||
+ | * Click on the Admin. | ||
+ | * Delete the user account. | ||
+ | * Navigate to Jenkins / Manage Jenkins. | ||
+ | * Click on Configure Global Security | ||
+ | * Check the Enable Security check box | ||
+ | * Under Security Realm, select Jenkins’ own user database | ||
+ | * In the Authorization section, select Logged-in users can do anything. | ||
+ | * Unselect Allow anonymous read access. | ||
+ | * Click Save to save your changes. | ||
+ | * jenkins will ask you to create first admin user | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | <VirtualHost *:80> | ||
+ | ServerAdmin victor@wasya.co | ||
+ | ServerName jenkins.piousbox.com | ||
+ | |||
+ | SetEnv force-proxy-request-1.0 1 | ||
+ | SetEnv proxy-nokeepalive 1 | ||
+ | SetEnv proxy-initial-not-pooled 1 | ||
+ | |||
+ | KeepAlive On | ||
+ | ProxyVia On | ||
+ | ProxyPreserveHost On | ||
+ | ProxyTimeout 2400 | ||
+ | |||
+ | <proxy> | ||
+ | Order deny,allow | ||
+ | Allow from all | ||
+ | Require all granted | ||
+ | </proxy> | ||
+ | |||
+ | ProxyPass / http://127.0.0.1:8080/ nocanon | ||
+ | ProxyPassReverse / http://127.0.0.1:8080/ | ||
+ | ProxyRequests Off | ||
+ | AllowEncodedSlashes NoDecode | ||
+ | |||
+ | </VirtualHost> | ||
+ | </pre> |
Latest revision as of 19:18, 2 April 2022
Contents
Other
Service:
/lib/systemd/system/jenkins.service
Install
From: http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
Install Java
From: https://jenkins.io/doc/book/installing/#linux
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
Configure
- install git plugin in jenkins
- link to the git repo
- setup maven in system config
- config MAVEN_HOME in jenkins. Look into /etc/environment for that and JAVA_HOME.
- From: http://stackoverflow.com/questions/5784329/how-can-i-make-jenkins-ci-with-git-trigger-on-pushes-to-master
- a client-side (non-saved) post-receive hook
- install curl where git client is.
- install nexus as a service? (`./nexus start` as a service)
- From: https://support.sonatype.com/entries/21283268-Configure-Maven-to-Deploy-to-Nexus
- disable cobertura in pom.xml
- From: http://blog.arungupta.me/setup-local-nexus-repository-deploying-war-from-maven-techtip74/
Troubleshoot
Out of Memory
# /etc/default/jenkins JAVA_ARGS="-Xmx2048m"
and
sudo service jenkins restart
password reset
/var/lib/jenkins/users/username/config.xml <passwordHash>#jbcrypt:$2a$10$razd3L1aXndFfBNHO95aj.IVrFydsxkcQCcLmujmFQzll3hcUrY7S</passwordHash> The password is test
better password reset
sudo vi /var/lib/jenkins/config.xml <useSecurity>false</useSecurity> sudo service jenkins restart # or sudo systemctl restart jenkins
- Click on People on the left-hand navigation menu.
- Click on the Admin.
- Delete the user account.
- Navigate to Jenkins / Manage Jenkins.
- Click on Configure Global Security
- Check the Enable Security check box
- Under Security Realm, select Jenkins’ own user database
- In the Authorization section, select Logged-in users can do anything.
- Unselect Allow anonymous read access.
- Click Save to save your changes.
- jenkins will ask you to create first admin user
<VirtualHost *:80> ServerAdmin victor@wasya.co ServerName jenkins.piousbox.com SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 SetEnv proxy-initial-not-pooled 1 KeepAlive On ProxyVia On ProxyPreserveHost On ProxyTimeout 2400 <proxy> Order deny,allow Allow from all Require all granted </proxy> ProxyPass / http://127.0.0.1:8080/ nocanon ProxyPassReverse / http://127.0.0.1:8080/ ProxyRequests Off AllowEncodedSlashes NoDecode </VirtualHost>