8000 Implement a simple github webook server to build the doc. by JulienPalard · Pull Request #101 · python/docsbuild-scripts · GitHub
[go: up one dir, main page]

Skip to content

Implement a simple github webook server to build the doc. #101

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 3 commits into from
May 21, 2021

Conversation

JulienPalard
Copy link
Member
@JulienPalard JulienPalard commented Dec 3, 2020

closes #98 #77

@JulienPalard
Copy link
Member Author
JulienPalard commen 8000 ted Dec 3, 2020

@ewdurbin I'm trying to implement a simple github webhook server for docs.python.org to build the doc when a branch change.

(Yes I added a lock to avoid two successive commits to build the same branch at the same time, but no, I did not implemented a queue to ensure all commits are correctly built, the first one is build, the 2nd one is dropped due to process already running, it's a first try.)

It would need basic config server side, my 2020 preference would go for something like:

logging.yml could look like:

---

version: 1
disable_existing_loggers: false
formatters:
  normal:
    format: '%(asctime)s - %(levelname)s - %(message)s'
handlers:
  file:
    class: logging.FileHandler
    filename: /var/log/docsbuild/server.log
    level: DEBUG
    formatter: normal
loggers:
  build_docs_server:
    level: DEBUG
    handlers: [file]
  aiohttp.access:
    level: DEBUG
    handlers: [file]
  aiohttp.client:
    level: DEBUG
    handlers: [file]
  aiohttp.internal:
    level: DEBUG
    handlers: [file]
  aiohttp.server:
    level: DEBUG
    handlers: [file]
  aiohttp.web:
    level: DEBUG
    handlers: [file]
  aiohttp.websocket:
    level: DEBUG
    handlers: [file]

The service could look like:

[Unit]
Description=Build Docs Server
After=network.target

[Service]
Type=simple
WorkingDirectory=/srv/docsbuild/scripts/
ExecStart=/srv/docsbuild/scripts/build_docs_server.py --path /srv/docsbuild/build-docs-server.sock --logging-config /srv/docsbuild/logging.yml
WorkingDirectory=/srv/docsbuild/scripts/
Restart=on-abort

[Install]
WantedBy=multi-user.target

⚠ my code do not chmod the .sock file, so nginx will probably have no write access to it, tell me how you want to fix this, I can chmod 666 in my code, but it looks evil.

All of this is obviously just my vague idea on how to do it, but I'll follow you if you have any other idea of handling this.

@ewdurbin
Copy link
Member
ewdurbin commented Dec 4, 2020

⚠ my code do not chmod the .sock file, so nginx will probably have no write access to it, tell me how you want to fix this, I can chmod 666 in my code, but it looks evil.

FWIW, it looks like the default behavior of gunicorn is to create sockets with srwxrwxrwx owned by the user/group

@ewdurbin
Copy link
Member
ewdurbin commented Dec 4, 2020

Started some work on this in python/psf-salt#197

@JulienPalard
Copy link
Member Author

@ewdurbin thanks for the review! I applied what was required. the GH_SECRET is expected as an environment variable, tell me if you prefer HOST/PORT/PATH as an environment variable for "consistency" of if it's OK to keep them as command line arguments.

(or the other way around by using setproctitle to hide the secret from the command...)

I'm still using my "good old fork", trying to keep things simple and easy for the first version, but I took the time to wait for childs to avoid hords of zombies, hope it's OK :P

@JulienPalard
Copy link
Member Author

Hi @ewdurbin is there anything blocking on your side?

Can we merge this and try it?

@JulienPalard JulienPalard force-pushed the JulienPalard/server branch from 2caf1f3 to 2ea1381 Compare May 21, 2021 18:59
@JulienPalard JulienPalard merged commit 66b922e into python:main May 21, 2021
@JulienPalard JulienPalard deleted the JulienPalard/server 6EB5 branch May 21, 2021 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please update https://docs.python.org/dev/ more frequently than once a day
2 participants
0