1. ci@gitvmd1:~$ sudo docker top ea105957eccf
UID PID PPID C STIME TTY TIME CMD
80 37288 37274 0 Aug30 ? 00:00:00 /bin/sh /opt/wildfly9/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
80 37382 37288 0 Aug30 ? 00:01:17 /usr/java/latest/bin/java -D[Standalone] -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/opt/wildfly9/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly9/standalone/configuration/logging.properties -jar /opt/wildfly9/jboss-modules.jar -mp /opt/wildfly9/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly9 -Djboss.server.base.dir=/opt/wildfly9/standalone -b 0.0.0.0 -bmanagement 0.0.0.0
2. ci@gitvmd1:~$ docker inspect --format "{{ .State.Pid }}" ea105957eccf
środa, 31 sierpnia 2016
wtorek, 30 sierpnia 2016
how to enter to docker pid safely
sudo nsenter --target <11962/Pid number> --mount --uts --ipc --net --pid
&&
exit
&&
exit
Monitor docker network connection's
[marek.borkowski@w ~]$ ps -ef | grep 16430
marek.b+ 4329 32495 0 14:19 pts/0 00:00:00 grep --color=auto 16430
80 16430 16324 16 12:22 ? 00:19:36 /usr/java/latest/bin/java -D[Standalone] -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms512m -Xmx4096m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dcom.arjuna.ats.arjuna.allowMultipleLastResources=true -Dorg.jboss.boot.log.file=/opt/wildfly9/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly9/standalone/configuration/logging.properties -jar /opt/wildfly9/jboss-modules.jar -mp /opt/wildfly9/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly9 -Djboss.server.base.dir=/opt/wildfly9/standalone -b 0.0.0.0 -bmanagement 0.0.0.0 --server-config=standalone.xml
[marek.borkowski@w ~]$ sudo nsenter --target 16430 --net netstat -tn | head
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 172.17.0.3:38444 192.168.107.40:50219 ESTABLISHED
tcp 0 0 172.17.0.3:8080 192.168.107.9:33322 ESTABLISHED
tcp 0 0 127.0.0.1:58334 127.0.0.1:8080 ESTABLISHED
tcp 0 0 172.17.0.3:43306 192.168.107.40:50482 ESTABLISHED
tcp 0 0 172.17.0.3:42164 192.168.107.40:50482 ESTABLISHED
tcp 0 0 172.17.0.3:8080 192.168.107.9:34686 ESTABLISHED
tcp 0 0 172.17.0.3:42212 192.168.107.40:50482 ESTABLISHED
tcp 0 0 172.17.0.3:8080 192.168.107.9:33450 ESTABLISHED
marek.b+ 4329 32495 0 14:19 pts/0 00:00:00 grep --color=auto 16430
80 16430 16324 16 12:22 ? 00:19:36 /usr/java/latest/bin/java -D[Standalone] -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms512m -Xmx4096m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dcom.arjuna.ats.arjuna.allowMultipleLastResources=true -Dorg.jboss.boot.log.file=/opt/wildfly9/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly9/standalone/configuration/logging.properties -jar /opt/wildfly9/jboss-modules.jar -mp /opt/wildfly9/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly9 -Djboss.server.base.dir=/opt/wildfly9/standalone -b 0.0.0.0 -bmanagement 0.0.0.0 --server-config=standalone.xml
[marek.borkowski@w ~]$ sudo nsenter --target 16430 --net netstat -tn | head
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 172.17.0.3:38444 192.168.107.40:50219 ESTABLISHED
tcp 0 0 172.17.0.3:8080 192.168.107.9:33322 ESTABLISHED
tcp 0 0 127.0.0.1:58334 127.0.0.1:8080 ESTABLISHED
tcp 0 0 172.17.0.3:43306 192.168.107.40:50482 ESTABLISHED
tcp 0 0 172.17.0.3:42164 192.168.107.40:50482 ESTABLISHED
tcp 0 0 172.17.0.3:8080 192.168.107.9:34686 ESTABLISHED
tcp 0 0 172.17.0.3:42212 192.168.107.40:50482 ESTABLISHED
tcp 0 0 172.17.0.3:8080 192.168.107.9:33450 ESTABLISHED
piątek, 26 sierpnia 2016
translate sign to human readable version of permissions
ci@gitvmd1:~$ stat -c '%n %a' *
biz 755
crm-config 755
dominik 755
elk 755
google-chrome-stable_current_amd64.deb 644
google-chrome-stable_current_i386.deb 644
hystrix-dashboard-1.4.18.war 644
INC_ruch.txt 644
jboss-logmanager-ext-1.0.0.Alpha3.jar 666
biz 755
crm-config 755
dominik 755
elk 755
google-chrome-stable_current_amd64.deb 644
google-chrome-stable_current_i386.deb 644
hystrix-dashboard-1.4.18.war 644
INC_ruch.txt 644
jboss-logmanager-ext-1.0.0.Alpha3.jar 666
Easily Correct error in previous command Using ^ sign
ci@gitvmd1:~$ nestat -tanp | grep 8080
-bash: nestat: command not found
ci@gitvmd1:~$ ^nestat^netstat
netstat -tanp | grep 8080
tcp6 0 0 :::8080 :::* LISTEN -
-bash: nestat: command not found
ci@gitvmd1:~$ ^nestat^netstat
netstat -tanp | grep 8080
tcp6 0 0 :::8080 :::* LISTEN -
poniedziałek, 22 sierpnia 2016
start docker container in background
ci@gitvmd1:~$ docker run -d wildm /bin/bash
13afcbcb3194c17579ecad0928780d703f73bc2bc958ba5a2cac072144225a24
ci@gitvmd1:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13afcbcb3194 wildm "/bin/sh -c '/opt/wil" 34 seconds ago Up 33 seconds 8080/tcp, 9990/tcp clever_poitras
13afcbcb3194c17579ecad0928780d703f73bc2bc958ba5a2cac072144225a24
ci@gitvmd1:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13afcbcb3194 wildm "/bin/sh -c '/opt/wil" 34 seconds ago Up 33 seconds 8080/tcp, 9990/tcp clever_poitras
niedziela, 21 sierpnia 2016
how to copy files from docer container
root@ubuntu:~# docker cp c9c1103ad566:/etc/nginx/ssl/demo.pem /tmp
root@ubuntu:~# docker cp c9c1103ad566:/etc/nginx/ssl/demo.key /tmp
root@ubuntu:~# ls -ltr /tmp/
razem 44
-rw-r--r-- 1 root root 1976 sie 17 16:46 demo.pem
-rw-r--r-- 1 root root 3268 sie 17 16:46 demo.key
root@ubuntu:~# docker cp c9c1103ad566:/etc/nginx/ssl/demo.key /tmp
root@ubuntu:~# ls -ltr /tmp/
razem 44
-rw-r--r-- 1 root root 1976 sie 17 16:46 demo.pem
-rw-r--r-- 1 root root 3268 sie 17 16:46 demo.key
piątek, 19 sierpnia 2016
get ip and mac from all running docker container
ci@gitvmd1:~$ for i in `sudo docker ps -q`; do sudo docker inspect --format='{{range .NetworkSettings.Networks}}MAC:{{.MacAddress}} IP: {{.IPAddress}}}{{end}}' $i;done
MAC:02:42:ac:11:00:02 IP: 172.17.0.2}
MAC:02:42:ac:11:00:01 IP: 172.17.0.1}
MAC:02:42:ac:11:00:02 IP: 172.17.0.2}
MAC:02:42:ac:11:00:01 IP: 172.17.0.1}
środa, 17 sierpnia 2016
read jboss stats via jboss-cli
1. docker exec -it da6875e4cb32 /opt/jboss/wildfly/bin/jboss-cli.sh --connect
2. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"heap-memory-usage" => {
"init" => 67108864L,
"used" => 101469392L,
"committed" => 221773824L,
"max" => 477626368L
},
"non-heap-memory-usage" => {
"init" => 2555904L,
"used" => 64368248L,
"committed" => 73400320L,
"max" => 1593835520L
},
"object-name" => "java.lang:type=Memory",
"object-pending-finalization-count" => 0,
"verbose" => false
}
}
3. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory-pool/name=PS_Old_Gen/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"name" => "PS_Old_Gen",
"type" => "HEAP",
"valid" => true,
"memory-manager-names" => ["PS_MarkSweep"],
"usage-threshold-supported" => true,
"collection-usage-threshold-supported" => true,
"usage-threshold" => 0L,
"collection-usage-threshold" => 0L,
"usage" => {
"init" => 45088768L,
"used" => 39194568L,
"committed" => 78118912L,
"max" => 358088704L
},
"peak-usage" => {
"init" => 45088768L,
"used" => 39194568L,
"committed" => 78118912L,
"max" => 358088704L
},
"usage-threshold-exceeded" => false,
"usage-threshold-count" => 0L,
"collection-usage-threshold-exceeded" => false,
"collection-usage-threshold-count" => 0L,
"collection-usage" => {
"init" => 45088768L,
"used" => 39194568L,
"committed" => 78118912L,
"max" => 358088704L
},
"object-name" => "java.lang:type=MemoryPool,name=\"PS Old Gen\""
}
}
4. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory-pool/name=PS_Eden_Space/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"name" => "PS_Eden_Space",
"type" => "HEAP",
"valid" => true,
"memory-manager-names" => [
"PS_MarkSweep",
"PS_Scavenge"
],
"usage-threshold-supported" => false,
"collection-usage-threshold-supported" => true,
"usage-threshold" => undefined,
"collection-usage-threshold" => 0L,
"usage" => {
"init" => 16777216L,
"used" => 63294592L,
"committed" => 127401984L,
"max" => 139460608L
},
"peak-usage" => {
"init" => 16777216L,
"used" => 67108864L,
"committed" => 127401984L,
"max" => 173539328L
},
"usage-threshold-exceeded" => undefined,
"usage-threshold-count" => undefined,
"collection-usage-threshold-exceeded" => false,
"collection-usage-threshold-count" => 0L,
"collection-usage" => {
"init" => 16777216L,
"used" => 0L,
"committed" => 127401984L,
"max" => 139460608L
},
"object-name" => "java.lang:type=MemoryPool,name=\"PS Eden Space\""
}
}
2. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"heap-memory-usage" => {
"init" => 67108864L,
"used" => 101469392L,
"committed" => 221773824L,
"max" => 477626368L
},
"non-heap-memory-usage" => {
"init" => 2555904L,
"used" => 64368248L,
"committed" => 73400320L,
"max" => 1593835520L
},
"object-name" => "java.lang:type=Memory",
"object-pending-finalization-count" => 0,
"verbose" => false
}
}
3. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory-pool/name=PS_Old_Gen/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"name" => "PS_Old_Gen",
"type" => "HEAP",
"valid" => true,
"memory-manager-names" => ["PS_MarkSweep"],
"usage-threshold-supported" => true,
"collection-usage-threshold-supported" => true,
"usage-threshold" => 0L,
"collection-usage-threshold" => 0L,
"usage" => {
"init" => 45088768L,
"used" => 39194568L,
"committed" => 78118912L,
"max" => 358088704L
},
"peak-usage" => {
"init" => 45088768L,
"used" => 39194568L,
"committed" => 78118912L,
"max" => 358088704L
},
"usage-threshold-exceeded" => false,
"usage-threshold-count" => 0L,
"collection-usage-threshold-exceeded" => false,
"collection-usage-threshold-count" => 0L,
"collection-usage" => {
"init" => 45088768L,
"used" => 39194568L,
"committed" => 78118912L,
"max" => 358088704L
},
"object-name" => "java.lang:type=MemoryPool,name=\"PS Old Gen\""
}
}
4. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory-pool/name=PS_Eden_Space/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true)
{
"outcome" => "success",
"result" => {
"name" => "PS_Eden_Space",
"type" => "HEAP",
"valid" => true,
"memory-manager-names" => [
"PS_MarkSweep",
"PS_Scavenge"
],
"usage-threshold-supported" => false,
"collection-usage-threshold-supported" => true,
"usage-threshold" => undefined,
"collection-usage-threshold" => 0L,
"usage" => {
"init" => 16777216L,
"used" => 63294592L,
"committed" => 127401984L,
"max" => 139460608L
},
"peak-usage" => {
"init" => 16777216L,
"used" => 67108864L,
"committed" => 127401984L,
"max" => 173539328L
},
"usage-threshold-exceeded" => undefined,
"usage-threshold-count" => undefined,
"collection-usage-threshold-exceeded" => false,
"collection-usage-threshold-count" => 0L,
"collection-usage" => {
"init" => 16777216L,
"used" => 0L,
"committed" => 127401984L,
"max" => 139460608L
},
"object-name" => "java.lang:type=MemoryPool,name=\"PS Eden Space\""
}
}
5. [standalone@localhost:9990 /] /core-service=platform-mbean/type=memory-pool/name=PS_Perm_Gen/:read-resource(recursive=true,proxies=true,include-runtime=true,include-defaults=true
{
"outcome" => "failed",
"failure-description" => "WFLYPMB0010: No MemoryPoolMXBean with name PS_Perm_Gen currently exists",
"rolled-back" => true
}
6. [standalone@localhost:9990 /] /host=master/server=server-one/core-service=platform-mbean/type=memory-pool/name=PS_Old_Gen:read-resource(include-runtime=true)
Failed to get the list of the operation properties: "WFLYCTL0030: No resource definition is registered for address [
("host" => "master"),
("server" => "server-one"),
("core-service" => "platform-mbean"),
("type" => "memory-pool"),
("name" => "PS_Old_Gen")
read docker container stats
docker stats -a
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
2706e4c364e4 0.00% 19.53 MB / 3.968 GB 0.49% 7.927 kB / 1.145 kB 27.69 MB / 0 B
2a4f6a915e6a 0.00% 1.2 MB / 3.968 GB 0.03% 0 B / 0 B 1.23 MB / 0 B
58bad82a9cc5 0.00% 1.2 MB / 3.968 GB 0.03% 0 B / 0 B 1.23 MB / 0 B
5ddb4ab61e06 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
8074769d8920 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
8be2ab53a038 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
910894575d7f 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
94b1b84531b5 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
9f60c0752dd9 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
b32fa90fe8bc 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
b8f543e79882 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
cf6cf57a53e2 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
dd410adfc681 0.00% 1.196 MB / 3.968 GB 0.03% 0 B / 0 B 1.23 MB / 0 B
f68d317bddbc 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0
sudo docker stats 2706e4c364e4
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
2706e4c364e4 0.05% 19.53 MB / 3.968 GB 0.49% 7.927 kB / 1.145 kB 27.69 MB / 0 B
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
2706e4c364e4 0.00% 19.53 MB / 3.968 GB 0.49% 7.927 kB / 1.145 kB 27.69 MB / 0 B
2a4f6a915e6a 0.00% 1.2 MB / 3.968 GB 0.03% 0 B / 0 B 1.23 MB / 0 B
58bad82a9cc5 0.00% 1.2 MB / 3.968 GB 0.03% 0 B / 0 B 1.23 MB / 0 B
5ddb4ab61e06 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
8074769d8920 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
8be2ab53a038 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
910894575d7f 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
94b1b84531b5 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
9f60c0752dd9 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
b32fa90fe8bc 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
b8f543e79882 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
cf6cf57a53e2 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B
dd410adfc681 0.00% 1.196 MB / 3.968 GB 0.03% 0 B / 0 B 1.23 MB / 0 B
f68d317bddbc 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0
sudo docker stats 2706e4c364e4
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
2706e4c364e4 0.05% 19.53 MB / 3.968 GB 0.49% 7.927 kB / 1.145 kB 27.69 MB / 0 B
środa, 10 sierpnia 2016
deploy config jenkins + tomcat
1. install right plugin
2. configure jenkins job:
in such configuration jenkins take the war file from: /var/lib/jenkins/workspace/get_file
3. sucess
Started by user marek borkowski
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/get_file
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/bormarek/test # timeout=10
Fetching upstream changes from https://github.com/bormarek/test
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/bormarek/test +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 201dacd91f299e0eb88de6203cb7e7da4c19a528 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 201dacd91f299e0eb88de6203cb7e7da4c19a528
> git rev-list 201dacd91f299e0eb88de6203cb7e7da4c19a528 # timeout=10
Deploying /var/lib/jenkins/workspace/get_file/sample.war to container Tomcat 7.x Remote
Redeploying [/var/lib/jenkins/workspace/get_file/sample.war]
Undeploying [/var/lib/jenkins/workspace/get_file/sample.war]
Deploying [/var/lib/jenkins/workspace/get_file/sample.war]
Finished: SUCCESS
4. verification
2. configure jenkins job:
in such configuration jenkins take the war file from: /var/lib/jenkins/workspace/get_file
3. sucess
Started by user marek borkowski
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/get_file
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/bormarek/test # timeout=10
Fetching upstream changes from https://github.com/bormarek/test
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/bormarek/test +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 201dacd91f299e0eb88de6203cb7e7da4c19a528 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 201dacd91f299e0eb88de6203cb7e7da4c19a528
> git rev-list 201dacd91f299e0eb88de6203cb7e7da4c19a528 # timeout=10
Deploying /var/lib/jenkins/workspace/get_file/sample.war to container Tomcat 7.x Remote
Redeploying [/var/lib/jenkins/workspace/get_file/sample.war]
Undeploying [/var/lib/jenkins/workspace/get_file/sample.war]
Deploying [/var/lib/jenkins/workspace/get_file/sample.war]
Finished: SUCCESS
4. verification
create dir and go into it
marek@ubuntu:/tmp$ mkdir nginx && cd $_
marek@ubuntu:/tmp/nginx$ pwd
/tmp/nginx
Jenkins - where the git repo are put
SukcesLogi konsoli
Started by user marek borkowski
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/test_git
Cloning the remote Git repository
Cloning repository https://github.com/bormarek/go
> git init /var/lib/jenkins/workspace/test_git # timeout=10
Fetching upstream changes from https://github.com/bormarek/go
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/bormarek/go +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url https://github.com/bormarek/go # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/bormarek/go # timeout=10
Fetching upstream changes from https://github.com/bormarek/go
> git -c core.askpass=true fetch --tags --progress https://github.com/bormarek/go +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 835271417788d0bf08adf28aedebf7ce5c2e1eaf (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 835271417788d0bf08adf28aedebf7ce5c2e1eaf
First time build. Skipping changelog.
Finished: SUCCESS
marek@ubuntu:/var/lib/jenkins/workspace/test_git$ ls -ltr
razem 31112
-rw-r--r-- 1 jenkins jenkins 124 sie 10 15:01 StructTest.go
-rw-r--r-- 1 jenkins jenkins 301 sie 10 15:01 StructMet.go
-rwxr-xr-x 1 jenkins jenkins 12 sie 10 15:01 README.md
-rw-r--r-- 1 jenkins jenkins 177 sie 10 15:01 FuncTest.go
-rwxr-xr-x 1 jenkins jenkins 185 sie 10 15:01 ArrayElements.go
-rw-r--r-- 1 jenkins jenkins 155 sie 10 15:01 arr.go
-rw-r--r-- 1 jenkins jenkins 222 sie 10 15:01 args.go
-rwxr-xr-x 1 jenkins jenkins 2253776 sie 10 15:01 args
-rw-r--r-- 1 jenkins jenkins 403 sie 10 15:01 c.pub
-rwxr-xr-x 1 jenkins jenkins 448 sie 10 15:01 cmdLine.go
-rw-r--r-- 1 jenkins jenkins 334 sie 10 15:01 checkIfFile.go
-rw-r--r-- 1 jenkins jenkins 1679 sie 10 15:01 c
-rw-r--r-- 1 jenkins jenkins 134 sie 10 15:01 arrayTest.go
-rw-r--r-- 1 jenkins jenkins 193 sie 10 15:01 array.go
-rwxr-xr-x 1 jenkins jenkins 2253760 sie 10 15:01 array
-rw-r--r-- 1 jenkins jenkins 125 sie 10 15:01 errors.go
-rwxr-xr-x 1 jenkins jenkins 286 sie 10 15:01 envVar.go
-rwxr-xr-x 1 jenkins jenkins 223 sie 10 15:01 commandExec.go
-rwxr-xr-x 1 jenkins jenkins 2669552 sie 10 15:01 commandExec
-rw-r--r-- 1 jenkins jenkins 113 sie 10 15:01 forLoop.go
-rw-r--r-- 1 jenkins jenkins 106 sie 10 15:01 forCont.go
-rw-r--r-- 1 jenkins jenkins 309 sie 10 15:01 fileInfo.go
-rwxr-xr-x 1 jenkins jenkins 2393920 sie 10 15:01 fileInfo
-rwxr-xr-x 1 jenkins jenkins 127 sie 10 15:01 helloWorld.go
-rwxr-xr-x 1 jenkins jenkins 15520 sie 10 15:01 git-credential-osxkeychain
-rw-r--r-- 1 jenkins jenkins 109 sie 10 15:01 forWhile.go
-rw-r--r-- 1 jenkins jenkins 194 sie 10 15:01 forRange.go
-rwxr-xr-x 1 jenkins jenkins 2253824 sie 10 15:01 forRange
-rwxr-xr-x 1 jenkins jenkins 141 sie 10 15:01 randPerm.go
-rwxr-xr-x 1 jenkins jenkins 141 sie 10 15:01 randInt.go
-rwxr-xr-x 1 jenkins jenkins 222 sie 10 15:01 printfPractice.go
-rw-r--r-- 1 jenkins jenkins 603 sie 10 15:01 netHttp.go
-rw-r--r-- 1 jenkins jenkins 195 sie 10 15:01 ifSqrt.go
-rwxr-xr-x 1 jenkins jenkins 2258080 sie 10 15:01 ifSqrt
-rwxr-xr-x 1 jenkins jenkins 287 sie 10 15:01 readFile.go
-rwxr-xr-x 1 jenkins jenkins 2462848 sie 10 15:01 readFile
-rw-r--r-- 1 jenkins jenkins 57 sie 10 15:01 vertex.go
-rw-r--r-- 1 jenkins jenkins 100 sie 10 15:01 var.go
-rw-r--r-- 1 jenkins jenkins 146 sie 10 15:01 varCalc.go
-rw-r--r-- 1 jenkins jenkins 666 sie 10 15:01 serveHttp.go
-rwxr-xr-x 1 jenkins jenkins 7569628 sie 10 15:01 serveHttp
-rwxr-xr-x 1 jenkins jenkins 325 sie 10 15:01 writeFile.go
-rw-r--r-- 1 jenkins jenkins 392 sie 10 15:01 webHelloWorld.go
-rwxr-xr-x 1 jenkins jenkins 7565260 sie 10 15:01 webHelloWorld
Started by user marek borkowski
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/test_git
Cloning the remote Git repository
Cloning repository https://github.com/bormarek/go
> git init /var/lib/jenkins/workspace/test_git # timeout=10
Fetching upstream changes from https://github.com/bormarek/go
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/bormarek/go +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url https://github.com/bormarek/go # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/bormarek/go # timeout=10
Fetching upstream changes from https://github.com/bormarek/go
> git -c core.askpass=true fetch --tags --progress https://github.com/bormarek/go +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 835271417788d0bf08adf28aedebf7ce5c2e1eaf (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 835271417788d0bf08adf28aedebf7ce5c2e1eaf
First time build. Skipping changelog.
Finished: SUCCESS
marek@ubuntu:/var/lib/jenkins/workspace/test_git$ ls -ltr
razem 31112
-rw-r--r-- 1 jenkins jenkins 124 sie 10 15:01 StructTest.go
-rw-r--r-- 1 jenkins jenkins 301 sie 10 15:01 StructMet.go
-rwxr-xr-x 1 jenkins jenkins 12 sie 10 15:01 README.md
-rw-r--r-- 1 jenkins jenkins 177 sie 10 15:01 FuncTest.go
-rwxr-xr-x 1 jenkins jenkins 185 sie 10 15:01 ArrayElements.go
-rw-r--r-- 1 jenkins jenkins 155 sie 10 15:01 arr.go
-rw-r--r-- 1 jenkins jenkins 222 sie 10 15:01 args.go
-rwxr-xr-x 1 jenkins jenkins 2253776 sie 10 15:01 args
-rw-r--r-- 1 jenkins jenkins 403 sie 10 15:01 c.pub
-rwxr-xr-x 1 jenkins jenkins 448 sie 10 15:01 cmdLine.go
-rw-r--r-- 1 jenkins jenkins 334 sie 10 15:01 checkIfFile.go
-rw-r--r-- 1 jenkins jenkins 1679 sie 10 15:01 c
-rw-r--r-- 1 jenkins jenkins 134 sie 10 15:01 arrayTest.go
-rw-r--r-- 1 jenkins jenkins 193 sie 10 15:01 array.go
-rwxr-xr-x 1 jenkins jenkins 2253760 sie 10 15:01 array
-rw-r--r-- 1 jenkins jenkins 125 sie 10 15:01 errors.go
-rwxr-xr-x 1 jenkins jenkins 286 sie 10 15:01 envVar.go
-rwxr-xr-x 1 jenkins jenkins 223 sie 10 15:01 commandExec.go
-rwxr-xr-x 1 jenkins jenkins 2669552 sie 10 15:01 commandExec
-rw-r--r-- 1 jenkins jenkins 113 sie 10 15:01 forLoop.go
-rw-r--r-- 1 jenkins jenkins 106 sie 10 15:01 forCont.go
-rw-r--r-- 1 jenkins jenkins 309 sie 10 15:01 fileInfo.go
-rwxr-xr-x 1 jenkins jenkins 2393920 sie 10 15:01 fileInfo
-rwxr-xr-x 1 jenkins jenkins 127 sie 10 15:01 helloWorld.go
-rwxr-xr-x 1 jenkins jenkins 15520 sie 10 15:01 git-credential-osxkeychain
-rw-r--r-- 1 jenkins jenkins 109 sie 10 15:01 forWhile.go
-rw-r--r-- 1 jenkins jenkins 194 sie 10 15:01 forRange.go
-rwxr-xr-x 1 jenkins jenkins 2253824 sie 10 15:01 forRange
-rwxr-xr-x 1 jenkins jenkins 141 sie 10 15:01 randPerm.go
-rwxr-xr-x 1 jenkins jenkins 141 sie 10 15:01 randInt.go
-rwxr-xr-x 1 jenkins jenkins 222 sie 10 15:01 printfPractice.go
-rw-r--r-- 1 jenkins jenkins 603 sie 10 15:01 netHttp.go
-rw-r--r-- 1 jenkins jenkins 195 sie 10 15:01 ifSqrt.go
-rwxr-xr-x 1 jenkins jenkins 2258080 sie 10 15:01 ifSqrt
-rwxr-xr-x 1 jenkins jenkins 287 sie 10 15:01 readFile.go
-rwxr-xr-x 1 jenkins jenkins 2462848 sie 10 15:01 readFile
-rw-r--r-- 1 jenkins jenkins 57 sie 10 15:01 vertex.go
-rw-r--r-- 1 jenkins jenkins 100 sie 10 15:01 var.go
-rw-r--r-- 1 jenkins jenkins 146 sie 10 15:01 varCalc.go
-rw-r--r-- 1 jenkins jenkins 666 sie 10 15:01 serveHttp.go
-rwxr-xr-x 1 jenkins jenkins 7569628 sie 10 15:01 serveHttp
-rwxr-xr-x 1 jenkins jenkins 325 sie 10 15:01 writeFile.go
-rw-r--r-- 1 jenkins jenkins 392 sie 10 15:01 webHelloWorld.go
-rwxr-xr-x 1 jenkins jenkins 7565260 sie 10 15:01 webHelloWorld
how to test github connection
1. ssh-keygen -t rsa -b 4096 -C "bormarek@gmail.com"
2. root@ubuntu:~# eval "$(ssh-agent -s)"
Agent pid 22355
3. root@ubuntu:~# ssh-add ~/.ssh/id_rsa
Identity added: /home/marek/.ssh/id_rsa (/home/marek/.ssh/id_rsa)
4. root@ubuntu:~# ssh -T git@github.com
Hi bormarek! You've successfully authenticated, but GitHub does not provide shell access.
2. root@ubuntu:~# eval "$(ssh-agent -s)"
Agent pid 22355
3. root@ubuntu:~# ssh-add ~/.ssh/id_rsa
Identity added: /home/marek/.ssh/id_rsa (/home/marek/.ssh/id_rsa)
Hi bormarek! You've successfully authenticated, but GitHub does not provide shell access.
how to check what is going on inside of docker container
root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a41e947e925 wordpress:latest "/entrypoint.sh apach" 10 minutes ago Up 10 minutes 0.0.0.0:8000->80/tcp wordpress_wordpress_1
8526889870a9 mysql:5.7 "docker-entrypoint.sh" 10 minutes ago Up 10 minutes 3306/tcp wordpress_db_1
e01674b264b4 nginx "nginx -g 'daemon off" About an hour ago Up 51 minutes 80/tcp, 443/tcp nginx_nginx_1
69581c420e2b rancher/server "/usr/bin/s6-svscan /" 12 hours ago Up About an hour 3306/tcp, 0.0.0.0:8080->8080/tcp silly_mclean
root@ubuntu:~# docker exec -it 0a41e947e925 /bin/bash
root@0a41e947e925:/var/www/html# ls
index.php readme.html wp-admin wp-comments-post.php wp-config.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
license.txt wp-activate.php wp-blog-header.php wp-config-sample.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a41e947e925 wordpress:latest "/entrypoint.sh apach" 10 minutes ago Up 10 minutes 0.0.0.0:8000->80/tcp wordpress_wordpress_1
8526889870a9 mysql:5.7 "docker-entrypoint.sh" 10 minutes ago Up 10 minutes 3306/tcp wordpress_db_1
e01674b264b4 nginx "nginx -g 'daemon off" About an hour ago Up 51 minutes 80/tcp, 443/tcp nginx_nginx_1
69581c420e2b rancher/server "/usr/bin/s6-svscan /" 12 hours ago Up About an hour 3306/tcp, 0.0.0.0:8080->8080/tcp silly_mclean
root@ubuntu:~# docker exec -it 0a41e947e925 /bin/bash
root@0a41e947e925:/var/www/html# ls
index.php readme.html wp-admin wp-comments-post.php wp-config.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
license.txt wp-activate.php wp-blog-header.php wp-config-sample.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php
poniedziałek, 8 sierpnia 2016
very simple nginx loadbalancer
cat /etc/nginx/sites-available/proxy
upstream 192.168.1.29 {
server 10.0.3.36:80 weight=2;
server 10.0.3.113:80 weight=3;
server 10.0.3.186:80 weight=3;
server 10.0.3.168:80 weight=4;
server 10.0.3.193:80 weight=4;
server 10.0.3.130:80 weight=3;
}
server {
listen 80;
server_name ubuntu;
location / {
proxy_pass http://192.168.1.29;
}
}
upstream 192.168.1.29 {
server 10.0.3.36:80 weight=2;
server 10.0.3.113:80 weight=3;
server 10.0.3.186:80 weight=3;
server 10.0.3.168:80 weight=4;
server 10.0.3.193:80 weight=4;
server 10.0.3.130:80 weight=3;
}
server {
listen 80;
server_name ubuntu;
location / {
proxy_pass http://192.168.1.29;
}
}
create docker tomcat container with app deployment Dockerfile
1. root@ubuntu:~#
cat Dockerfile
FROM tomcat
ADD sample.war /usr/local/tomcat/webapps/
2. run command:
root@ubuntu:~# docker build --tag=tomcat_app .
Sending build context to Docker daemon 316.1 MB
Step 1 : FROM tomcat
---> 25e98610c7d0
Step 2 : ADD sample.war /usr/local/tomcat/webapps/
---> e063fb60dcb7
Removing intermediate container 137ac3730916
Successfully built e063fb60dcb7
3. check docker images:
root@ubuntu:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat_app latest e063fb60dcb7 10 seconds ago 359.2 MB
cat Dockerfile
FROM tomcat
ADD sample.war /usr/local/tomcat/webapps/
2. run command:
root@ubuntu:~# docker build --tag=tomcat_app .
Sending build context to Docker daemon 316.1 MB
Step 1 : FROM tomcat
---> 25e98610c7d0
Step 2 : ADD sample.war /usr/local/tomcat/webapps/
---> e063fb60dcb7
Removing intermediate container 137ac3730916
Successfully built e063fb60dcb7
3. check docker images:
root@ubuntu:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat_app latest e063fb60dcb7 10 seconds ago 359.2 MB
4. verification
docker inspect -f '{{ .NetworkSettings.IPAddress }}' b804ab2e870d
w3m http://172.17.0.2:8080/sample
docker inspect -f '{{ .NetworkSettings.IPAddress }}' b804ab2e870d
w3m http://172.17.0.2:8080/sample
niedziela, 7 sierpnia 2016
how to check docker container ip adress
root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c2d8b8ad7dbf wildfly "/opt/jboss/wildfly/b" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp elated_meitner
root@ubuntu:~# docker inspect -f '{{ .NetworkSettings.IPAddress }}' c2d8b8ad7dbf
172.17.0.2
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c2d8b8ad7dbf wildfly "/opt/jboss/wildfly/b" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp elated_meitner
root@ubuntu:~# docker inspect -f '{{ .NetworkSettings.IPAddress }}' c2d8b8ad7dbf
172.17.0.2
backup and restore docker container
# docker save -o ~/container1.tar container1
[root@localhost marek]# ls -l ~/container1.tar
-rw-r--r--. 1 root root 131017216 Jun 14 20:31 /root/container1.tar
docker load -i /root/container1.tar
docker images
[root@localhost marek]# ls -l ~/container1.tar
-rw-r--r--. 1 root root 131017216 Jun 14 20:31 /root/container1.tar
docker load -i /root/container1.tar
docker images
how to forced remove docker image
root@ubuntu:~# docker rmi 71d87edfa7f5
Failed to remove image (71d87edfa7f5): Error response from daemon: conflict: unable to delete 71d87edfa7f5 (must be forced) - image is referenced in one or more repositories
root@ubuntu:~# docker rmi -f 71d87edfa7f5
Untagged: wildfly-app:latest
Untagged: wildfly-helloworld:latest
Deleted: sha256:71d87edfa7f5ad7ef5b15521bd6a8cc6f368af5ac7fc6a44165d904ac997b55d
Deleted: sha256:b1992e989159199daf9fba21fff4713e056d85e07e6c1a9409155a6e73ae07ec
Deleted: sha256:dcdf3e6f385e7f93329e71ddd6b93ef81256c195289425efdde6c20f09bd4d99
Deleted: sha256:e1009af06161e03ddfb44414c54adf5c213a51bcafdb4ee943033ee329f5c469
Failed to remove image (71d87edfa7f5): Error response from daemon: conflict: unable to delete 71d87edfa7f5 (must be forced) - image is referenced in one or more repositories
root@ubuntu:~# docker rmi -f 71d87edfa7f5
Untagged: wildfly-app:latest
Untagged: wildfly-helloworld:latest
Deleted: sha256:71d87edfa7f5ad7ef5b15521bd6a8cc6f368af5ac7fc6a44165d904ac997b55d
Deleted: sha256:b1992e989159199daf9fba21fff4713e056d85e07e6c1a9409155a6e73ae07ec
Deleted: sha256:dcdf3e6f385e7f93329e71ddd6b93ef81256c195289425efdde6c20f09bd4d99
Deleted: sha256:e1009af06161e03ddfb44414c54adf5c213a51bcafdb4ee943033ee329f5c469
Subskrybuj:
Posty (Atom)