Deploy to VM via FTP
Deploying a PHP application to a VM using FTP
Prerequisites
- A [Codefresh account]- 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
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.
Example PHP project
The example project can be found on GitHub. The application is a simple PHP application that displays an example timer.
Create the pipeline
Our pipeline includes four stages:
- A stage for cloning
- A stage for packaging
- A stage for transferring files
Here is the entire pipeline:
codefresh.yml
This pipeline does the following:
- Clones the main repository through a Git-clone step.
- Installs the necessary PHP dependencies for our application through a freestyle step.
- Transfers our application via FTP through another freestyle step. 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:
Related articles
CD pipeline examples
Codefresh YAML for pipeline definitions
Creating pipelines
How Codefresh pipelines work