root@ubuntu:~# curl ipinfo.io/212.77.98.9
{
"ip": "212.77.98.9",
"hostname": "www.wp.pl",
"city": "Warzachewka Polska",
"region": "Kujawsko-Pomorskie",
"country": "PL",
"loc": "52.5931,19.0894",
"org": "AS12827 Wirtualna Polska S.A."
}
"city": "Warzachewka Polska", ???
Really?
sobota, 30 lipca 2016
czwartek, 28 lipca 2016
Export import docker container
- docker export <CONTAINER ID> > /home/export.tar
- cat /home/export.tar | docker import - some-name:latest
poniedziałek, 25 lipca 2016
how to run docker container with forwarded ports
docker run -p 80:80 -td ubuntu_nginx_full
root@ubuntu:~# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
12b043cfda9c ubuntu_nginx_full "/bin/bash" About a minute ago Up About a minute 0.0.0.0:80->80/tcp fervent_meninsky
root@ubuntu:~# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
12b043cfda9c ubuntu_nginx_full "/bin/bash" About a minute ago Up About a minute 0.0.0.0:80->80/tcp fervent_meninsky
poniedziałek, 18 lipca 2016
change time zone ubuntu
root@vagrant-ubuntu-trusty-64:~# ln -sf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
niedziela, 17 lipca 2016
very simple reverse proxy nginx
apt-get install nginx
unlink /etc/nginx/sites-enabled/default
/etc/nginx/sites-available/tomcat
server {
listen 80;
location / {
proxy_pass http://192.168.1.12:8080/sample/;
}
}
verification:
marek@lati:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
unlink /etc/nginx/sites-enabled/default
/etc/nginx/sites-available/tomcat
server {
listen 80;
location / {
proxy_pass http://192.168.1.12:8080/sample/;
}
}
verification:
marek@lati:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
sobota, 16 lipca 2016
how to add jmx support to tomcat
root@ubuntu-xenial:/usr/share/tomcat7/bin#
vi setenv.sh
export JAVA_OPTS="-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9090
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=192.168.1.10"
systemctl restart tomcat7.service
vi setenv.sh
export JAVA_OPTS="-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9090
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=192.168.1.10"
systemctl restart tomcat7.service
czwartek, 14 lipca 2016
Ansible playbook
---
- hosts: all
sudo: yes
tasks:
- name: install tomcat
apt: name=tomcat7 update_cache=yes state=latest
- name: install tomcat-admin
apt: name=tomcat7-admin update_cache=yes state=latest
- name: install tomcat-examples
apt: name=tomcat7-examples update_cache=yes state=latest
- name: install tomcat7-admin
apt: name=tomcat7-admin update_cache=yes state=latest
- name: install tomcat7-docs
apt: name=tomcat7-docs update_cache=yes state=latest
- name: install libxml2-dev
apt: name=libxml2-dev update_cache=yes state=latest
- name: install apache benchmark
apt: name=apache2-utils update_cache=yes state=latest
- name: echo
shell: echo Hello World!! > /tmp/hello_workd
- name: deploy sample test application
shell: cd /tmp/ && wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war && cp sample.war /var/lib/tomcat7/webapps/
- name: install apache2
apt: name=apache2 update_cache=yes state=latest
- name: get tar.gz of tomcat7
shell: wget http://ftp.piotrkosoft.net/pub/mirrors/ftp.apache.org/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz
- name: get zabbix repo
shell: wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+trusty_all.deb && dpkg -i zabbix-release_3.0-1+trusty_all.deb && apt-get update -y && apt-get install zabbix-agent -y
- name: restart tomcat service
shell: /etc/init.d/tomcat7 restart
- name: configure tomcat users
shell: echo
- name: enabled mod_rewrite
apache2_module: name=rewrite state=present
notify:
- restart apache2
handlers:
- name: restart apache2
service: name=apache2 state=restarted
marek@debian:~$ ansible-playbook playbook.yml --ask-sudo-pass
sudo password:
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.1.66]
TASK: [install tomcat] ********************************************************
ok: [192.168.1.66]
TASK: [install tomcat-admin] **************************************************
ok: [192.168.1.66]
TASK: [install tomcat-examples] ***********************************************
ok: [192.168.1.66]
TASK: [install tomcat7-admin] *************************************************
ok: [192.168.1.66]
TASK: [install tomcat7-docs] **************************************************
ok: [192.168.1.66]
TASK: [install libxml2-dev] ***************************************************
ok: [192.168.1.66]
TASK: [install apache benchmark] **********************************************
ok: [192.168.1.66]
TASK: [echo] ******************************************************************
changed: [192.168.1.66]
TASK: [deploy sample test application] ****************************************
changed: [192.168.1.66]
TASK: [install apache2] *******************************************************
ok: [192.168.1.66]
TASK: [get tar.gz of tomcat7] *************************************************
changed: [192.168.1.66]
TASK: [get zabbix repo] *******************************************************
changed: [192.168.1.66]
TASK: [restart tomcat service] ************************************************
changed: [192.168.1.66]
TASK: [configure tomcat users] ************************************************
changed: [192.168.1.66]
TASK: [enabled mod_rewrite] ***************************************************
ok: [192.168.1.66]
PLAY RECAP ********************************************************************
192.168.1.66 : ok=16 changed=6 unreachable=0 failed=0
- hosts: all
sudo: yes
tasks:
- name: install tomcat
apt: name=tomcat7 update_cache=yes state=latest
- name: install tomcat-admin
apt: name=tomcat7-admin update_cache=yes state=latest
- name: install tomcat-examples
apt: name=tomcat7-examples update_cache=yes state=latest
- name: install tomcat7-admin
apt: name=tomcat7-admin update_cache=yes state=latest
- name: install tomcat7-docs
apt: name=tomcat7-docs update_cache=yes state=latest
- name: install libxml2-dev
apt: name=libxml2-dev update_cache=yes state=latest
- name: install apache benchmark
apt: name=apache2-utils update_cache=yes state=latest
- name: echo
shell: echo Hello World!! > /tmp/hello_workd
- name: deploy sample test application
shell: cd /tmp/ && wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war && cp sample.war /var/lib/tomcat7/webapps/
- name: install apache2
apt: name=apache2 update_cache=yes state=latest
- name: get tar.gz of tomcat7
shell: wget http://ftp.piotrkosoft.net/pub/mirrors/ftp.apache.org/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz
- name: get zabbix repo
shell: wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+trusty_all.deb && dpkg -i zabbix-release_3.0-1+trusty_all.deb && apt-get update -y && apt-get install zabbix-agent -y
- name: restart tomcat service
shell: /etc/init.d/tomcat7 restart
- name: configure tomcat users
shell: echo
- name: enabled mod_rewrite
apache2_module: name=rewrite state=present
notify:
- restart apache2
handlers:
- name: restart apache2
service: name=apache2 state=restarted
marek@debian:~$ ansible-playbook playbook.yml --ask-sudo-pass
sudo password:
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [192.168.1.66]
TASK: [install tomcat] ********************************************************
ok: [192.168.1.66]
TASK: [install tomcat-admin] **************************************************
ok: [192.168.1.66]
TASK: [install tomcat-examples] ***********************************************
ok: [192.168.1.66]
TASK: [install tomcat7-admin] *************************************************
ok: [192.168.1.66]
TASK: [install tomcat7-docs] **************************************************
ok: [192.168.1.66]
TASK: [install libxml2-dev] ***************************************************
ok: [192.168.1.66]
TASK: [install apache benchmark] **********************************************
ok: [192.168.1.66]
TASK: [echo] ******************************************************************
changed: [192.168.1.66]
TASK: [deploy sample test application] ****************************************
changed: [192.168.1.66]
TASK: [install apache2] *******************************************************
ok: [192.168.1.66]
TASK: [get tar.gz of tomcat7] *************************************************
changed: [192.168.1.66]
TASK: [get zabbix repo] *******************************************************
changed: [192.168.1.66]
TASK: [restart tomcat service] ************************************************
changed: [192.168.1.66]
TASK: [configure tomcat users] ************************************************
changed: [192.168.1.66]
TASK: [enabled mod_rewrite] ***************************************************
ok: [192.168.1.66]
PLAY RECAP ********************************************************************
192.168.1.66 : ok=16 changed=6 unreachable=0 failed=0
środa, 6 lipca 2016
niedziela, 3 lipca 2016
Subskrybuj:
Posty (Atom)