Jenkins: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
Line 16: Line 16:
|}
|}


<source lang="bash">
<syntaxhighlight lang="bash">
docker run -it --rm \
docker run -it --rm \
--publish 8088:8080 \
--publish 8088:8080 \
Line 23: Line 23:
bin/bash
bin/bash
id; exit
id; exit
</source>
</syntaxhighlight>


  mkdir -p $JENKINS_HOME/jenkins_2.235.3/jenkins_home
  mkdir -p $JENKINS_HOME/jenkins_2.235.3/jenkins_home
Line 29: Line 29:


==Docker==
==Docker==
<source lang="bash" highlight="4-6">
<syntaxhighlight lang="bash" highlight="4-6">
docker run --detach \
docker run --detach \
--publish 8088:8080 \
--publish 8088:8080 \
Line 37: Line 37:
--volume $JENKINS_HOME/jenkins_2.235.3/jenkins_home:/var/jenkins_home \
--volume $JENKINS_HOME/jenkins_2.235.3/jenkins_home:/var/jenkins_home \
jenkins/jenkins:2.235.3-lts-centos7
jenkins/jenkins:2.235.3-lts-centos7
</source>
</syntaxhighlight>


<source lang="bash" highlight="5-8">
<syntaxhighlight lang="bash" highlight="5-8">
docker run --detach \
docker run --detach \
--publish 8088:8080 \
--publish 8088:8080 \
Line 49: Line 49:
--volume $JENKINS_HOME/jenkins_2.235.3/jenkins_home:/var/jenkins_home \
--volume $JENKINS_HOME/jenkins_2.235.3/jenkins_home:/var/jenkins_home \
jenkins/jenkins:2.235.3-lts-centos7
jenkins/jenkins:2.235.3-lts-centos7
</source>
</syntaxhighlight>


<source lang="bash">
<syntaxhighlight lang="bash">
docker exec -it jenkins bash
docker exec -it jenkins bash
cat /var/jenkins_home/secrets/initialAdminPassword
cat /var/jenkins_home/secrets/initialAdminPassword
Line 59: Line 59:
docker stop jenkins
docker stop jenkins
docker logs jenkins
docker logs jenkins
</source>
</syntaxhighlight>


==Raspbian==
==Raspbian==
<source lang="bash">
<syntaxhighlight lang="bash">
vcgencmd measure_temp
vcgencmd measure_temp
df -h
df -h
Line 90: Line 90:
vcgencmd measure_temp
vcgencmd measure_temp
df -h
df -h
</source>
</syntaxhighlight>


<source lang="bash">
<syntaxhighlight lang="bash">
# pios swap memory
# pios swap memory
printf '\nbefore:\n';free -th;\
printf '\nbefore:\n';free -th;\
Line 98: Line 98:
service dphys-swapfile restart;\
service dphys-swapfile restart;\
printf '\nupdate:\n';free -th
printf '\nupdate:\n';free -th
</source>
</syntaxhighlight>


==Admin==
==Admin==
<source lang="bash">
<syntaxhighlight lang="bash">
cat /var/lib/jenkins/secrets/initialAdminPassword
cat /var/lib/jenkins/secrets/initialAdminPassword
ssh -L 8088:localhost:8088 [email protected]
ssh -L 8088:localhost:8088 [email protected]
http://localhost:8088
http://localhost:8088
</source>
</syntaxhighlight>


==Context Path==
==Context Path==
<code>nano /etc/default/jenkins</code>
<code>nano /etc/default/jenkins</code>
<source lang="ini" start="70" highlight="10" line>
<syntaxhighlight lang="ini" start="70" highlight="10" line>
# --javahome=$JAVA_HOME
# --javahome=$JAVA_HOME
# --httpListenAddress=$HTTP_HOST (default 0.0.0.0)
# --httpListenAddress=$HTTP_HOST (default 0.0.0.0)
Line 120: Line 120:


JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --prefix=$PREFIX"
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --prefix=$PREFIX"
</source>
</syntaxhighlight>


==References==
==References==
Line 137: Line 137:


| valign="top" |
| valign="top" |
* [[Linux User Creation]]


| valign="top" |
| valign="top" |

Latest revision as of 17:05, 12 December 2024

Linux:
export JENKINS_HOME=/srv/jenkins
MacOS:
export JENKINS_HOME=$HOME/jenkins
Local location Container location Usage
$JENKINS_HOME/jenkins_2.235.3/jenkins_home /var/jenkins_home Jenkins Data
docker run -it --rm \
--publish 8088:8080 \
--publish 50000:50000 \
jenkins/jenkins:2.235.3-lts-centos7 \
bin/bash
id; exit
mkdir -p $JENKINS_HOME/jenkins_2.235.3/jenkins_home
chown -R 1000:1000 $JENKINS_HOME/jenkins_2.235.3/jenkins_home

Docker

docker run --detach \
--publish 8088:8080 \
--name jenkins \
--env JENKINS_OPTS="--prefix=/jenkins" \
--env JAVA_OPTS="-Dhudson.footerURL=https://cdn.chorke.org" \
--volume $JENKINS_HOME/jenkins_2.235.3/jenkins_home:/var/jenkins_home \
jenkins/jenkins:2.235.3-lts-centos7
docker run --detach \
--publish 8088:8080 \
--publish 50000:50000 \
--name jenkins \
--env JENKINS_SLAVE_AGENT_PORT=50000 \
--env JENKINS_OPTS="--prefix=/jenkins" \
--env JAVA_OPTS="-Dhudson.footerURL=https://cdn.chorke.org -Djava.util.logging.config.file=/var/jenkins_home/log.properties" \
--volume $JENKINS_HOME/jenkins_2.235.3/jenkins_home:/var/jenkins_home \
jenkins/jenkins:2.235.3-lts-centos7
docker exec -it jenkins bash
cat /var/jenkins_home/secrets/initialAdminPassword
exit

docker start jenkins
docker stop jenkins
docker logs jenkins

Raspbian

vcgencmd measure_temp
df -h

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key\
 | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null

cat << EOF | sudo tee /etc/apt/sources.list.d/jenkins.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
 signed-by=/usr/share/keyrings/jenkins-keyring.asc]\
 https://pkg.jenkins.io/debian binary/
EOF

apt update
apt list --upgradable

apt install git/stable
apt install fontconfig
apt install openjdk-11-jre
apt install jenkins/binary

systemctl start jenkins
systemctl status jenkins
systemctl enable jenkins
/lib/systemd/systemd-sysv-install enable jenkins

vcgencmd measure_temp
df -h
# pios swap memory
printf '\nbefore:\n';free -th;\
sed -i "s|CONF_SWAPSIZE=100|CONF_SWAPSIZE=2048|" /etc/dphys-swapfile;\
service dphys-swapfile restart;\
printf '\nupdate:\n';free -th

Admin

cat /var/lib/jenkins/secrets/initialAdminPassword
ssh -L 8088:localhost:8088 [email protected]
http://localhost:8088

Context Path

nano /etc/default/jenkins

# --javahome=$JAVA_HOME
# --httpListenAddress=$HTTP_HOST (default 0.0.0.0)
# --httpPort=$HTTP_PORT (default 8080; disable with -1)
# --httpsPort=$HTTP_PORT
# --argumentsRealm.passwd.$ADMIN_USER=[password]
# --argumentsRealm.roles.$ADMIN_USER=admin
# --webroot=~/.jenkins/war
# --prefix=$PREFIX

JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --prefix=$PREFIX"

References