2

I'm unclear as to the best way to deploy a Craft CMS 3 site. I'm looking for some best practices and guidance.

I'm currently using Rocketeer to deploy the code from my local environment to my staging site. When I do this I get a ServiceUnavailableHttpException. Do I need to install Craft again once it's been deployed to my staging environment? I don't think I need to but I can't figure out why I'm getting this error.

In the past, I've run Craft 2 sites successfully by installing once on each environment and then gitignoring the common files that I want to share. I have a hook in my Rocketeer file that creates symlinks to the common files/directories.

I've thought about taking a similar approach with my Craft 3 site but am unclear as how I would do that now that the the core craft files are required within composer. Move all the core packages to require-dev in my composer file?

Who can help steer me in the right direction?

Thanks in advance!

2 Answers 2

4

At the risk of offering a "link answer", the Setting up a New Craft CMS 3 Project has a section on DEPLOYING CRAFT CMS that should be useful to you.

I've never heard of Rocketeer, but popular ways to handle deployments are via buddy.works, Laravel Forge and the like. We talk a lot about this on the Website Deployment without Tears episode of devMode.fm

1

I guess you're seeing this notice, because of pending migrations after an update. After you deployed the repository, you should make sure that:

  1. Run composer install --no-interaction to install current versions of Craft and Plugins (I guess that already works in your deploy)
  2. Run ./craft migrate/all --interactive=0. This will run pending migrations
  3. Run ./craft project-config/apply --interactive=0. This will apply the current project-config
  4. Run clear-caches/compiled-templates --interactive=0 to clear the cache
  5. Run clear-caches/cp-resources --interactive=0 to clear the cache
  6. Run clear-caches/data --interactive=0 to clear the cache

That said, Andrew's links are all worth reading and give all these answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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