Cambiar el puerto Jenkins en macOS


Me preguntaba cómo se podría cambiar el puerto predeterminado de Jenkins 8080. Usando linux o windows, esto se hace simplemente con el archivo de configuración. Pero el archivo de configuración Mac de Jenkins se ve completamente diferente de los otros.

Por supuesto, uno podría pasar el parámetro htt httpPort al iniciar el servidor, pero quiero hacer esto dentro de un archivo de configuración.

¿Hay una opción para eso?

PD: Pasar la instancia de Jenkins a través de apache resolvería un poco el problema, pero quiero cambiar el puerto Jenkins.

Gracias!

Author: skaffman, 2011-08-21

7 answers

Te guiaré a través de él:

cd /Applications/Jenkins sudo vi winstone.properties Añadir httpPort=9999 al archivo. Para ver todas las opciones que puedes poner allí escribe java -jar jenkins.war --help

Ejecute java -jar jenkins.war desde /Applications/Jenkins. Su puerto será cambiado. jenkins.war recoge las opciones de configuración de ./winstone.properties de forma predeterminada.

Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ pwd
/Applications/Jenkins
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ ls -al
total 87928
drwxr-xr-x   4 root  wheel       136 Aug 21 12:32 .
drwxrwxr-x+ 83 root  admin      2822 Aug 21 12:05 ..
-rwxr-xr-x   1 root  wheel  45014470 Aug 19 13:14 jenkins.war
-rw-r--r--   1 root  wheel        14 Aug 21 12:32 winstone.properties
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ sudo cat winstone.properties 
httpPort=9494
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ java -jar jenkins.war
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
[Winstone 2011/08/21 12:33:19] - Beginning extraction from war file
Jenkins home directory: /Users/afinnell/.jenkins found at: $user.home/.jenkins
[Winstone 2011/08/21 12:33:21] - HTTP Listener started: port=9494
 13
Author: Andrew T Finnell,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-21 16:31:48

Parece que la forma predeterminada es:

#agregue los parámetros predeterminados - esto editará /Library/Preferences/org.jenkins-ci.plist

Los valores predeterminados de Sudo write /Library/Preferences/org.jenkins-ci httpPort 7070

# stop

Sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

# start

Sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

 135
Author: alex,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-28 05:57:06

Esto funcionó para mí para cambiar el puerto a 7070 u otro.

sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 7070

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

Más información sobre esto

 8
Author: uopeydel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-13 12:13:40

Otra solución en caso de ejecutar dos demonios de Jenkins, en diferentes puertos HTTP (es decir, 7070 y 7071) : Múltiples demonios Jenkins en diferentes puertos HTTP (Mac OS X)

 0
Author: STB Land,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:55:03

He instalado Jenkins en mi Mac OS High Sierra usando Brew.

Por favor, siga los siguientes pasos:

  1. Tienes que cambiar el puerto al archivo de abajo:

    /usr/local/Cellar/jenkins/2.x. x/homebrew.mxcl.jenkins.plist

  2. Asigne cualquier puerto libre como 7070 o cualquier número que desee.[Si tiene IP estática, puede dar el puerto 80 (HTTP)]

    --httpPort=7070

  3. También necesita reiniciar el Servidor Jenkins. usando los siguientes comandos brew service:

    $ brew services stop jenkins

    $ servicios de brew start jenkins

Eso es todo.!

 0
Author: Pratik Patel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-06 15:04:36

Antes de modificar el puerto Jenkins en macOS,debe prestar atención a la forma de instalación de Jenkins.

Aquí te recomiendo instalar Jenkins por 'Homebrew' si quieres lidiar con la construcción de proyectos de iOS,porque puedes encontrar algunos errores que la forma de usar .pkg para instalar,es realmente difícil resolver los problemas.

He instalado el comando Jenkins LTS by brew:

brew install jenkins-lts

Así que mi archivo Jenkins plist es aquí:

/usr/local/Cellar/jenkins-lts/2.121.2/homebrew.mxcl.jenkins-lts.plist

Puede modificar el valor httpPort de default 8080 al otro valor,y luego guardar el archivo.

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>homebrew.mxcl.jenkins-lts</string> <key>ProgramArguments</key> <array> <string>/usr/libexec/java_home</string> <string>-v</string> <string>1.8</string> <string>--exec</string> <string>java</string> <string>-Dmail.smtp.starttls.enable=true</string> <string>-jar</string> <string>/usr/local/opt/jenkins-lts/libexec/jenkins.war</string> <string>--httpListenAddress=127.0.0.1</string> <string>--httpPort=8383</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>

sudo launchctl unload el comando no funcionará para ti.Debe probar estos comandos para reiniciar su Jenkins y hacer que la modificación del puerto funcione.

brew services stop jenkins-lts brew services start jenkins-lts

ifeegoo:~ ifeegoo$ brew services stop jenkins-lts Stopping `jenkins-lts`... (might take a while) ==> Successfully stopped `jenkins-lts` (label: homebrew.mxcl.jenkins-lts) ifeegoo:~ ifeegoo$ brew services start jenkins-lts ==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)

Nota: Si instaló Jenkins LTS, debe prestar atención a que su comando debe ser jenkins-lts, no jenkins.

 0
Author: ifeegoo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-21 08:55:17

Simplemente escriba el siguiente comando en el terminal:

sudo defaults write /Library/Preferences/org.jenkins-ci.plist httpPort 9999

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

Eso debería resolverlo.

 0
Author: Maaz Hasan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-17 11:47:07