How to manage Cafe24 shopping mall code with Git and FTP
Introduction
Operating a shopping mall on Cafe24 in a company with a shortage of development resources is a really good way in terms of productivity. Although it is sometimes difficult to operate like an independent shopping mall, you can start quickly and without any shortage at minimal cost. However, from the developer's perspective, I always felt uneasy whenever I modified the code on Cafe24. In general development, if there is a problem with the code you modified, you can easily revert it and continue development. However, since Cafe24 uploads files directly to FTP, managing the source with Git is not as easy as you might think. I have included content to overcome this with FTP and Git.
How did I solve it
Two methods of FTP
There are two main methods in FTP. The first is to directly access the server and change the code. The second is to edit the code on your local machine and synchronize it with the server. It is difficult to manage the source with Git when using the first method. However, in the second synchronization method, you can easily manage the code on your local machine with Git. For easy use, in Visual Studio Code, there is an SFTP plugin, and in IntelliJ Ultimate, you can use the FTP feature that is installed by default. In this article, I will explain based on IntelliJ.
Work
-
First, you need to apply for permission to use FTP for Cafe24 shopping mall. You can apply and receive connection information on the Cafe24 administrator page at [Design] -> [Design FTP].
-
Go to Tools -> Deployment -> Configuration in IntelliJ to connect via FTP and enter the connection information.
-
Click the + button in the upper left corner and select SFTP.
-
Specify the server nickname.
-
Click the ... button on the right side of SSH Configuration.
-
Enter the FTP connection information received from Cafe24.
-
Click on the Mappings tab and enter / in the Deployment path. Files from FTP will be downloaded and synchronized in this path.
-
Now, click Test Connection in the connection tab. If the connection is successful, a success message will appear as shown below.
-
The first thing to do is to download the shopping mall code from Cafe24. Click on [Tools] -> Deployment -> Download from [server nickname].
-
Now you can see the downloaded code.
-
Next, set up the automatic synchronization feature so that when a file is modified locally, it is automatically uploaded to the server. Click on [Tools] -> [Deployment] -> [Automatic Upload] to activate this option.
Others
By setting it up like this, you should be able to manage the code with Git. If someone accidentally modifies the code and a problem occurs, you can easily revert the code with Git and press save to easily restore the service.
