|
| 1 | +# Getting started with docs-rendering |
| 2 | + |
| 3 | +## Project structure |
| 4 | + |
| 5 | +**config/** |
| 6 | + |
| 7 | +Contains Yaml configuration files, example usage : *translations*. |
| 8 | + |
| 9 | +**docker/** |
| 10 | + |
| 11 | +Contains docker related scripts, like entrypoints, image building script, entrypoint, ... |
| 12 | + |
| 13 | +**extra/** |
| 14 | + |
| 15 | +Contains extra files used in pelican generation (favicon, robots.txt). |
| 16 | + |
| 17 | +**plugins/** |
| 18 | + |
| 19 | +Contains pelican plugins. **Contrib** directory contains third-party plugins managed as git submodules. |
| 20 | + |
| 21 | +**screenshots/** |
| 22 | + |
| 23 | +Contains documentation screenshots. |
| 24 | + |
| 25 | +**themes/** |
| 26 | + |
| 27 | +Contains OVHcloud pelican theme. |
| 28 | + |
| 29 | +**pelicanconf.py** |
| 30 | + |
| 31 | +Managed pelican base configuration. It should be enough to get you started, but you can override it localy if needed. |
| 32 | + |
| 33 | +**requirements.txt** |
| 34 | + |
| 35 | +`pip` python's package manager requirements file. It is used to specify versions of dependencies. |
| 36 | + |
| 37 | + |
| 38 | +## Getting it up and running |
| 39 | + |
| 40 | +### The docker way |
| 41 | + |
| 42 | +Pre-requisites : |
| 43 | +* docker |
| 44 | +* git |
| 45 | +* a code editor |
| 46 | + |
| 47 | +Clone the repository |
| 48 | +```sh |
| 49 | +git clone --recurse-submodules https://github.com/ovh/docs-rendering.git |
| 50 | +``` |
| 51 | + |
| 52 | +Clone docs content repository |
| 53 | +```sh |
| 54 | +git clone https://github.com/ovh/docs.git |
| 55 | +``` |
| 56 | + |
| 57 | +Go in the `docs-rendering` folder |
| 58 | +```sh |
| 59 | +cd docs-rendering |
| 60 | +``` |
| 61 | + |
| 62 | +Build the docker image |
| 63 | +```sh |
| 64 | +./docker/build.sh |
| 65 | +``` |
| 66 | + |
| 67 | +> The above command creates a docker image named *ovh-docs-dev-env* |
| 68 | +
|
| 69 | +Run the container with the helper script |
| 70 | +```sh |
| 71 | +./docker/run-container.sh -f $PWD/../docs -p 80 |
| 72 | +``` |
| 73 | + |
| 74 | +The above command does : |
| 75 | +* `./docker/run-container.sh` -> run the previously build docker image and mount some docker volumes |
| 76 | +* `-f [...]` -> specify the path to documentation content markdown files |
| 77 | +* `-p 80` -> expose the `80` port so you can access it like so : `http://localhost:80` |
| 78 | + |
| 79 | +> Replace localhost with the hostname of the machine hosting your docker container |
| 80 | +
|
| 81 | +You should now be able to edit pelican theme / plugins and refresh your browser to see the changes. |
| 82 | + |
| 83 | +> Note that the more content pages you have, the more time it will take to apply your changes |
| 84 | +
|
| 85 | + |
| 86 | +### Run it locally without docker |
| 87 | + |
| 88 | +You will need : |
| 89 | +* git |
| 90 | +* python |
| 91 | +* a code editor |
| 92 | + |
| 93 | +Clone the repository |
| 94 | +```sh |
| 95 | +git clone --recurse-submodules https://github.com/ovh/docs-rendering.git |
| 96 | +``` |
| 97 | + |
| 98 | +Clone docs content repository |
| 99 | +```sh |
| 100 | +git clone https://github.com/ovh/docs.git |
| 101 | +``` |
| 102 | + |
| 103 | +Go in the `docs-rendering` folder |
| 104 | +```sh |
| 105 | +cd docs-rendering |
| 106 | +``` |
| 107 | + |
| 108 | +Install the dependencies |
| 109 | +```sh |
| 110 | +pip install -r requirements.txt |
| 111 | +``` |
| 112 | + |
| 113 | +Run the pelican engine |
| 114 | +```sh |
| 115 | +$PELICAN --debug --fatal errors -r $PWD/../docs/pages |
| 116 | +``` |
| 117 | + |
| 118 | +The above command does : |
| 119 | +* `--debug` -> show all messages |
| 120 | +* `--fatal errors` -> exit for errors are encountered |
| 121 | +* `-r` -> autoreload |
| 122 | +* `$PWD/../docs/pages` -> path to content markdown files |
| 123 | + |
| 124 | +Once the generation is finished, it should have created an output directory containing the static site. |
| 125 | + |
| 126 | +To access it you can use the `pelican.server` python module using : `python -m pelican.server`. |
| 127 | + |
| 128 | +So to expose the output directory, you would need to : |
| 129 | +* open a new terminal |
| 130 | +* run `cd output` |
| 131 | +* run `python -m pelican.server 8080` |
| 132 | +* open your browser at http://localhost:8080 |
0 commit comments