Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous Deployment / Staging branches with Sanity Studio #29

Closed
raney24 opened this issue Nov 28, 2022 · 6 comments
Closed

Continuous Deployment / Staging branches with Sanity Studio #29

raney24 opened this issue Nov 28, 2022 · 6 comments
Assignees

Comments

@raney24
Copy link
Member

raney24 commented Nov 28, 2022

Each time someone makes a change to Sanity, it often breaks the production dataset. We need to set up a way for a staging dataset and a production dataset.

Link for ref: https://www.sanity.io/guides/multi-environment-deployments

@raney24
Copy link
Member Author

raney24 commented Dec 21, 2022

@WillGarman Let's just set up a manual process that is well-documented on how to import/export the dev dataset to the production dataset.

Potential gotcha's:

  • How does content merge? For example, does content created during the dev process get overwritten during the import

TODO: Figure out tags when running import/export dataset commands

@WillGarman
Copy link
Collaborator

WillGarman commented Dec 21, 2022

Notes:

  • Workflow to create new documents for production

Import/Export Documentation

  • Use local machine to create document on your personal tagged dataset (Commit for reference on how to switch to change tags)

  • Export from your tagged dataset, then import into the dev dataset using either --missing or --replace flags (Documentation)

  • In the dev dataset, then add content to your new document in the Sanity Dashboard

  • Then export from the dev dataset, and import into the production dataset using the --missing skip flag (adds any missing data, skips any data with same Id's)

  • Possible have to do sanity graphql deploy to update the GraphQL (After adding code in `/documents))

  • Yay you're done... hopefully (Refer to the commands below)

    • Note: these commands will only transfer the content of the documents, you will still need to add the document code to the studio/douments folder

Confirmed command sequence once a schema is made in your tagged dataset

These 2 commands will export from your tagged dataset into the dev dataset

  • sanity dataset export dev --tag [tagName] ./tagged.tar.gz (Export from tagged dataset)
  • sanity dataset import ./tagged.tar.gz dev --missing skip (Import into dev dataset) this will add all missing data and skip any data with the same id

After this step, you would populate the content in sanity

Then, these 2 commands will import your data from dev to production

  • sanity dataset export dev ./dev.tar.gz (Export from dev dataset)
    Create a backup of production dataset (Possible GitHub action)
  • sanity dataset export production ./production.tar.gz (Export from production dataset)

Import from dev into production

  • sanity dataset import ./dev.tar.gz production --missing skip (Import into production dataset)

@raney24
Copy link
Member Author

raney24 commented Mar 7, 2023

@WillGarman Anything left to keep this issue open? Is the above documentation in the Readme?

@WillGarman
Copy link
Collaborator

@WillGarman Anything left to keep this issue open? Is the above documentation in the Readme?

@raney24 the documentation has not been added to the readme. Once it gets put in there then this issue doesn't need to be open any longer

@raney24
Copy link
Member Author

raney24 commented Mar 17, 2023

@WillGarman Can you add that in and then close this?

@WillGarman
Copy link
Collaborator

Added!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants