Local Development with Craft Nitro

Migrating an Existing Project to Craft Nitro

Migrating an existing project to Nitro is probably going to be the most common scenario you run into, assuming you move all of your projects over instead of just using Nitro for new projects.

Migrat­ing an exist­ing project to Nitro is prob­a­bly going to be the most com­mon sce­nario you run into, assum­ing you move all of your projects over instead of just using Nitro for new projects. Where pos­si­ble, I would rec­om­mend mov­ing all active­ly devel­oped projects over so you don’t have to jump between devel­op­ment environments.

The site we’re going to move to Nitro is the sam­ple site I used fre­quent­ly on CraftQuest, Down­link. We learned about Down­link in the Flex­i­ble Twig Tem­plates in Craft course.

I already have this project run­ning local­ly, so I don’t need to clone any­thing or down­load any code. 

In the project direc­to­ry, we will use the nitro add com­mand to add a new project. Nitro assumes that we are going to do it with­in the con­text of the cur­rent work­ing directory. 

After that, we walk through the Nitro project set­up process, choos­ing the Dock­er con­tain­er con­fig­u­ra­tion we need.

Import­ing a Data­base into Craft Nitro

Final­ly, I want to get the data­base import­ed into the Nitro MySQL con­tain­er I have run­ning from the instal­la­tion process. To do that we use nitro db import and then the name of the data­base export file.

nitro db import ~/Downloads/downlink.sql

Nitro will prompt us to choose which data­base we want to use for the import and then import the data­base dump file.

Now we are ready to test the migrat­ed project in the web brows­er and check that every­thing is work­ing as expected!

Local Development with Craft Nitro is made up of the following videos: