Skip to content

Some kind words around docs contribution #13133

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

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/docs/docs-contribution-keyboard.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/docs/docs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/docs/docusaurus.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/docs/science-kid.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/docs/useless_example.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/docusaurus/contributing_to_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributions to docs

![hide easter egg text for images in these thingies](../assets/docs/docs-contribution-keyboard.jpg)

## Did you just learn something?!
- maybe write a doc for it!

## Where to put stuff
- Try and utilize existing folder structure
- If it fits in an existing category: great!
- If it doesn't add it to `/docs/` top level
- If it makes sense to make a new category with other top level make a new directory
- **images** and other assets live in `/docs/assets/`
- New folders **need at least 2 markdown files** for docusarus to recognise the folder in the sidebar

## Testing your changes locally

[more in depth local change guide here](locally_testing_docusaurus.md)
- You can see what the docs website will look like locally try:
```bash
cd docusaurus
yarn build && yarn serve
# press control-c to exit the server
```
- if you change **anything at all**
- Your changes will not show up on the website until you re-run `yarn build && yarn serve`
36 changes: 36 additions & 0 deletions docs/docusaurus/deploying_and_reverting_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Deploying and Reverting Docs

![docs are fun](../assets/docs/docs.jpg)

Docusaurus has a strange deployment pattern. Luckily that pattern is abstracted away from you.

If you were looking for the contribution guide [check this doc out](contributing_to_docs.md)

Docs will deploy from whatever branch you are in. You will probably want to deploy from master, but that is at your discretion.

[This is the deployment tool](https://github.com/airbytehq/airbyte/blob/master/tools/bin/deploy_docusaurus)
You will need a github ssh key, the tool will properly tell you if you don't have one though

At it's simplest just open the airbyte repo and run `./tools/bin/deploy_docusaurus`

A typical deployment will look like this


```bash
cd airbyte
# or cd airbyte-cloud
git checkout master
git pull
./tools/bin/deploy_docusaurus
```

If docs has a problem this procedure will work the same on older branches.
The push to production is a force push so collisions are unlikely

If you want to revert/rollback it will look something like this

```bash
cd airbyte
git checkout $SOME_OLDER_BRANCH
./tools/bin/deploy_docusaurus
```
40 changes: 40 additions & 0 deletions docs/docusaurus/docusaurus_settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Docusaurus Settings

Docusaurus is the tool that generates the website that hosts docs in cloud and OSS.
Here are some quick relevant guides using docusaurus at Airbyte.

### I want to change the sidebar
- **OSS**: sidebar is generated in a [JSON blob here](https://github.com/airbytehq/airbyte/blob/master/docusaurus/sidebars.js)
- **OSS**: Here is a guide to the [JSON blob structure](https://docusaurus.io/docs/sidebar/items)
- **Cloud**: sidebar is autogenerated
- folders will become dropdown items
- if there is a `README.md` in the folder
- it will be the default view
- the first `# heading` will be the folder title
- if there is not a `README.md` in the folder name of folder will be the drop down name

### But how do I change the links on top?
- go to one of these config files
- [OSS file location](https://github.com/airbytehq/airbyte/blob/master/docusaurus/docusaurus.config.js)
- [Cloud file location](https://github.com/airbytehq/airbyte-cloud/blob/master/docusaurus/docusaurus.config.js#L64)
- Copy an existing JSON object like this but change the values a bit so people don't think you copied my homework
```js
{
href: 'https://theuselessweb.com',
position: 'left',
label: 'A collection of useless websites',
},
```
![its a funny website](../assets/docs/useless_example.jpg)
- test locally [following this guide](locally_testing_docusaurus.md)


### Updating docusaurus

For security and an occasional cool features you may want to update docusaurus. From time to time docusaurus will suggest you do just that.
It is a reasonable decision to copy the update command docusaurus suggests. It should look something like this:
```bash
yarn upgrade @docusaurus/core@latest @docusaurus/plugin-google-gtag@latest @docusaurus/preset-classic@latest
```
Keep in mind this won't update dependencies. The upside is that the dependencies probably won't break.
The downside is that they probably also contain known security vulnerabilities.
32 changes: 32 additions & 0 deletions docs/docusaurus/locally_testing_docusaurus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Locally testing your changes

![testing is fun and games until it blows up](../assets/docs/science-kid.jpg)

You can test any change you make to see how it will look in production

The processes are almost identical from local testing to production so
you can have a high degree of confidence in the results

```bash
# navigate to docusaurus
cd airbyte-cloud/docusaurus
# install the packages to run docusaurus
yarn install
# compile the current state of airbyte-cloud/docs
# into the website and serve it at http://localhost:3000
yarn build && yarn serve
# control-c sends the SIGTERM command to the running process
# this is a common way to exit running shell applications
# to exit the running server use control-c
```

- If you encounter a build error there may be multiple causes
but usually this is due to a broken link:
- fix your broken links and the build should work
- look at the changes you made locally,
if they look great commit and add a funny picture to the PR for karma (technically optional)

**important note**
if you run `yarn build && yarn serve` and make changes after that you will need
to exit the server using `control-c` from the command line and then running the
command `yarn build && yarn serve` again to see your new changes
10 changes: 10 additions & 0 deletions docs/docusaurus/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Docusaurus / Docs

![isn't he cute?](../assets/docs/docusaurus.jpg)

Guides on how to use docusaurus and docs in airbyte

the usages between here and OSS are nearly identical

OSS uses a hand writted JSON blob for sidebar structure,
otherwise there is almost 100% overlap
22 changes: 22 additions & 0 deletions docusaurus/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ module.exports = {
},
]
},
{
type: 'category',
label: 'Contributing to Airbyte Docs',
items: [
{
type: 'doc',
id: "docusaurus/contributing_to_docs",
},
{
type: 'doc',
id: "docusaurus/deploying_and_reverting_docs",
},
{
type: 'doc',
id: "docusaurus/locally_testing_docusaurus",
},
{
type: 'doc',
id: "docusaurus/readme",
},
]
},
{
type: 'category',
label: 'Deploying Airbyte Open Source',
Expand Down