1

Today I installed a Craft project (Craft version 4.5.9) onto a new server (git pull, manualy copy of web/assets, composer install, db dump import, craft up). Everything runs fine except one thing:

The installation has to sites (setting › sites). On the new installation both sites were present but the not default one had the same title and slug as the default site. I had to change it manually.

I checked the project.yaml: The sites are not stored in it. Neither in the original installation nor in the new one.

I understand that all project settings should be saved in the project.yaml. Have I found a bug or did I forget one necessary step? Thank you for ideas!

2
  • Sites should definitely be written out as part of Project Config—but in a subdirectory named sites/. Each site will be in a separate file, with a format like {handle}--{uuid}.yaml. Is it possible that this directory matches a .gitignore rule? Oct 31, 2023 at 19:20
  • 1
    I misunderstood, originally—both sites are created, but they have unexpected names? You may need to do php craft project-config/apply --force to reapply all project config values in the new environment. It sounds like something got out of sync, and Craft doesn't see the updates due to matching timestamps in the YAML files and the database. Oct 31, 2023 at 19:24

1 Answer 1

2

Thanks, August, you’re explanation of how sites are stored helped me to solve the problem. I did nor grasp before that sites config is stored in a separate folder. It was already included in the git repository (a good hint however) and a --force did not change anything in the repo – but: the config wasn’t applied when running php craft up. My solution was to run php craft cache/flush-all before applying the config.

2
  • --force when used with project-config/apply just reapplies everything stored in YAML. If you want to write out YAML from the environment you consider to be the source of truth, use project-config/rebuild. See Troubleshooting Project Config for more info! Nov 1, 2023 at 18:16
  • 1
    Thanks for your clarification. In my case the source environment files were fully in line with Craft so a rebuild was not necessary (I did it, to be save, but nothing changed).The cache flush solved the problem.
    – Moritz
    Nov 3, 2023 at 22:50

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.