- Notifications
You must be signed in to change notification settings - Fork165
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
2c7be74 Adding ftp/scp example
anna-codefreshacf2864 Simplifying example
anna-codefresh73da8a8 Modifying FTP example
anna-codefresh43f80ed Adding screenshot
anna-codefreshc6515d7 Merge branch 'master' of https://github.com/codefresh-io/docs.codefre…
anna-codefresh832189b Adding redirect
anna-codefresha26f217 Merge branch 'master' into ftp-scp-examples
anna-codefreshFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff 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/) | ||
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.