decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Separate CMS for each Gatsby website in a monorepo

Open adrw opened this issue 5 years ago • 12 comments

Describe the bug I've been working to configure a unique CMS for each Gatsby website in a monorepo on Github and can't find how to do that. I've copied the websites over from their previous locations in individual repos and updated the Git references in Netlify / Build / Deploy and Netlify / Identify dashboards but they still seem broken despite websites building and deploying successfully on Netlify.

To Reproduce Add multiple websites to a single repo, try to configure a unique Netlify CMS on each. Github login button (though enabled as a gateway in Netlify) are not shown on login page.

Expected behavior Each website in a repo has it's own CMS such that content from other websites is not shown. Stretch goal would be prefixing commit messages with the site that the git change refers to.

Screenshots Screen Shot 2019-03-26 at 9 07 51 PM

adrw avatar Mar 27 '19 01:03 adrw

Ah, Gatsby - does each Gatsby site have it's own separate build or is the build somehow combined? Can you provide a repo that minimally reproduces this issue?

erquhart avatar Apr 02 '19 21:04 erquhart

Each site has it's own build. The repo essentially has a directory sites/ that inside has a directory for each domain and each of those site domain directories is a complete Gatsby site and build.

Example: https://github.com/adrw/westegg/tree/2713280ea07db75a3bd3aba9e86fc968d720cffa/sites

adrw avatar Apr 02 '19 21:04 adrw

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 29 '19 09:10 stale[bot]

@adrw have you been able to find a solution to this?

I've been trying to see how to configure the git-gateway "base dir" to my site

image

phil-lgr avatar Nov 07 '19 22:11 phil-lgr

So basically, git-gateway with netlify-cms doesn't support the case where the netlify site is not installed at the root?

if is possible to do this?

image

have the netlify site at /folder instead of root?

@erquhart

phil-lgr avatar Nov 07 '19 23:11 phil-lgr

Do you have any posts in your blog folder?

Sent with GitHawk

erquhart avatar Nov 08 '19 00:11 erquhart

Well I got this working by putting the correct path to the different entries in config.yml, e.g.:

media_folder: packages/site-1/static/img

phil-lgr avatar Nov 08 '19 01:11 phil-lgr

Now what is awkward with git-gateway is that permissions are given for the whole repository.

So in a monorepo setup, the git-gateway for one site will allow access to the whole repository, I've opened an issue here: https://github.com/netlify/git-gateway/issues/38

phil-lgr avatar Nov 08 '19 01:11 phil-lgr

Ideally you would be able to tell git-gateway to only allow access to specific paths, something like:

# config.yml for site 1
backend:
  name: git-gateway
  accept_roles: 
    - admin
    - editor
  accept_content_routes: # <------ restrict content access to those paths only
    - packages/site1

# config.yml for site 2
backend:
  name: git-gateway
  accept_roles: 
    - admin
    - editor
  accept_content_routes: # <------ restrict content access to those paths only
    - packages/site2

phil-lgr avatar Nov 08 '19 01:11 phil-lgr

any thoughts @erquhart

phil-lgr avatar Nov 12 '19 21:11 phil-lgr

I'm not sure if I understand this, it still open. So Netlify CMS can't build from a folder yet?

I just wanted to structure a web monorepo that have a static site, cms, components, small backend. The cms is only one.

CallMeLaNN avatar Jun 11 '22 14:06 CallMeLaNN

U guys can use npm workspace with multiples monorepos for multiple websites.

miltonbolonha avatar Apr 02 '24 10:04 miltonbolonha