Skip to content

Instantly share code, notes, and snippets.

@jaohaohsuan
Created April 6, 2017 05:25
Show Gist options
  • Select an option

  • Save jaohaohsuan/d3fa1c2a9b0ba3790baca62bd1a34ab7 to your computer and use it in GitHub Desktop.

Select an option

Save jaohaohsuan/d3fa1c2a9b0ba3790baca62bd1a34ab7 to your computer and use it in GitHub Desktop.
jenkins pipeline pod & docker run hybrid
podTemplate(
label: 'stored2',
containers: [
containerTemplate(name: 'jnlp', image: 'henryrao/jnlp-slave', args: '${computer.jnlpmac} ${computer.name}', alwaysPullImage: true),
containerTemplate(name: 'elastic', image: 'docker.elastic.co/elasticsearch/elasticsearch:5.2.2', ttyEnabled: true,
command: '/usr/share/elasticsearch/bin/elasticsearch -Ehttp.host=0.0.0.0 -Etransport.host=127.0.0.1 -Expack.security.enabled=false',
envVars: [
containerEnvVar(key: 'ES_JAVA_OPTS', value: '-Des.cgroups.hierarchy.override=/')
])
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
]) {
node('stored2') {
ansiColor('xterm') {
stage('init env') {
docker.image('docker.elastic.co/elasticsearch/elasticsearch:5.3.0')
.inside('-e "xpack.security.enabled=false" -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1"') {
parallel init: {
sh 'su -m -c \'cd /usr/share/elasticsearch && bin/es-docker\' elasticsearch &'
},
verify: {
timeout(time: 30, unit: 'SECONDS') {
waitUntil {
def r = sh script: "curl -XGET http://localhost:9200?pretty", returnStatus: true
return (r == 0)
}
}
},failFast: true
}
}
stage('inside pod') {
timeout(time: 30, unit: 'SECONDS') {
waitUntil {
def r = sh script: "curl -XGET http://127.0.0.1:9200?pretty", returnStatus: true
return (r == 0)
}
}
}
}
}
}
@jaohaohsuan
Copy link
Author

jaohaohsuan commented Apr 6, 2017

elasticsearch 5x 需要配置

sysctl -w vm.max_map_count=262144

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