3

I'm developing Magento projects for different merchants and I don't know if I'm working right, also have some doubts, any advice is welcome. I'll share my workflow.

  1. Initialize the project

I install a fresh magento project using composer on local and create the git repository. I just use the default gitignore. I install the magento instance with CLI, the template and some modules that are required for the project. I use submodules for install the modules that are reutilized for other merchants. I think it's a good practice, I prefer it than use composer.

  1. Deploying project on production server

When my local project is stable I deploy it on production server following these steps:

  • backup my ddbb from local
  • git clone on server
  • run composer install
  • install magento from CLI (I know, I will restore the ddbb after that, but I don't know why I have to install magento first, if I don't do it, something is broken.
  • restore ddbb

At this point I have 2 instances of Magento exactly equals, on local and on production server.

  1. Deploying categories, products, attributes, images, etc on production server

I use some software that transfers all products stuff on magento via API. I have to do that on production server, I need a public url. When finished that, I need to backup the ddbb and restore it on local for mantain the 2 instances equals. But now I have the first problem, I don't have the product images, because of gitignore. Don't know if it's good to keep working like that, without images, or just add all that stuff on git too.

  1. Customizing the website

Now is when all troubles goes up. The project is stable but need to modify some things, (sometimes an entire functionality, you know that world :D) I try to keep working always in local, commit and push, but sometimes I need an interaction from merchant that will configure on production server, or just have to try things on production server, editing some configurations... And it's a headache have to think always what instance of magento is newer, backing up and restoring from one or another instance, etc.


Conclusions

Don't know if I'm doing the best practices, just wanted to share my workflow, and receive some advices to improve. The doubt I wanted to clear is what to do with images, I don't understand why the default gitignore tracks some folders on /pub/media (I've noticed playing with wysiwyg, when you upload images it tracks on git) but the product images are ignored (not sure now where are saved) I think I'll be better having all images on local, but don't know if will enlarge so much the project.

1

You can sync all the images between local and production with Rsync (Tutorial: https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps) . Normally only the theme images are added to git and the images in pub/media are ignored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.