Jump to content

xitix

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by xitix

  1. Thanks again, you're great!

     

    My last changes into the code is not needed anymore.

    Now the app deployment it works perfectly with your script modification. :)

     

    On my side will be one more re-deployment in a week or two, for changing the method of avatar image uploading to mysql with the /tmp path.

     

    I will prepare a how-to post for the users that want to build Java apps with Spring and Thymelef.

     

     

     

    Dear,

     

    Finally have solved the update for the avatar image uploading method. Please re-deploy the app.

     

    WAR package is uploaded on /home/xitix/xitix_blog.war

     

    Thanks

  2. Create a Java Spring Boot powered by Thymeleaf to be deployed on heliohost.org

     

     

    One of the examples I have enjoyed is the great videos of Spring app-demo of Dan Geabunea , with his pseudonym RomanianCoder.

    You can download part of the sources from Github, but keep in mind that have to adapt in order to deploy on heliohost.

     

    I will make a small summary of the most important steps on how to make such project ready to be deployed on heliohost.

     

    Creating a Spring Boot project with Eclipse WST. This is done in Eclipse, like this: File-> New -> Eclipse Starter Project
    You may give the name to the project; in this case BookingDemo, then the group id user_demo and package is indicated to be org.heliohost. The best option is to set the version of Java 1.8 because the comfort that Maven gives, and the convenient to choose.

     

    user is your login user @ heliohost

     

    I will explain below why is important to have the user_ as prefix, in front of the app, while I will not insist on how to build the MVC Spring Boot part or the Thymeleaf templates. You can download the sources from Github and follow the video tutorial from youtube

     

    If you chose to create the project and not import form github, it is better chose for below options; they will not appear with "Frequently Used", but you will have to look for them in each of their categories:

     

    1. Actuator which is an informator of the application with multiple indicators
    2. Thymeleaf which is a system of web templates
    3. H2 as BD. You could choose any other
    4. Web to generate web environments
    5. JPA for persistence
    6. Lombok to avoid the verbosity of getters and setters

     

     

    You may follow the explanation from tutorial, but have to consider the necessary configuration in order to deploy the app on heliohost.org

    It is mandatory to enter in the file application.properties of the folder src / main / resources , the following entries:

    spring.datasource.url: jdbc:mysql://servername.heliohost.org/user_bookings?verifyServerCertificate=false&useSSL=false&requireSSL=false
    spring.datasource.username = user_name
    spring.datasource.password = password
    spring.datasource.driverClassName = com.mysql.jdbc.Driver

    spring.datasource.tomcat.max-active=2

    server.contextPath=/user_demo
    server.port=8080

    spring.template.cache: false
    spring.thymeleaf.check-template-location=true
    spring.thymeleaf.prefix=classpath:/templates/
    spring.thymeleaf.suffix=.html
    #spring.thymeleaf.mode=LEGACYHTML5
    spring.thymeleaf.encoding=UTF-8
    spring.thymeleaf.content-type=text/html
    spring.thymeleaf.cache=false

     

    Pay attention in which PATH is the context_path that is used and in which java package is the class to use.

     

     

    Any deployment in heliohost is done with an user_ in front of the WAR app. If you choose to have the server.contextPath with the correct deployment name, your app will not have any issue to run. On contrary, if your app have not such context from settings, you may need to change the context path from Thymeleaf if decide to use use Spring Security you may choose to disable the CSRF coockie path in order to use with Thymeleaf Server-relative URLs.

     

    However, if you choose to bring from beginning an user_ in front of your name app, it will be more convenient for you.

     

    Other important thing is: if you decide to use the heliohost database, you have to limit the max connection from your configuration, while spring.datasource.tomcat.max-active=50; pay attention, this is very important: spring.datasource.tomcat.max-active=2

     

    As the licenses are payed per no# of connections, and the number impicit in Spring is about 50! You will not get access from heliohost, even when configure

    from cpanel.

     

    You have to configure carefully: Current Databases -> MySQL Users -> Add New User -> Add User To Database

     

    Also, from RemoteMySQL you have to introduce your local IP (in case you need to test the app deployment on localhost, while connected to heliohost mysql database)

     

     

    You may also like to check the mysql on heliohost with a simple php script.

     

     

    To make it works, you also have to configure the proper rigths after upload the php file into public_html folder.

    Do not forget to close the database connection at the end of the file, as you need to limit the number of coonections otherwise you may face some errors when test your remote connection: "com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: User user_name already has more than 'max_user_connections' active connections"

     

     

    On the Java application template viewer part, chose to deploy with Thymeleaf Server-relative URLs.

     

    You may check and double-check the app on your computer, before upload the WAR.

     

    The best way is to deploy and test your app locally, and after you are shure that it works, you can upload to heliohost.

    Please, be patient and pay respect on the communication with the admin.

     

    Success & happy coding !

  3. Thanks again, you're great!

     

    My last changes into the code is not needed anymore.

    Now the app deployment it works perfectly with your script modification. :)

     

    On my side will be one more re-deployment in a week or two, for changing the method of avatar image uploading to mysql with the /tmp path.

     

    I will prepare a how-to post for the users that want to build Java apps with Spring and Thymelef.

  4. I'm positive no one has ever done most of what you're doing so if you can explain what you've done so far to make things work it would be beneficial to anyone who has the same issues in the future and finds this thread by searching.

     

    Dear,

     

    For shure I will explain in details on how to build such kind of project. I am already preparing this post. Finding a way to configure such app for heliohost it helps me learning Java with related frameworks. I am not clear if the "user_" agregation is made with Apache htaccess, or is done with Tomcat server xml configuration.

     

    Today I have made little changes into code with an additional <cookie-config> and <path> to /user_app constraint, on the application config.

    Let's test if such approach works.

     

     

    Please re-deploy the app.

     

    WAR package is uploaded on /home/xitix/xitix_blog.war

     

    Thanks

  5. Thanks for fast support!

     

    The next problem I have to figure: server is responding with redirected context on login.

    On the response header: "JSESSIONID=4A5A7470EC2659F3B2888C916166A146.jvm1;path=/xitix_xitix_blog;HttpOnly"

    Still have to figure on how to solve this "user_" dynamic aggregation to the context path.

     

    And I have other question: is there any option to upload some files into a Tomcat subfolder path?

    Seems I cannot go to /home/xitix/public_html, while this folder are in a different path.

     

    Thanks

  6. Dear,

     

    Still not working ! :(

     

    Now, heliohost.org is pointing all links to "~/xitix_xitix_blog/".

    My project path is relative, and starts from "../xitix_blog/", according to previous discution on post #7.

     

    I cannot setup my project to point on "relative paths like ../." because my intention is to have different services: each one is pointing to it's folder; the BOLG is the first web-app I would like to test on your site.

     

    And even if point java web-app to the "relative path ../." your server setup will automatically redirect all links to "~/xitix_..." and the web-app will fail working. The automatically redirecting to "~/xitix_..." is annoying me :wacko:

    screenshot

     

    You may check, the blog-project runs perfectly fine on other friend space, that's temporarly hosting my java web-app:

    http://blog.xitix.dynamic-dns.net:8080/xitix_blog/

    http://blog.xitix.dynamic-dns.net:8080/blog/

     

    Please advice on how to deploy my java web-app on heliohost.org,

     

     

    Thanks,

     

     

     

    P.S.

    I believe might help if update the how-to documentation related to "`/user-path_" java deployment on heliohost.org

  7. The most portable option is to not use absolute paths, but rather relative paths like ../. If you must use absolute paths the best way to do it is to determine your DOC_ROOT within your code in the same section where you definite global variables and then use the DOC_ROOT variable through the rest of your code. Using relative paths is easiest in my opinion.

     

    Your username has to be appended to the beginning of your deployed app otherwise no one else would be able to use blog.war.

    Dear,

     

    Fortunately the paths are relative.

    Ok, have refactored & changed the artifacts to help deploy on "~/xitix_blog".

     

    Please:

    1) stop and delete the old "blog"

    2) redeploy the new web-app: "xitix_blog".

     

    new WAR package is uploaded on /home/xitix/xitix_blog.war

     

    Thanks,

×
×
  • Create New...