Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01f23d9

Browse files
Adding SCP example
1 parentb88bbb5 commit01f23d9

File tree

7 files changed

+119
-90
lines changed

7 files changed

+119
-90
lines changed

‎_data/nav.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@
209209
sub-pages:
210210
-title:Deploy to VM
211211
url:"/packer-gcloud"
212+
-title:Deploy to Tomcat using SCP
213+
url:"/deploy-to-tomcat-via-scp"
212214
-title:Deploy with Helm
213215
url:"/helm"
214216
-title:Deploy with Terraform
@@ -261,9 +263,9 @@
261263
url:"/docker-registries"
262264
pages:
263265
-title:"Codefresh Docker Registry"
264-
url:"/codefresh-registry"
266+
url:"/codefresh-registry"
265267
-title:CF Registry Deprecation
266-
url:"/cfcr-deprecation"
268+
url:"/cfcr-deprecation"
267269
-title:"Working with Docker registries"
268270
url:"/working-with-docker-registries"
269271
-title:"Image Metadata Annotations"
@@ -471,7 +473,7 @@
471473
-title:Git step migration
472474
url:"/git-step-migration"
473475
-title:Personal Git Deprecation
474-
url:"/personal-git-deprecation"
476+
url:"/personal-git-deprecation"
475477
-title:Whats new?
476478
url:"/whats-new"
477479
pages:

‎_docs/learn-by-example/java/spring-mvc-jdbc-template.md‎

Lines changed: 0 additions & 87 deletions
This file was deleted.

‎_docs/whats-new/whats-new.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Recent Codefresh updates:
2222
- Both Helm 2 and Helm 3 clusters can be used at the same time
2323
- Installing the Codefresh runner behind proxy -[documentation]({{site.baseurl}}/docs/enterprise/codefresh-runner/#installing-behind-a-proxy)
2424
- Using Vault secrets in the Pipeline -[documentation]({{site.baseurl}}/docs/yaml-examples/examples/vault-secrets-in-the-pipeline/)
25+
- Deploy to Tomcat using SCP -[documentation]({{site.baseurl}}/docs/yaml-examples/examples/deploy-to-tomcat-via-scp)
2526

2627
###February 2020
2728

‎_docs/yaml-examples/examples.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Codefresh can automatically launch environments (powered by Docker swarm) to [pr
8383
Codefresh can deploy to any platform such as VMs, FTP/SSH/S3 sites, app servers but of course it has great support for[Kubernetes clusters]({{site.baseurl}}/docs/deploy-to-kubernetes/deployment-options-to-kubernetes/) and[Helm releases]({{site.baseurl}}/docs/new-helm/helm-releases-management/):
8484

8585
-[Deploy to a VM with packer]({{site.baseurl}}/docs/yaml-examples/examples/packer-gcloud/)
86+
-[Deploy to Tomcat using SCP]({{site.baseurl}}/docs/yaml-examples/examples/deploy-to-tomcat-via-scp)
8687
-[Deploy Demochat to a Kubernetes cluster]({{site.baseurl}}/docs/deploy-to-kubernetes/codefresh-kubernetes-integration-demochat-example/)
8788
-[Use kubectl as part of Freestyle step]({{site.baseurl}}/docs/yaml-examples/examples/use-kubectl-as-part-of-freestyle-step)
8889
-[Deploy with Helm]({{site.baseurl}}/docs/yaml-examples/examples/helm)
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title:"Deploy to a VM via SCP"
3+
description:"Deploying your application to Tomcat using SCP"
4+
group:yaml-examples
5+
sub_group:examples
6+
toc:true
7+
---
8+
9+
##Prerequisites
10+
11+
- A[free Codefresh account](https://codefresh.io/docs/docs/getting-started/create-a-codefresh-account/)
12+
- A distribution of[Tomcat](https://tomcat.apache.org/download-90.cgi) setup on a remote server (running with port 8080 exposed)
13+
14+
##The Example Java Application
15+
16+
You can find the example project on[Github](https://github.com/codefresh-contrib/sparkjava-war-example).
17+
18+
The example application is a simple Hello World Java application using the[Spark Java framework](http://sparkjava.com/):
19+
20+
{% include image.html
21+
lightbox="true"
22+
file="/images/examples/deployments/scp-hello-world.png"
23+
url="/images/examples/deployments/scp-hello-world.png"
24+
alt="Hello World!"
25+
caption="Hello World!"
26+
max-width="100%"
27+
%}
28+
29+
30+
```java
31+
@Override
32+
publicvoid init() {
33+
get("/hello", (req, res)->"Hello World");
34+
}
35+
```
36+
37+
##Create the Pipeline
38+
39+
Our pipeline will have three stages: clone, package, and transfer.
40+
41+
{% include image.html
42+
lightbox="true"
43+
file="/images/examples/deployments/scp-pipeline.png"
44+
url="/images/examples/deployments/scp-pipeline.png"
45+
alt="SCP pipeline"
46+
caption="Codefresh UI Pipeline View"
47+
max-width="100%"
48+
%}
49+
50+
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.
51+
52+
Note that you need to change the environment variables under the`transfer` step to your respective values.
53+
54+
`codefresh.yml`
55+
```yaml
56+
# More examples of Codefresh YAML can be found at
57+
# https://codefresh.io/docs/docs/yaml-examples/examples/
58+
59+
version:"1.0"
60+
# Stages can help you organize your steps in stages
61+
stages:
62+
-"clone"
63+
-"package"
64+
-"transfer"
65+
66+
steps:
67+
clone:
68+
title:"Cloning repository..."
69+
type:"git-clone"
70+
stage:"clone"
71+
arguments:
72+
repo:"codefresh-contrib/sparkjava-war-example"
73+
74+
package:
75+
title:"Packaging war..."
76+
type:"freestyle"
77+
stage:"package"
78+
arguments:
79+
image:"maven:3.5.2-jdk-8-alpine"
80+
working_directory:"${{clone}}"
81+
commands:
82+
-"mvn -Dmaven.repo.local=/codefresh/volume/m2_repository clean package"
83+
84+
transfer:
85+
title:"Transferring war to Tomcat..."
86+
type:"freestyle"
87+
stage:"transfer"
88+
arguments:
89+
image:"ictu/sshpass:latest"
90+
working_directory:"${{package}}/target"
91+
environment:
92+
-USER=<USER>
93+
-HOST=<HOST.IP.ADDRESS>
94+
-PASSWORD=<PASSWORD>
95+
-TOMCAT_DIR=<path/to/tomcat/webapps>
96+
commands:
97+
-"echo | ssh-keygen -P '' -t rsa"
98+
-"sshpass -p $PASSWORD ssh-copy-id -i /root/.ssh/id_rsa.pub -o StrictHostKeyChecking=no $USER@$HOST"
99+
-"scp sparkjava-hello-world-1.0.war $USER@$HOST:$TOMCAT_DIR"
100+
```
101+
102+
The above pipeline does the following:
103+
104+
1. A [git-clone]({{$site.baseurl}}/docs/codefresh-yaml/steps/git-clone/) step that clones the main repository
105+
2. A [freestyle step]($$site.baseurl}}/docs/codefresh-yaml/steps/freestyle/) that installs the dependencies via Maven and packages our war file
106+
3. A freestyle step that transfers our application via scp to a Tomcat server
107+
108+
## What to Read Next
109+
110+
- [Git-clone Step]({{site.baseurl}}/docs/codefresh-yaml/steps/git-clone/)
111+
- [Freestyle Step]({{site.baseurl}}/docs/codefresh-yaml/steps/freestyle/)
112+
- [Deploying to a VM using FTP]({{site.baseurl}}/docs/yaml-examples/examples/transferring-php-ftp/)
9.58 KB
Loading
23.6 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp