Hosting: manual integrations via build contract (#10127)
* Hosting: manual integrations via build contract
* Use a single script to load everything
* Include Read the Docs analytics to integrations
* Initial work for hosting features
* External version banner and doc-diff integration
* Old version warning
* Do not inject doc-diff on search page
* Inject old version warning only for non-external versions
* Comments!
* More comments
* Build: pass `PATH` environment variable to Docker container
Instead of prepending all the commands with the `PATH=` variable, we pass the
environment variable directly to the Docker container.
This allow us to run multi-line shell script without failing with weird syntax
errors. Besides, the implementation is cleaner since all the environment
variables are passed to the commands in the same way.
I added some _default paths_ that I found by checking the local Docker
container. I'm also passing the users' path, depending if we are working locally
as root or in production.
This is not 100% complete and there may be some other issues that I'm not seeing
yet, but I think it's a first step to behave in a way our users are expecting.
Closes #10103
* Lint: for some reason fails at CircleCI otherwise
Locally it tries to reverted back 🤷
* Feature flag for new hosting integrations
X-RTD-Hosting-Integration: true/false
This can be used from CloudFlare to decide whether or not inject a `<script>`
into the resulting HTML or not.
* Load `readthedocs-build.yaml` and generate `readthedocs-data.html`
* Load READTHEDOCS_DATA async
* Absolute proxied API path
* Remove duplicated code
* New approach using `readthedocs-client.js` and `/_/readthedocs-config.json`
See https://github.com/humitos/readthedocs-client
* Do not require `readthedocs-build.YAML` for now
* Expand the JSON response with more data
* Remove non-required files and rely on `readthedocs-client.js` only
* Improve helper text
* Builds: save `readthedocs-build.yaml` into database
I added a `Version.build_data` field that may be used from
`/_/readthedocs-config.json` to extend with data generated by the doctool at
build time if necessary.
* Use `Version.build_data` from the endpoint
* Flyout: return data required to generate flyout dynamically
* Updates to the API
* Minor updates
* Update the javascript client compiled version
* doc-diff object returned
* Build: check if the YAML file exists before trying to open it
* Proxito: don't inject the header if the feature is turned off
* Test: add hosting integrations tests
* Remove JS
This file will be deployed directly into S3.
* Load the javascript from a local server for now
* Update URL to remove .json from it
* Remove non-required f-string
* Allow saving `build_data` via API endpoint
* Lint
* Migrate nodejs installation to asdf
* Change port to match `npm run dev` from readthedocs-client