How do I deploy my locally hosted Craft CMS site to droplet?

Posted January 12, 2022 82 views
LAMP StackCMSDeployment

I’m really new to all of this, so trying to problem solve along the way!

My current situation is…

I’ve built my first Craft CMS website and I’m running it locally on my machine using Craft Nitro and Docker – as suggested here…

I’m now at the point that I would like to deploy the site to a droplet I have created on Digital Ocean. On the droplet I have spun up a LAMP server (again all firsts for me!)

Ideally, I would like to create a workflow that automatically deploys any changes I make, so with this in mind have uploaded the files and directories to a GitHub directory, hopefully this was the right thing to do?

I have very little idea about what to do next in order to get deploy the site, so would really appreciate any help or guidance!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

What I could suggest is following the deployment best practices suggested by Craft CMS here:

What you need to do is:

  • Create a new GitHub repository.
  • Then push your local files to that new GitHub repository.
  • After that on your server, using the cd command go to the /var/www/html directory and use clone your repository.
  • Then run the composer install command: composer install --no-interaction
  • After that update your database details in the Craft config file and run your database migration files in case you have them.

An alternative option would be to give the DigitalOcean App Platform a try as that way you would not have to do any server configuration and you would get automated deployments out of the box.

Let me know how it goes!