Open bhanuvrat opened 2 months ago
Hey @bhanuvrat the main purpose of live_admin is to edit templates at runtime so you don't need to sync with external files, ie: from dev to prod. Our goal is to make the Visual Editor the main tool to build pages, components, and layouts and use the Code Editor for minor changes or something that the Visual Editor is not capable of doing. As developers we tend to write the HEEx templates manually but there are the content creators that have no such knowledge so we're focusing on that group of people first.
Sync is not straightforward to implement because you have to consider conflicts and 2-way sync, ie: if one changes a template using live_admin (either on the code editor or visual editor) and then you eventually want to sync your local/dev changes with prod you'll face some problems.
But I'm curious to learn more about your workflow and how you'd expect beacon to work in that scenario so we can find the best solution. Would you always implement the templates in your local env? Would you use the Visual Editor instead if/when we get to the point where you can create the same page without writing HEEx at all?
Great work @leandrocp with this tool, I found it really nice to work with it. I had the same question and for us is because in our workflow you have the devs doing the initial state of the site on an staging environment were the full main layout an stuff like authorization and authentication are done. We have on the workflow a QA team that will ensure everything is fine before going to production. The first time we go to production, we will like to avoid having to redo all this work on layouts and main pages.
I was thinking on doing a db dump between prod and staging, we have done this on other projects, but then it gets complicated when you have sensitive data on live, then you have to remove records and became difficult.
So we are now thinking on changing our workflow and use stage only for features that are of the scope of the CMS.
But it will be nice to have some tooling to maybe "export" the pages, layouts into a file that can be uploaded into another site.
Hi @bhanuvrat and @javierg we're brainstorming some potential solutions but before I post a proposal or actually work on some tool, I'd like to confirm something first.
In your environments, would you be able to connect to the prod node (or whatever node is running Beacon)? For example on fly.io that would be something similar to https://fly.io/docs/elixir/advanced-guides/connect-observer-to-your-app/
@leandrocp Yes, from stage to production we could enabled networking between stage and production environments.
@leandrocp
In my case, I could enable that, yes. I personally would prefer a solution, where most of the things live in git.
Subsequently, when the data and git take a life of their own, some way to ensure that database is in sync with the codebase version.
The guide recommends adding some snippets to the database using the live_admin feature, here [1].
For the initial launch, the local database can simply be copied to the prod environment.
What would be the most sane way to deploy subsequent updates to the codebase and the database made in the development environment to production?
A guide on the recommended strategy would be of extreme help.
[1] https://github.com/BeaconCMS/beacon/blob/main/guides/recipes/create-a-blog.md#create-the-layout