How to deploy Spring boot war file to Amazon Lightsail - spring

I am building a simple Spring Boot application that I want to deploy on a server.
I've set up a Amazon LightSail Linux and installed tomcat8 and mysql-server.
I already know how to get a war file from my project. The question is how to upload it to the server?
I know there are Amazon tools for deploying code to EC2 instances but I have an Lightsail instance so I can't find value key pairs to couple my server with AWS codedeploy.
Can this be done by using SSH or FTP?
Lightsail is supposed to offer a simple management console but I can't seem to find how to deploy an application to it.

If I were you, I'd do a git clone from BB or your github or SCM host of choice and package up a war from the command line from your lightsail instance and just load it from there.

This is what I did,
Download and install FileZilla
Download the default key from Lightsail Note: - Looks like, this action uses AWS KMS in the background and charges might be incurred.
Connect using (SFTP) using the public IP (LightSail) and username(Ubuntu) - No password required.
Upload war or jar files to a directory under your LightSail instance.
Use LightSail web SSH and start the jar
I don't suggest cloning the repository to LightSail and build war from there, as it would use up more disk space for downloading maven dependencies.
Other option could be, to upload artifacts (war/jar) to S3 and download to LightSail.

I found out about tomcat manager gui, first I needed to install tomcat8-admin-webapps and tomcat8-docs-webapps, then I can access the Tomcat Web Application Manager where I can upload a War file.

Related

How to publish my .net core code and deploy in AWS Windows Instance with gitlab yml file

My code .net core added in GitLab and my web application deploys in AWS windows instance IIS.
How to write yml file to automatically publish and deploy my code in IIS.
If possible please share whatever you have tried so far, I am just sharing high level steps here.
First prepare the .gitlab-ci.yml file then add following lines
script:
- bash .gitlab-deploy-dev.sh
Inside .gitlab-deploy-dev.sh you should add
ssh ec2-use#server 'git pull origin dev && aws s3://bucket/dev-config.json .............. '
Then run the pipeline

Minishift - How to edit files of a project deployed from bitbucket repository

I have setup Minishift on my computer and installed a custom laravel from a github repo on minishift using the web console.
How do I access the downloaded files locally and test my application?
I solved the issue using cwRsync client. As per the official documentation given below:
https://docs.okd.io/latest/dev_guide/copy_files_to_container.html

Deploy hippo cms in heroku

In Hippo, There are two web applications packaged as war files inside a directory called webapps, a number of libraries in a directory called shared/lib, another set in a directory called common/lib, and some configuration files such as a log4j descriptor and a Tomcat context descriptor in the conf directory.
But in Heroku, I can not find the directory of tomcat to deploy these directory like the structure of Hippo (shared/lib, common/lib, conf)
Thank you
Hippo requires access to the entire Tomcat instance for setup at least. I've read through the Heroku documentation (most of it just skimmed), but I can't see that they provide that access.
However, there is possibly a second option which you may be willing to try; build Hippo in a docker image, and deploy that into Heroku:
Creating a docker container for hippo
Deploying docker container to Heroku
I haven't tried or tested any of this, so I can't guarantee it's success. But if you're limited to using Heroku, then it's at least worth a try.
Also, if you manage to get it running using docker, I would be extremely interested to know more details.

How to deploy a WAR file from s3 to AWS EC2?

I have a AWS EC2 instance running with me and there is a maven project running on tomcat7. What I have tried is I am using Jenkins for the CI.So whenever the new push happens to the Git-hub Jenkins starts to build, after completion of build it will upload the war file to the AWS S3.
Where I have stuck is, I am not getting a way to deploy the war file to the AWS Ec2 instance.
I have tried to use Code Deployment where at a point it showed me that it supports only tar, tar.gz and zip is there any way out to deploy the war file to the AWS EC2 instance from the S3.
Thank you.
You can use Amazon Code Deploy which can manage deployment from a S3 bucket and can automate deployment to EC2 instance of your file/scripts.
From the Overview of a Deployment
Here's how it works:
First, you create deployable content – such as web pages, executable
files, setup scripts, and so on – on your local development machine or
similar environment, and then you add an application specification
file (AppSpec file). The AppSpec file is unique to AWS CodeDeploy; it
defines the deployment actions you want AWS CodeDeploy to execute. You
bundle your deployable content and the AppSpec file into an archive
file, and then upload it to an Amazon S3 bucket or a GitHub
repository. This archive file is called an application revision (or
simply a revision).
Next, you provide AWS CodeDeploy with
information about your deployment, such as which Amazon S3 bucket or
GitHub repository to pull the revision from and which set of instances
to deploy its contents to. AWS CodeDeploy calls a set of instances a
deployment group. A deployment group contains individually tagged
instances, Amazon EC2 instances in Auto Scaling groups, or both.
Each time you successfully upload a new application revision that you
want to deploy to the deployment group, that bundle is set as the
target revision for the deployment group. In other words, the
application revision that is currently targeted for deployment is the
target revision. This is also the revision that will be pulled for
automatic deployments.
Next, the AWS CodeDeploy agent on each
instance polls AWS CodeDeploy to determine what and when to pull the
revision from the specified Amazon S3 bucket or GitHub repository.
Finally, the AWS CodeDeploy agent on each instance pulls the target
revision from the specified Amazon S3 bucket or GitHub repository and,
using the instructions in the AppSpec file, deploys the contents to
the instance.
AWS CodeDeploy keeps a record of your deployments so
that you can get information such as deployment status, deployment
configuration parameters, instance health, and so on.
Good part is that code deploy has no additional cost, you only pay for the resources (EC2, S3) that are used in your pipeline
Assuming you have already created a S3 bucket.
Step 1: Create a IAM user / Role who have access to a s3 bucket where in you are placing the WAR file
Step 2: Write a custom script which will download WAR File from S3 to your EC2 instance.
You can also use aws cli to download contents from s3 to your local machine.
Create a startup.sh file and add these contents
aws s3 cp s3://com.yoursitename/warFile/sample.war /tmp
sudo mv /tmp/sample.war /var/lib/tomcat/webapps/ROOT.war
sudo service tomcat restart

Deployment in Amazon VPC with custom gems hosted inside company's network

I have a very interesting problem. Following is my current workflow of deployment in Amazon EC2 in classic mode.
Deploy host inside my Company's network.
Deploy Target is EC2 machine in AWS.
Have custom ruby gems inside the company's git account (Hence cannot install gems from outside my companies network).
To overcome the problem mentioned in Point #3. I have used reverse tunnelling between the deploy host and deploy target.
I am using capistrano for deployment.
Now the problem arises when we decided to move from Amazon Classic to Amazon VPC with deploy target having only private ip address. Here is the workflow I thought of for deploying code in VPC instances.
Create a deploy host in Amazon VPC and attach public dns to it so that I can access it from my main deploy host (which is inside my company's network.)
Deploy the code by running the deployment scripts from AWS deploy host.
The problem is that I am not able to find a way to install gems which are hosted inside the git account of my company. Can you guys help me with this problem?
Prior to deployment, you can just setup git mirrors of your production repositories by just pushing to git bare repositories in your AWS deploy host.
Then that AWS deploy host also has access to your VPC so you can do the deployment from there.
Hope it helps.
Download the gems first and then pass it to the ec2 instance in vpc using scp
scp -r -i key ubuntu#ip-address:/ruby-app
Then run gem install gem-name from the folder, it will install gem from within the folder matching with the name.
Run bundle package, this will download all the gems and will be present in vendor/cache folder. Now move this files to the ec2 instance.

Resources