jenkins tomcat spring boot

+++++++++++++++++++++++++ up & run++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++
apache-tomcat-8.5.24\bin\catalina.bat
conf/tomcat-users.xml :


role rolename="manager-gui"/role

role rolename="manager-script"/role
role rolename="manager-status"/role
role rolename="manager-jmx"/role
role rolename="standard"/role
role rolename="admin-gui"/role
user password="admin" roles="admin-gui, manager-gui,standard,manager-script,manager-status,manager-jmx" username="admin"/user

http://localhost:8080/docs/appdev/
http://localhost:8080/manager/status
http://localhost:8080/manager/html
http://localhost:8080/manager/html/deploy
http://localhost:8080/docs/appdev/
+++++++++++++++++++++++++

first of all check open port in firewall: sudo ufw status verbose

/etc/init.d/ бинарники

sudo apt-get install tomcat8

sudo nano /etc/default/jenkins jenkins port change from default 8080

to add admin panel(http://localhost:8080/manager/html, http://localhost:8080/host-manager/html) password for tomcat
sudo nano /var/lib/tomcat8/conf/tomcat-users.xml

------------------
This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat8/webapps/ROOT/index.html

Tomcat8 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat8 and CATALINA_BASE in /var/lib/tomcat8, following the rules from /usr/share/doc/tomcat8-common/RUNNING.txt.gz.

You might consider installing the following packages, if you haven't already done so:

tomcat8-docs: This package installs a web application that allows to browse the Tomcat 8 documentation locally. Once installed, you can access it by clicking here.

tomcat8-examples: This package installs a web application that allows to access the Tomcat 8 Servlet and JSP examples. Once installed, you can access it by clicking here.

tomcat8-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.
-------------------------------
mvn clean package -Dmaven.test.skip=true / -DskipTests=true
----------------------
Tomcat Default Port
Print
Email
I can't see my ResCarta-Web site from outside my institution?


The default port for the Apache Tomcat service is 8080.  This port is defined for HTML traffic along with the more often used port 80.  On many campus networks all high ports are blocked.   This means the high HTML port of 8080 is also blocked.

If your server is not using port 80 for any other server (APACHE, IIS), you can change the default port of your Apache Tomcat server to port 80 by editing the  server.xml file located in the conf directory. Look for the connector which should be set to 8080. It should be like the following...


connectionTimeout="20000" redirectPort=

"8443" />
Change the 8080 to 80 and restart your Tomcat service.


redirectPort="8443" />

 If your server is also running IIS and it is located on port 80,  your Tomcat service will not start.  To run both IIS and Tomcat and use a sinlgle port 80 will require a more extensive configuration of both IIS and tomcat. 
---------------------------------------
JENKINS_HOME ~ /var/lib/jenkins/
------------------------
error: Caused by: java.io.IOException: Server returned HTTP response code: 413 for URL
sudo nano /etc/nginx/nginx.conf -> client_max_body_size 2M;
src: https://stackoverflow.com/questions/45475729/jenkins-upload-file-to-artifactory-failed-i-got-413-error
src: https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/
------------------------
ls -lah /var/lib/tomcat8/webapps/*
-rw-r--r-- 1 tomcat8 tomcat8  48M Dec  3 12:40 /var/lib/tomcat8/webapps/ROOT.war

/var/lib/tomcat8/webapps/ROOT:
total 20K
drwxr-xr-x 5 tomcat8 tomcat8 4.0K Dec  3 12:40 ./
drwxrwxr-x 3 tomcat8 tomcat8 4.0K Dec  3 12:40 ../
drwxr-xr-x 3 tomcat8 tomcat8 4.0K Dec  3 12:40 META-INF/
drwxr-xr-x 3 tomcat8 tomcat8 4.0K Dec  3 12:40 org/
drwxr-xr-x 5 tomcat8 tomcat8 4.0K Dec  3 12:40 WEB-INF/
-------------------------
tomcat try start app and then if exception occure output some strange error like:
Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The Tomcat Manager responded "FAIL - Deployed application at context path / but context failed to start
17:08:19 " instead of the expected "OK" message

solvation: sudo tail -f -n 200 /var/lib/tomcat8/logs/catalina.out
или clear; cd /var/lib/tomcat8/logs/; true > ./catalina.out; tail -f -n 200 catalina.out
this is usual spring boot app console log
export CATALINA_OPTS="-Xms4000m"
export CATALINA_OPTS="$CATALINA_OPTS -Xms4000m -Xmx8192m"
эти параметры только на время сеанса а чтоб постоянно то в .bash
-------------------------
open postgres to listen all income connections:
https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html
------------------- nginx
https://devtidbits.com/2015/12/08/nginx-as-a-reverse-proxy-to-apache-tomcat/
sudo nginx -s reload
nginx -t test conf
------------
psql postgresql://postgres:123@localhost:5432/dbname
ian@test-srv-network ~> sudo -u postgres psql
------------------
sudo -i -u jenkins
sudo passwd jenkins
This will prompt for you to set a password.
Alternatively you could create the jenkins user prior to installing, and it would leverage that one.
---------------------- ssh
ssh чтобы не спрашивало да нет при добавлении сертификата:
 nano /etc/ssh/ssh_config
ask -> StrictHostKeyChecking no
src: https://www.youtube.com/watch?v=UPSpLDnuJC0
https://stackoverflow.com/questions/37331571/how-to-setup-ssh-keys-for-jenkins-to-publish-via-ssh
---------------------------
 su -s /bin/bash jenkins
For anyone wondering how to get whoami to return the user jenkins: Once logged in as another user, do su -s /bin/bash jenkins. Just doing su jenkins won't work because jenkins does not have a shell by default.
src: https://stackoverflow.com/questions/37331571/how-to-setup-ssh-keys-for-jenkins-to-publish-via-ssh
-------------------
su -u jenkins nohup cmd & и потом $! будет показывать неверный PID
поэтому смена пользователя в другой отдельной команде на другой строке от nohup.
restart.sh

#!/bin/bash
count=$(echo $count
if [ ! -z $count ]
then
    kill -9 $count
    echo "Count is "$count
    true > save_pid.txt
fi
./daemon.sh

daemon.sh

#!/bin/bash
#su - jenkins
nohup /home/staker/app-test/start.sh >/dev/null 2>&1 &

start.sh

#! /bin/bash
java -Xmx4000M -Xms4000M -Dfile.encoding=UTF-8 -jar /home/staker/app-test/site-1.0.0.0.jar --spring.conf$echo $! > java_process.pid



оригинал start.sh
java -Xmx4000M -Xms4000M -Dfile.encoding=UTF-8 -jar /home/staker/app/site-1.0.0.0.jar --spring.config.location=classpath:/application.properties,/home/staker/app/site.properties >/dev/null 2>&1
--------------------------------------
spring profile set while deploy in container or mvn -D args

spring.profiles.active=test
nano /etc/tomcat8/catalina.properties
src: https://stackoverflow.com/questions/15814497/setting-spring-profile-variable
src: https://stackoverflow.com/questions/13956651/externalizing-tomcat-webapp-config-from-war-file
--------------------------email
jenkins настройка мыла:
smtp.yandex.ru
email@yandex.ru
password
ssh enable
port 465
конфиг для jenkins отправки писем:
/etc/default/jenkins
JAVA_ARGS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true -Dmail.smtp.auth=true"
-------------------------
/etc/init.d/tomcat8 restart
/etc/init.d/nginx reload
 /etc/tomcat8/server.xml

 /etc/tomcat8/tomcat-users.xml








Комментарии

Популярные сообщения из этого блога

kafka конспект однако

Дэвид Рок: Ваш мозг на работе - Разговоры в Гугле

Отслеживание Процесса загрузки с PHP и JavaScript