-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add GitLab backend to docs #1413
Conversation
Deploy preview for netlify-cms-www ready! Built with commit 7db2b11 |
Deploy preview for cms-demo ready! Built with commit 7db2b11 |
@@ -226,12 +226,12 @@ Netlify offers a built-in authentication service called Identity. In order to us | |||
|
|||
### Enable Identity and Git Gateway | |||
|
|||
Netlify's Identity and Git Gateway services allow you to manage CMS admin users for your site without requiring them to have GitHub accounts or commit access on your repo. From your site dashboard on Netlify: | |||
Netlify's Identity and Git Gateway services allow you to manage CMS admin users for your site without requiring them to have an account with your Git provider or commit access on your repo. From your site dashboard on Netlify: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest "Git hoster" instead of "Git provider". The value of these services is the hosting they do for you, not that they enable you tu use git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I always struggle between "Git provider" and "Git host." Your argument makes sense.
Thanks for reviewing!
|
||
1. Go to **Settings > Identity**, and select **Enable Identity service**. | ||
2. Under **Registration preferences**, select **Open** or **Invite only**. In most cases, you'll want only invited users to access your CMS, but if you're just experimenting, you can leave it open for convenience. | ||
3. If you'd like to allow one-click login with services like Google and GitHub, check the boxes next to the services you'd like to use, under **External providers**. | ||
4. Scroll down to **Services > Git Gateway**, and click **Enable Git Gateway**. This will authenticate with GitHub and generate a GitHub API access token. In this case, we're leaving the **Roles** field blank, which means any logged in user may access the CMS. For information on changing this, check the [Netlify Identity documentation](https://www.netlify.com/docs/identity/). | ||
4. Scroll down to **Services > Git Gateway**, and click **Enable Git Gateway**. This will authenticate with your Git provider and generate an API access token. In this case, we're leaving the **Roles** field blank, which means any logged in user may access the CMS. For information on changing this, check the [Netlify Identity documentation](https://www.netlify.com/docs/identity/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. I suggest "Git hoster" instead of "Git provider".
I have looked over the changes. I commented a few suggestions where to improve, but I think the documentation is helpfull and could be merged even without going into those. 👍 Disclaimer though:
Thank you for your great work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome Jessica, just a few comments.
@@ -8,7 +8,7 @@ menu: | |||
|
|||
# Add Netlify CMS to Your Site | |||
|
|||
Netlify CMS is adaptable to a wide variety of projects. The only inflexible requirement is that your site content must be written in markdown, JSON, YAML, or TOML files, stored in a repo on [GitHub](https://github.com/). (If you're partial to another Git hosting service, check out the PRs in progress for [GitLab](https://github.com/netlify/netlify-cms/pull/517) and [Bitbucket](https://github.com/netlify/netlify-cms/pull/525) support.) | |||
Netlify CMS is adaptable to a wide variety of projects. The only inflexible requirement is that your site content must be written in markdown, JSON, YAML, or TOML files, stored in a repo on [GitHub](https://github.com/) or [GitLab](https://about.gitlab.com/). (Bitbucket support [coming soon](https://github.com/netlify/netlify-cms/pull/525).) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also note that it is possible to use/create a custom backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, it sure would be nice if we had a doc we could link to about how to make a custom backend... 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know what, I think you would be the perfect person to write that! 😉
With GitLab's Implicit Grant, users can authenticate with GitLab directly from the client. To do this: | ||
|
||
1. Follow the [GitLab docs](https://docs.gitlab.com/ee/integration/oauth_provider.html#adding-an-application-through-the-profile) to add your Netlify CMS instance as an OAuth application. For the **Redirect URI**, enter the address where you access Netlify CMS, for example, `https://www.mysite.com/admin`. For scope, select `api`. | ||
2. GitLab will give you an **Application ID**. Copy this and enter it in your `config.yml` file, along with the following settings: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's note that you should never put your Secret in the docs, only the App ID.
| `site_domain` | `location.hostname` (or `cms.netlify.com` when on `localhost`) | Sets the `site_id` query param sent to the API endpoint. Non-Netlify auth setups will often need to set this for local development to work properly. | | ||
| `base_url` | `https://api.netlify.com` | OAuth client URL for the `github` backend. **Required** when using an external OAuth server with the `github` backend. | | ||
| `auth_endpoint` | `auth` | Path to append to `base_url` for authentication requests. Optional. | | ||
| `auth_url` | `https://gitlab.com/oauth/authorize` on `gitlab` backend; ignored by `github` and `git-gateway` | Authentication endpoint URL. **Required** for implicit grant on self-hosted GitLab | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -41,8 +41,7 @@ To configure in Netlify CMS, use the same `backend` settings in your `config.yml | |||
|
|||
## GitHub Backend | |||
|
|||
The GitHub backend allows CMS users to log in directly with their GitHub account. Note that the | |||
user's GitHub account must have push access to your content repository for this to work. | |||
For repositories stored on GitHub, the `github` backend allows CMS users to log in directly with their GitHub account. Note that the user's GitHub account must have push access to your content repository for this to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reading this sounds like we repeat the word "GitHub" too much, but maybe it's necessary for disambiguation of what account the user is dealing with. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could replace
Note that the user's GitHub account ...
with
Note that the account ...
That would reduce the repetition and still very explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, yeah. I think maybe we could remove the last "GitHub" and have it still be clear enough.
@@ -74,28 +73,78 @@ can use one of the community-maintained projects below. Feel free to [submit a p | |||
|
|||
Check each project's documentation for instructions on how to configure it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the "External OAuth Clients" section be moved below GitLab, or stay here? I'm guessing most people would just use implicit OAuth with GitLab anyway, but there are possible security benefits of using the full flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was wondering about that, too, or about adding a similar subsection in the gitlab
backend section. Seeing that the table does include a column for Git host support, I suppose the section really can work generally across hosts/backends, and the setup details are on the individual project repos, so need to worry about that aspect of the content.
OK, done thinking in type. Gonna move it. 😛
I've updated things in response to comments. The only remaining question is whether the |
Oh! And as of a few minutes ago, GitLab repos are now supported for Deploy to Netlify buttons. It would be cool to add GitLab versions of each of the templates featured on https://www.netlifycms.org/docs/start-with-a-template/ Does anyone have GitLab versions of these repos set up that we could use for the buttons? |
@verythorough GitLab has a feature to mirror a repository from GitHub and keep them in sync. Maybe we could set up a |
These Deploy to Netlify templates use Git Gateway, we shouldn't maintain separate versions for different providers. The only difference between them would be where the template is hosted, which shouldn't matter. |
1. Follow the [GitLab docs](https://docs.gitlab.com/ee/integration/oauth_provider.html#adding-an-application-through-the-profile) to add your Netlify CMS instance as an OAuth application. For the **Redirect URI**, enter `https://api.netlify.com/auth/done`, and check the box for `api` scope. | ||
2. Follow the [Netlify | ||
docs](https://www.netlify.com/docs/authentication-providers/#using-an-authentication-provider) to add your new GitLab Application ID and Secret to your Netlify site dashboard. | ||
2. In your repository, add the following lines to your `config.yml` file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure: This is the config for netlify, not for the static site generator or the gitlab-CI. Perhaps we could be a bit more specific here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point, especially since Jekyll uses the filename of config.yml
as well. Maybe
add the following lines to your Netlify CMS
config.yml
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated throughout the auth doc, then went ahead and did it for all the docs. :)
@@ -41,8 +41,7 @@ To configure in Netlify CMS, use the same `backend` settings in your `config.yml | |||
|
|||
## GitHub Backend | |||
|
|||
The GitHub backend allows CMS users to log in directly with their GitHub account. Note that the | |||
user's GitHub account must have push access to your content repository for this to work. | |||
For repositories stored on GitHub, the `github` backend allows CMS users to log in directly with their GitHub account. Note that the user's GitHub account must have push access to your content repository for this to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could replace
Note that the user's GitHub account ...
with
Note that the account ...
That would reduce the repetition and still very explicit.
At the time I mentioned having separate GitLab-repo buttons, the Deploy to Netlify flow was relying on the location of the source repo to determine where to store the clone, which would railroad some users into GitHub if the source repos were on GitHub. However, @imorente made a change that gives users more control, removing the need for multiple buttons with different providers. |
The change above has been merged in Netlify, so users will always have the choice to clone to GitHub or GitLab, regardless of the source repo location. 🎉 I added some text to the "Start from a Template" description to include GitLab as a destination option when clicking the button. Only question remaining is the |
@verythorough Great, that's the best option in my opinion. |
@@ -80,7 +80,7 @@ Configuration will be different for every site, so we'll break it down into part | |||
|
|||
### Backend | |||
|
|||
Because we're using GitHub and Netlify for our hosting and authentication, backend configuration is fairly strightforward. You can start your `config.yml` file with these lines: | |||
Because we're using [Netlify](https://www.netlify.com) for our hosting and authentication, backend configuration is fairly strightforward. You can start your Netlify CMS `config.yml` file with these lines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be changed to "If we are using Netlify for our hosting", since it's not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also fix strightforward => straightforward while you're at it :)
@@ -7,19 +7,19 @@ menu: | |||
--- | |||
# Authentication & Backends | |||
|
|||
Netlify CMS stores content in your GitHub repository. (GitLab and Bitbucket coming soon!) In order for this to work, you need to authenticate with GitHub, and that requires a server. We have a few options for handling this. | |||
Netlify CMS stores content in your GitHub or GitLab repository. (Bitbucket [coming soon](https://github.com/netlify/netlify-cms/pull/525)!) In order for this to work, you need to authenticate with your Git provider, and in most cases that requires a server. We have a few options for handling this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still says "provider" (not a big deal).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for your work on this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work @verythorough, thank you! Just a couple small things and this is ready to go.
@@ -8,7 +8,7 @@ menu: | |||
|
|||
# Add Netlify CMS to Your Site | |||
|
|||
Netlify CMS is adaptable to a wide variety of projects. The only inflexible requirement is that your site content must be written in markdown, JSON, YAML, or TOML files, stored in a repo on [GitHub](https://github.com/). (If you're partial to another Git hosting service, check out the PRs in progress for [GitLab](https://github.com/netlify/netlify-cms/pull/517) and [Bitbucket](https://github.com/netlify/netlify-cms/pull/525) support.) | |||
Netlify CMS is adaptable to a wide variety of projects. The only inflexible requirement is that your site content must be written in markdown, JSON, YAML, or TOML files, stored in a repo on [GitHub](https://github.com/) or [GitLab](https://about.gitlab.com/). (You can also create your own custom backend, or if you're interested in Bitbucket support, that's [coming soon](https://github.com/netlify/netlify-cms/pull/525)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a period at end of paragraph.
@@ -92,7 +92,7 @@ These lines specify your backend protocol and your publication branch. Git Gatew | |||
|
|||
### Editorial Workflow | |||
|
|||
By default, saving a post in the CMS interface will push a commit directly to the publication branch specified in `backend`. However, you also have the option to enable the [Editorial Workflow](https://www.netlifycms.org/docs/configuration-options/#publish-mode), which adds an interface for drafting, reviewing, and approving posts. To do this, add the following line to your `config.yml`: | |||
By default, saving a post in the CMS interface will push a commit directly to the publication branch specified in `backend`. However, you also have the option to enable the [Editorial Workflow](https://www.netlifycms.org/docs/configuration-options/#publish-mode), which adds an interface for drafting, reviewing, and approving posts. To do this, add the following line to your Netlify CMS `config.yml`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should now mention that editorial workflow is only currently support by GitHub and Git Gateway over GitHub.
8c1ca70
to
1363c09
Compare
- Summary
Updates docs to go with the addition of the GitLab backend! 🎉
- Test plan
Most of the changes can be found on
https://docs-update-gitlab--netlify-cms-www.netlify.com/docs/authentication-backends/
If someone who hasn't built the thing or written the doc could run through the instructions for Git Gateway and GitLab backends, that would be 👌
- A picture of a cute animal (not mandatory but encouraged)