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

Adding ftp/scp example#161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
anna-codefresh merged 7 commits intomasterfromftp-scp-examples
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions_data/nav.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -209,6 +209,8 @@
sub-pages:
- title: Deploy to VM
url: "/packer-gcloud"
- title: Deploy to a VM using ftp
url: "/transferring-php-ftp"
- title: Deploy to Tomcat using SCP
url: "/deploy-to-tomcat-via-scp"
- title: Deploy with Helm
Expand Down
1 change: 1 addition & 0 deletions_docs/whats-new/whats-new.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,6 +22,7 @@ Recent Codefresh updates:
- Both Helm 2 and Helm 3 clusters can be used at the same time
- Installing the Codefresh runner behind proxy - [documentation]({{site.baseurl}}/docs/enterprise/codefresh-runner/#installing-behind-a-proxy)
- Using Vault secrets in the Pipeline - [documentation]({{site.baseurl}}/docs/yaml-examples/examples/vault-secrets-in-the-pipeline/)
- Deploy to a VM using FTP - [documentation]({{site.baseurl}}/docs/yaml-examples/examples/transferring-php-ftp)
- Deploy to Tomcat using SCP - [documentation]({{site.baseurl}}/docs/yaml-examples/examples/deploy-to-tomcat-via-scp)

### February 2020
Expand Down
1 change: 1 addition & 0 deletions_docs/yaml-examples/examples.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,6 +83,7 @@ Codefresh can automatically launch environments (powered by Docker swarm) to [pr
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/):

- [Deploy to a VM with packer]({{site.baseurl}}/docs/yaml-examples/examples/packer-gcloud/)
- [Deploy to a VM with FTP]({{site.baseurl}}/docs/yaml-examples/examples/transferring-php-ftp)
- [Deploy to Tomcat using SCP]({{site.baseurl}}/docs/yaml-examples/examples/deploy-to-tomcat-via-scp)
- [Deploy Demochat to a Kubernetes cluster]({{site.baseurl}}/docs/deploy-to-kubernetes/codefresh-kubernetes-integration-demochat-example/)
- [Use kubectl as part of Freestyle step]({{site.baseurl}}/docs/yaml-examples/examples/use-kubectl-as-part-of-freestyle-step)
Expand Down
114 changes: 114 additions & 0 deletions_docs/yaml-examples/examples/transferring-php-ftp.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
---
title: "Transferring Applications via FTP"
description: "Deploying a Php Application to a VM using FTP"
group: yaml-examples
sub_group: examples
toc: true
redirect_from:
- /docs//learn-by-example/java/spring-mvc-jdbc-template/
---

## Prerequisites

- A [free Codefresh account](https://codefresh.io/docs/docs/getting-started/create-a-codefresh-account/)
- 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)

>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.

## The Example Php Project

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.

{% include image.html
lightbox="true"
file="/images/learn-by-example/php/test-environment.png"
url="/images/learn-by-example/php/test-environment.png"
alt="Example Php Application"
caption="Example Php Application"
max-width="90%"
%}

## Create the Pipeline

Our pipeline will contain four stages:

- A stage for cloning
- A stage for packaging
- A stage for transferring files

{% include image.html
lightbox="true"
file="/images/examples/php-file-transfer/pipeline.png"
url="/images/examples/php-file-transfer/pipeline.png"
alt="Codefresh UI Pipeline View"
caption="Codefresh UI Pipeline View"
max-width="90%"
%}

Here is the entire pipeline:

```yaml
# More examples of Codefresh YAML can be found at
# https://codefresh.io/docs/docs/yaml-examples/examples/

version: "1.0"
# Stages can help you organize your steps in stages
stages:
- "clone"
- "install"
- "transfer"
steps:
clone:
title: "Cloning main repository..."
type: "git-clone"
arguments:
repo: "codefresh-contrib/ftp-php-app"
git: "github"
stage: "clone"
install_dependencies:
title: "Collecting Php dependencies..."
type: "freestyle"
working_directory: "./ftp-php-app"
arguments:
image: "composer:1.9.3"
commands:
- "composer install --ignore-platform-reqs --no-interaction --no-plugins --no-scripts --prefer-dist"
stage: "install"
steps:
ftp_transfer:
title: "Transferring application to VM via ftp..."
type: "freestyle"
working_directory: "./ftp-php-app"
arguments:
image: "dockito/lftp-client:latest"
environment:
- USER=<USER>
- PASSWORD=<PASSWORD>
- HOST=<HOST>
- PUB_FTP_DIR=<PATH/TO/DIR>
commands:
- 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
stage: "transfer"
```
This pipeline does the following:

1. A [git-clone]({{$site.baseurl}}/docs/codefresh-yaml/steps/git-clone/) step that clones the main repository
2. A [freestyle step]($$site.baseurl}}/docs/codefresh-yaml/steps/freestyle/) that installs the necessary Php dependencies for our application
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:

{% include image.html
lightbox="true"
file="/images/examples/php-file-transfer/variables.png"
url="/images/examples/php-file-transfer/variables.png"
alt="Codefresh Enbironment Variables"
caption="Codefresh Enbironment Variables"
max-width="90%"
%}

## What to Read Next

- [Codefresh YAML]({{site.baseurl}}/docs/codefresh-yaml/what-is-the-codefresh-yaml/)
- [Git-clone Step]({{$site.baseurl}}/docs/codefresh-yaml/steps/git-clone/)
- [Freestyle Step]($$site.baseurl}}/docs/codefresh-yaml/steps/freestyle/)


View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

[8]ページ先頭

©2009-2025 Movatter.jp