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

Commit8220af6

Browse files
Merge pull requestcodefresh-io#161 from codefresh-io/ftp-scp-examples
Adding ftp/scp example
2 parents8ebfc8c +a26f217 commit8220af6

File tree

6 files changed

+118
-0
lines changed

6 files changed

+118
-0
lines changed

‎_data/nav.yml‎

Lines changed: 2 additions & 0 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 a VM using ftp
213+
url:"/transferring-php-ftp"
212214
-title:Deploy to Tomcat using SCP
213215
url:"/deploy-to-tomcat-via-scp"
214216
-title:Deploy with Helm

‎_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 a VM using FTP -[documentation]({{site.baseurl}}/docs/yaml-examples/examples/transferring-php-ftp)
2526
- Deploy to Tomcat using SCP -[documentation]({{site.baseurl}}/docs/yaml-examples/examples/deploy-to-tomcat-via-scp)
2627

2728
###February 2020

‎_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 a VM with FTP]({{site.baseurl}}/docs/yaml-examples/examples/transferring-php-ftp)
8687
-[Deploy to Tomcat using SCP]({{site.baseurl}}/docs/yaml-examples/examples/deploy-to-tomcat-via-scp)
8788
-[Deploy Demochat to a Kubernetes cluster]({{site.baseurl}}/docs/deploy-to-kubernetes/codefresh-kubernetes-integration-demochat-example/)
8889
-[Use kubectl as part of Freestyle step]({{site.baseurl}}/docs/yaml-examples/examples/use-kubectl-as-part-of-freestyle-step)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title:"Transferring Applications via FTP"
3+
description:"Deploying a Php Application to a VM using FTP"
4+
group:yaml-examples
5+
sub_group:examples
6+
toc:true
7+
redirect_from:
8+
-/docs//learn-by-example/java/spring-mvc-jdbc-template/
9+
---
10+
11+
##Prerequisites
12+
13+
- A[free Codefresh account](https://codefresh.io/docs/docs/getting-started/create-a-codefresh-account/)
14+
- A remote machine with an ftp server and ssh setup (ensure that your ftp directory, I.e.,`/srv/ftp/pub` has the proper write permissions for the ftp user)
15+
16+
>Note that as you may already know, FTP is extremely insecure as it relies on plain-text passwords and usernames, making data very vulnerable to sniffing. A more secure solution would be to use SFTP or SCP.
17+
18+
##The Example Php Project
19+
20+
The example project can be found on[Github](hhttps://github.com/codefresh-contrib/ftp-php-app). The application is a simple Php application that displays an example timer.
21+
22+
{% include image.html
23+
lightbox="true"
24+
file="/images/learn-by-example/php/test-environment.png"
25+
url="/images/learn-by-example/php/test-environment.png"
26+
alt="Example Php Application"
27+
caption="Example Php Application"
28+
max-width="90%"
29+
%}
30+
31+
##Create the Pipeline
32+
33+
Our pipeline will contain four stages:
34+
35+
- A stage for cloning
36+
- A stage for packaging
37+
- A stage for transferring files
38+
39+
{% include image.html
40+
lightbox="true"
41+
file="/images/examples/php-file-transfer/pipeline.png"
42+
url="/images/examples/php-file-transfer/pipeline.png"
43+
alt="Codefresh UI Pipeline View"
44+
caption="Codefresh UI Pipeline View"
45+
max-width="90%"
46+
%}
47+
48+
Here is the entire pipeline:
49+
50+
```yaml
51+
# More examples of Codefresh YAML can be found at
52+
# https://codefresh.io/docs/docs/yaml-examples/examples/
53+
54+
version:"1.0"
55+
# Stages can help you organize your steps in stages
56+
stages:
57+
-"clone"
58+
-"install"
59+
-"transfer"
60+
steps:
61+
clone:
62+
title:"Cloning main repository..."
63+
type:"git-clone"
64+
arguments:
65+
repo:"codefresh-contrib/ftp-php-app"
66+
git:"github"
67+
stage:"clone"
68+
install_dependencies:
69+
title:"Collecting Php dependencies..."
70+
type:"freestyle"
71+
working_directory:"./ftp-php-app"
72+
arguments:
73+
image:"composer:1.9.3"
74+
commands:
75+
-"composer install --ignore-platform-reqs --no-interaction --no-plugins --no-scripts --prefer-dist"
76+
stage:"install"
77+
steps:
78+
ftp_transfer:
79+
title:"Transferring application to VM via ftp..."
80+
type:"freestyle"
81+
working_directory:"./ftp-php-app"
82+
arguments:
83+
image:"dockito/lftp-client:latest"
84+
environment:
85+
-USER=<USER>
86+
-PASSWORD=<PASSWORD>
87+
-HOST=<HOST>
88+
-PUB_FTP_DIR=<PATH/TO/DIR>
89+
commands:
90+
-lftp -e "set ftp:use-site-utime2 false; mirror -x ^\.git/$ -X flat-logo.png -p -R ftp-php-ap $PUB_FTP_DIR/ftp-php-app; exit" -u $USER,$PASSWORD $HOST
91+
stage:"transfer"
92+
```
93+
This pipeline does the following:
94+
95+
1. A [git-clone]({{$site.baseurl}}/docs/codefresh-yaml/steps/git-clone/) step that clones the main repository
96+
2. A [freestyle step]($$site.baseurl}}/docs/codefresh-yaml/steps/freestyle/) that installs the necessary Php dependencies for our application
97+
3. A freestyle step that transfers our application via ftp. Note that you will need to change the environment variables to your respective values, either in the YAML itself (above), or through the pipeline settings:
98+
99+
{% include image.html
100+
lightbox="true"
101+
file="/images/examples/php-file-transfer/variables.png"
102+
url="/images/examples/php-file-transfer/variables.png"
103+
alt="Codefresh Enbironment Variables"
104+
caption="Codefresh Enbironment Variables"
105+
max-width="90%"
106+
%}
107+
108+
## What to Read Next
109+
110+
- [Codefresh YAML]({{site.baseurl}}/docs/codefresh-yaml/what-is-the-codefresh-yaml/)
111+
- [Git-clone Step]({{$site.baseurl}}/docs/codefresh-yaml/steps/git-clone/)
112+
- [Freestyle Step]($$site.baseurl}}/docs/codefresh-yaml/steps/freestyle/)
113+
114+
24.2 KB
Loading
21.1 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp