Skip to content

Commit e647387

Browse files
authored
Merge pull request #937 from honzajavorek/honzajavorek/contrib-packages
docs: document how to install the docs
2 parents f25dbad + 625c4f7 commit e647387

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,26 @@ For example:
7979
8080
Over time, we should track which items are useful and which don't get any traffic. Also, as Apify Docs expand, we may need to add more cards and update which articles we link to.
8181

82-
## Local setup
82+
## Installation and setup
8383

84-
If you want to work only on the main documentation content, cloning this repository is enough. Once you run `npm install` to install all dependencies and run `npm start`, the main portal will open on <http://localhost:3000>. All the links in the navbar and footer need to be absolute, and they will use a different hostname, configured to `docs.apify.loc` - to use that, follow the steps below and set up the Nginx server.
84+
1. Use Git to clone this repository.
85+
2. To install packages prefixed with `@apify-packages`, first go to GitHub and navigate to [Settings / Personal access tokens / Tokens (classic)](https://github.com/settings/tokens). Despite the UI suggesting you should use the new fine-grained tokens, generate a **classic token** with scopes **repo** and **write:packages**. Keep the token somewhere safe. Then run the following command and use your GitHub username together with the token as credentials:
8586

86-
Alternatively, you can skip the Nginx part and navigate to <http://localhost:3000/academy> or <http://localhost:3000/platform> manually instead of using links in the navbar. All relative links should work fine there. The problem with absolute links is only with shared components. The Nginx server is needed only for testing the whole setup and mapping all the different ports to a single one.
87+
```bash
88+
npm login --scope=@apify-packages --registry=https://npm.pkg.github.com --auth-type=legacy
89+
```
8790

88-
Clone all the repositories, and start the Docusaurus instances in them.
91+
Read [#909](https://github.com/apify/apify-docs/issues/909) if you want to understand why this is needed.
92+
3. Run `npm install`.
93+
4. Run `npm start`. The website should open at <http://localhost:3000>.
94+
95+
This is sufficient to work on the main content, i.e. the Academy and Platform docs. If you want to also work on the other parts of the docs, you may want to first join them all together using Nginx.
96+
97+
### Join all the docs repos together using Nginx
98+
99+
By default, the parts of the docs sourced from other repositories will give you 404s. If you need to locally run the project with all the other repositories included, clone them all and setup an Nginx server according to the steps below.
100+
101+
For the setup to work, use `npm start:dev` instead of `npm start` when starting `apify-docs`. This causes all links in the top navigation and the footer to be absolute. They will now use `docs.apify.loc` as a hostname. Clone all the remaining docs repositories, and start their Docusaurus instances. To run Docusaurus on a specific port, use `npm start -- --port XXXX`.
89102

90103
| repo | port |
91104
|---------------------|------|
@@ -96,9 +109,7 @@ Clone all the repositories, and start the Docusaurus instances in them.
96109
| apify-sdk-python | 3004 |
97110
| apify-cli | 3005 |
98111

99-
> To run Docusaurus on a specific port, use `npm start -- --port XXXX`.
100-
101-
To route them, you will need an Nginx server with the following config:
112+
To serve them together as a single website, setup an Nginx server with the following config:
102113

103114
```nginx
104115
server {
@@ -125,12 +136,14 @@ server {
125136
}
126137
```
127138

128-
And add a record to `/etc/hosts` to map the `docs.apify.loc` hostname to localhost:
139+
Add a record to `/etc/hosts`, which maps the `docs.apify.loc` hostname to a localhost:
129140

130141
```text
131142
127.0.0.1 docs.apify.loc
132143
```
133144

145+
Now you should be able to open <http://docs.apify.loc> in your browser and see all the documentation projects joined together, with the top navigation allowing you to browse not only Academy or Platform docs, but also CLI, SDK, and all the other docs.
146+
134147
## Linting
135148

136149
### Markdown and code

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Intro
66

7-
This repository is the home of Apify's documentation, which you can find at [docs.apify.com](https://docs.apify.com/). The documentation is written using [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet). Source files of the [platform documentation](https://docs.apify.com/platform) are located in the [/sources](https://github.com/apify/apify-docs/tree/master/sources) directory. However, other sections, such as SDKs for [Javascript/Node.js](https://docs.apify.com/sdk/js/), [Python](https://docs.apify.com/sdk/python/), or [CLI](https://docs.apify.com/cli), have their own repositories. For more information, see the [Contributing guidelines](./CONTRIBUTING.md).
7+
This repository is the home of Apify's documentation, which you can find at [docs.apify.com](https://docs.apify.com/). The documentation is written using [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet). Source files of the [platform documentation](https://docs.apify.com/platform) are located in the [/sources](https://github.com/apify/apify-docs/tree/master/sources) directory. However, other sections, such as SDKs for [JavaScript/Node.js](https://docs.apify.com/sdk/js/), [Python](https://docs.apify.com/sdk/python/), or [CLI](https://docs.apify.com/cli), have their own repositories. For more information, see the [Contributing guidelines](./CONTRIBUTING.md).
88

99
## Before you start contributing
1010

0 commit comments

Comments
 (0)