Top Menu

Jump to content
Home
    • Projects
    • Work packages
    • News
    • Getting started
    • Introduction video
      Welcome to OpenProject
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?
      Create a new account

Side Menu

  • Overview
  • Roadmap
  • Work packages
  • News
  • Wiki
    • Table of contents
      • Hierarchy leafAI Tools for Development
      • Hierarchy leafDeployment To the Server(Modified)
      • Hierarchy leafHosting BTCPayServer in Linux server
      • Hierarchy leafHow to overcome bitbucket login problem (Windows)
      • Expanded. Click to collapseCollapsed. Click to showInstalling a project in Elintegro
        • Hierarchy leafPipeline setUp for Bitbucket
      • Expanded. Click to collapseCollapsed. Click to showInterview University
        • Expanded. Click to collapseCollapsed. Click to showDocker: Install an Elintegro App within Linux server
          • Hierarchy leafConnect to Docker of Omnipay
      • Expanded. Click to collapseCollapsed. Click to showKafka Installation Guide
        • Expanded. Click to collapseCollapsed. Click to showComparing Kafka with other topic technologies
          • Hierarchy leafDesign a messaging app, high level, using kafka
      • Hierarchy leafOpen Project
      • Hierarchy leafRebase with Development Branch
      • Hierarchy leafRemote Debugger with IntelliJ
      • Hierarchy leafTelegram API
      • Hierarchy leafUpgrading Elintegro apps to Grails 6
You are here:
  • Deployment To the Server(Modified)

Content

Deployment To the Server(Modified)

  • More
    • Table of contents
  1. Enter the server using ssh [email protected] in any terminal.

  2. Make a directory for the application (EG. elintegro-prod, omnipaycoinatm-dev) as shown in the figure.

3)In the local make a directory as elintegro-website and add Dockerfile first and later we will add ROOT.war as shown below : 

4)For Docker file, it should be as shown in the figure:

Reference: FROM tomcat:8.5.56-jdk8-openjdk

MAINTAINER Rajesh Jacko

ADD ROOT.war /usr/local/tomcat/webapps/

EXPOSE 8080

EXPOSE 587

CMD ["catalina.sh","run"]

  1. For ROOT.WAR , go to the application and create the war file as requirement using the command Ctrl + Alt + G, then choose the command for which envirnment we are going to deploy(dont choose dataframe on the application, please choose elintegrostartapp):

For prod : -Dgrails.env=prod war

For develop : -Dgrails.env=develop war

For qa: -Dgrails.env=qa war

After build is successful, the war file will be on the directory build/libs as shown in the figure.

  1. Copy the marked file and go the directory where we have the Dockerfiles and rename it as ROOT.war.

  2. Now we have to move these two files i.e Dockerfiles and ROOT.war in the server. For this ,we can use the WINSCP application to move the local files to the server which look like this :

Then enter the server credential and locate to the directory you made in the server . And move our Dockerfile and ROOT.war by just drag and drop then you will see those file in the server as shown in the figure:

  1. After we move those two files, we need to setup the database in the server using docker:

i) First enter the server using ssh and install the mysql 5.7 using the command :

docker pull mysql:5.7

ii) Then we need to create the mysql container using the command:

docker run --name=elintegroweb-mysql -d -p 3316:3306 --env="MYSQL_ROOT_PASSWORD=root1234" mysql:5.7 {Here we are using the port 3316 and we need to open that port in HETZNER, 3306 is default}, To add the port in HETZNER you need to go to cloud as shown in the figure : 

and select Elintegro.com which will look like this:

After clicking the elintegro.com, Click the firewall as shown in the figure :

And click the firewall and add the rules , put the port and save the changes like below :

(While running this command : docker run --name=elintegroweb-mysql -d -p 3316:3306 --env="MYSQL_ROOT_PASSWORD=root1234" mysql:5.7

 give the name which is readable according to your application. Here i am trying to deploy my app for elintegro website so i put the mysql container name as elintegroweb and you can put any password in replace of  root1234). So, this will create the mysql container and you can check either you container is made or not using the command : 

docker ps -a

so you can check if your mysql container is made or not.

iii) After you container is made , enter the container using command : 

docker exec -it elintegroweb-mysql bash 

Connect to the mysql:

mysql -u root -p

Then enter the password you created while making container (root1234)

You successfully entered into mysql server.

Any databse command can be in this shell

show databases;

create database<database_name>;

We need to  create the database name according to our war files, so if you create the war file for prod, then you need to create the same database name: 'elintegro_db_prod as in the application.groovy db config for production as :

So, after creating the database , we need to create the new user as in the figure : username as 'elintegroweb' and password as 'elintegroweb2024'. To do this Follow the command below :

create user 'elintegroweb'@'%'  identified by 'elintegroweb2024';

Note: If you need to connect your created user (elintegroweb) from any client, you should create the user with “%” which signifies, you can connect this user from any host.

Granting access to the user:

grant all privileges on *.* to <username>;

flush privileges;

Now you have finish the setup for the database and exit from the mysql sever using exit;

Then go the directory of the application name that contain docker file and ROOT.war as : cd elintegro-prod Then enter the command :

chmod 555 Dockerfile

chmod 555 ROOT.war

Build and deploy our website.

To build our website: make sure you are in the directory which contain your war file and Dockerfile, and type:

docker build -t <any name>

for example:

docker build -t elintegro-prod

After building successfully, check the image you just built with the command:

docker images

Then we should run that image with this command:

docker run -publish <any port>:8080 --detach --name <container-name(you can give any name here)> <image-name>

for example:

docker run --publish 9090:8080 --detach --name prod-elintegro elintegro-prod

The application is running with the docker container (prod-elintegro).

[Note :  You need to  add the port 9090  in the hetzner in order to run it. We can add the port as we add the mysql port above.]

After that you can check the logs wether your application is deployed or not. To check that use the command : 

docker logs -f <your-container-name>

And it will look like this as we see in the local when we run the application :

So, In case during the deployment if you encounter this error as shown in the figure :

Error :Caused by: java.sql.SQLException: Incorrect string value: '\\xD1\\x80\\xD1\\x83\\xD1\\x81...' for column 'name' at row 1  
  1. Go to the mysql container that we made as : docker exec -it elintegroweb-mysql bash

  2. Enter user name and password after hitting the command : mysql -u elintegroweb  -p

3)Enter the password and select the database we create and hit the command :

ALTER TABLE language CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

4)Then exit;

Now, Check your application in any browser. For that :

  • Go to any browser (Chrome , Edge , Mozilla ….)
  • Then enter the url :
    • <your-ip>:<port>
    • i.e 5.161.243.247:9090

Now for the installation of nginx and certbox you can follow the previous documentation.

Loading...