How to deploy Content/Pages?
Created 6 years ago by okaufmann

Hi, We are new to PyroCMS and like to know how we can do the following: Let's say we are developing a whole new site for a customer. The Layout also contains the content (of course as pages created with PyroCMS). Anyway we have to create all the contents and pages in the development environment. When we want to release a Version we have to deploy the site (let's say with laravel forge for the simplicity). How should we deploy the created pages? Is it really the way to go to dump in dev and import the whole db to prod? I don't like this way, since this could overwrite changes....

Any suggestions?

Thank you

ryanthompson  —  6 years ago Best Answer

Ahoy!

Here's a simple example of the module seeder: https://github.com/anomalylabs/pages-module/blob/2.3/src/PagesModuleSeeder.php

Calling the page seeder that actually creates the content. Keep in mind this is a simple page type too - with just a WYSIWYG content field: https://github.com/anomalylabs/pages-module/blob/2.3/src/Page/PageSeeder.php

fryiee  —  6 years ago

@okaufmann Seeders are your friend. Our basic CI/CD deployment looks like this for basic CMS sites:

git clone

composer install

php artisan migrate

php artisan db:seed --addon=<yourmoduleorthemehere>

You can conditionally check for the existence of pages in the seeders. Of course, this depends on what sort of change you're looking at making. If it's something significantly breaking (read: semver major) then we'll manually take a copy of prod where needed.

okaufmann  —  6 years ago

Can you give me an example for such a page seeder?

ryanthompson  —  6 years ago Best Answer

Ahoy!

Here's a simple example of the module seeder: https://github.com/anomalylabs/pages-module/blob/2.3/src/PagesModuleSeeder.php

Calling the page seeder that actually creates the content. Keep in mind this is a simple page type too - with just a WYSIWYG content field: https://github.com/anomalylabs/pages-module/blob/2.3/src/Page/PageSeeder.php