Deploy to a VM via SCP
Deploy your application to Tomcat using SCP
Prerequisites
- A Codefresh account
- A distribution of Tomcat setup on a remote server (running with port 8080 exposed)
The example Java Application
You can find the example project on GitHub.
The example application is a simple Hello World Java application using the Spark Java framework:
@Override
public void init() {
get("/hello", (req, res) -> "Hello World");
}
Create the pipeline
Our pipeline has three stages: clone, package, and transfer.
You should be able to copy and paste this YAML in the in-line editor of the Codefresh UI. It will automatically clone the project for you.
Note that you need to change the environment variables under the transfer
step to your respective values.
codefresh.yml
The above pipeline does the following:
- Clones the main repository through the git-clone step.
- Installs the dependencies via Maven and packages our
war
file through a freestyle step. - Transfers our application via scp to a Tomcat server through another freestyle step.
Note that you will need to change the listed environment variables accordingly, either through the YAML itself, or through your pipeline settings: