piątek, 17 listopada 2017

How to deploy two JHipster apps on one Tomcat server.

In application-prod.yml find section:


spring:
    devtools:
        restart:
            enabled: false
        livereload:
            enabled: false

and replace with:


spring:
    jmx:
        default-domain: your_app_name
    devtools:
        restart:
            enabled: false
        livereload:
            enabled: false

your_app_name must be diffent in each app.

czwartek, 16 listopada 2017

How to deploy JHipster app on Ubuntu 16.04 server in prod profile

1. Install Elasticsearch 2.4.0 form here: https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-0. Check Spring Data Elasticsearch Spring Boot version matrix.

sudo dpkg -i elasticsearch-2.4.0.deb

In etc/elasticsearch/elasticsearch.yml set:
cluster.name: elasticsearch

sudo systemctl enable elasticsearch.service

in /etc/default/elasticsearch make sure these are uncommented:

START_DAEMON=true


sudo /etc/init.d/elasticsearch restart

check: 
curl -XGET 'localhost:9200' 

https://lxadm.com/Problems_starting_elasticsearch_in_Ubuntu_16.04
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04

2. Install tomcat 7


sudo apt-get install tomcat7

Create setenv.sh in /usr/share/tomcat7/lib/ and add:
CATALINA_OPTS="$CATALINA_OPTS -server -Xms256m -XX:+UseConcMarkSweepGC"

sudo nano /etc/tomcat7/tomcat-users.xml
insert:
  <role rolename="admin-gui"/>
  <role rolename="manager-gui"/>

  <user username="admin" password="password" roles="admin-gui,manager-gui"/>

Install additional packages

sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples

restart tomcat

sudo service tomcat7 restart

login

http://server_IP_address:8080

Copy your JHipster app .war file to /var/lib/tomcat7/webapps

Go to http://server_IP_address:8080/manager/html

Start your app.


Check /var/log/tomcat7/catalina.out file for errors.


3. Enabling SSL
Prepare the Certificate Keystore according to: https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Prepare_the_Certificate_Keystore

Copy .keystore to /etc/tomcat7 and change its owner to tomcat.

In /etc/tomcat7/server.xml uncoment section:
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />

change to:
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
keystoreFile="/etc/tomcat7/.keystore" keystorePass="change_it" />