Deployment - yajatyadav/intellijs GitHub Wiki
We will use AWS to deploy.
To Update Deployed Website With Newly Pushed Changes:
Stop service file: sudo systemctl stop intellijs
Stop main project: sudo stop /home/ubuntu/intellijs/target/serving-web-content-0.0.1-SNAPSHOT.jar
Pull changes: sudo git pull
Start project again: sudo mvn package
Start project: sudo java -jar /home/ubuntu/intellijs/target/serving-web-content-0.0.1-SNAPSHOT.jar
Restart service file: sudo systemctl start intellijs
AWS Setup
Java setup, Maven build and Runtime Test
Java is two pieces (JDK and JRE), both parts are needed in order to run and build
$ sudo apt update
$ sudo apt upgrade
Install Java Runtime Environment
$ sudo apt install default-jre
$ java -version
Install Java Development Kit
$ sudo apt install default-jdk
$ javac -version
Maven is required to build project
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install maven
$ mvn -version
Clone, build and test Web Application
Clone and build repository
$ cd
$ git clone https://github.com/nighthawkcoders/nighthawk_csa.git
$ cd nighthawk_csa
$ ./mvnw package
Run your java project, after test ctl-C to stop service
$ cd
$ java -jar nighthawk_csa/target/csa-0.0.1-SNAPSHOT.jar
Test on localhost browser
localhost:8080
Establish a service to enable Java Web Application to always run on Server
To run and start application automatically it will require a the JAR file from previous step to run from a .service file. In this service file we are providing details of the java runtime service: * start after “network.target” has been started * the ExecStart is the same as command you validated to executes JARCreate a 'service' file as administratr:
- sudo nano
- change nighthawk_csa reference or jar file name as applicable to your project
- replace User=pi with User=ubuntu if applicable
File is located at /etc/systemd/system/nighthawk_csa.service.
[Unit]
Description=Java
After=network.target
[Service]
User=ubuntu
Restart=always
ExecStart=java -jar /home/ubuntu/nighthawk_csa/target/csa-0.0.1-SNAPSHOT.jar
[Install]
WantedBy=multi-user.target
Run and enable your service file
$ sudo systemctl start nighthawk_csa
$ systemctl status nightawk_csa
If succesfull, enable your service file to be persistant on machine
$ sudo systemctl enable nighthawk_csa
sudo apt-get update
sudo apt-get install apache2 php5 libapache2-mod-php5
now you should allow overrides by editing the 000-default file, you can do that using the following comands..
sudo nano /etc/apache2/sites-enabled/000-default
now edit the following lines
change "AllowOverride None" -to "AllowOverride ALL".
now execute
sudo service apache2 restart
to restart apache witht your new settings
now your site should be up and running u can go to /var/ and change the permissions on www, making it writable.
cd /var/
sudo chmod 777 /www
This will enable you to login using WINSCP and upload HTML pages to your new site. open the browser on your PC and point to 192.168.xx.xx (ip address of you raspberry pi) to view the default page.
You can also install and SQL server using the following comands, with a PHP and SQL running on your server u can have a CMs like Drupal running on it.
sudo apt-get install mysql-server mysql-client php5-mysql
Enable Nginx to retrieve Java Web Application on external request (Reverse Proxy)
File is located at /etc/nginx/sites-available/nighthawk_csa
server {
listen 80;
server_name csa.nighthawkcoders.cf;
location / {
proxy_pass http://localhost:8080;
}
}
Test the configuration to make sure there are no errors:
$ sudo ln -s /etc/nginx/sites-available/nighthawk_csa /etc/nginx/sites-enabled
$ sudo nginx -t
If there are no errors, restart NGINX so the changes take effect:
$ sudo systemctl restart nginx
Goto freenom.com and register your public IP Address to a Domain
- Domain and Public IP Address match your nginx configuration files
+ REPLACE freenom config with your-domain and your-public-ip, make one or more a records for each project

Port forward your public IP address access to your Nginx/RPi server
- Your Public IP Address needs to connect to your host on Private IP network through Port Forwarding
+ PROCESS will vary on every home network, but basic premis is to Port forward external port 80 to your Private Host (aka RPi) on internal port 80
This illustration shows configuration of HTTP, as well as some other common service to access a Private IP host computer through port forwarding. It is always recommended to minimize access points from internet to your home network.
