Start installation guide in the docs

This commit is contained in:
Thomas Sileo 2022-07-05 09:15:45 +02:00
parent 1f6d6c5477
commit 51f920bc4d
6 changed files with 157 additions and 7 deletions

59
docs/install.md Normal file
View File

@ -0,0 +1,59 @@
## Python developer edition
Setup [Poetry](https://python-poetry.org/docs/master/#installing-with-the-official-installer).
```bash
curl -sSL https://install.python-poetry.org | python3 -
```
Clone the repository.
```bash
git clone https://git.sr.ht/~tsileo/microblog.pub testing.microblog.pub
```
Install deps.
```bash
poetry install
```
Setup config.
```bash
poetry run inv configuration-wizard
```
Grab your virtualenv path.
```bash
poetry env info
```
Run the two processes with supervisord.
```bash
VENV_DIR=/home/ubuntu/.cache/pypoetry/virtualenvs/microblogpub-chx-y1oE-py3.10 poetry run supervisord -c misc/supervisord.conf -n
```
You will also want to setup a reverse proxy like Nginx, see [uvicorn documentation](https://www.uvicorn.org/deployment/#running-behind-nginx):
```nginx
server {
client_max_body_size 4G;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://localhost:8000;
}
# [...]
}
```

74
docs/static/codehilite.css vendored Normal file
View File

@ -0,0 +1,74 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.codehilite .hll { background-color: #ffffcc }
.codehilite { background: #f8f8f8; }
.codehilite .c { color: #3D7B7B; font-style: italic } /* Comment */
.codehilite .err { border: 1px solid #FF0000 } /* Error */
.codehilite .k { color: #008000; font-weight: bold } /* Keyword */
.codehilite .o { color: #666666 } /* Operator */
.codehilite .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
.codehilite .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
.codehilite .cp { color: #9C6500 } /* Comment.Preproc */
.codehilite .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
.codehilite .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
.codehilite .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
.codehilite .gd { color: #A00000 } /* Generic.Deleted */
.codehilite .ge { font-style: italic } /* Generic.Emph */
.codehilite .gr { color: #E40000 } /* Generic.Error */
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.codehilite .gi { color: #008400 } /* Generic.Inserted */
.codehilite .go { color: #717171 } /* Generic.Output */
.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.codehilite .gs { font-weight: bold } /* Generic.Strong */
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.codehilite .gt { color: #0044DD } /* Generic.Traceback */
.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.codehilite .kp { color: #008000 } /* Keyword.Pseudo */
.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.codehilite .kt { color: #B00040 } /* Keyword.Type */
.codehilite .m { color: #666666 } /* Literal.Number */
.codehilite .s { color: #BA2121 } /* Literal.String */
.codehilite .na { color: #687822 } /* Name.Attribute */
.codehilite .nb { color: #008000 } /* Name.Builtin */
.codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.codehilite .no { color: #880000 } /* Name.Constant */
.codehilite .nd { color: #AA22FF } /* Name.Decorator */
.codehilite .ni { color: #717171; font-weight: bold } /* Name.Entity */
.codehilite .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
.codehilite .nf { color: #0000FF } /* Name.Function */
.codehilite .nl { color: #767600 } /* Name.Label */
.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */
.codehilite .nv { color: #19177C } /* Name.Variable */
.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
.codehilite .mb { color: #666666 } /* Literal.Number.Bin */
.codehilite .mf { color: #666666 } /* Literal.Number.Float */
.codehilite .mh { color: #666666 } /* Literal.Number.Hex */
.codehilite .mi { color: #666666 } /* Literal.Number.Integer */
.codehilite .mo { color: #666666 } /* Literal.Number.Oct */
.codehilite .sa { color: #BA2121 } /* Literal.String.Affix */
.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */
.codehilite .sc { color: #BA2121 } /* Literal.String.Char */
.codehilite .dl { color: #BA2121 } /* Literal.String.Delimiter */
.codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */
.codehilite .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */
.codehilite .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
.codehilite .sx { color: #008000 } /* Literal.String.Other */
.codehilite .sr { color: #A45A77 } /* Literal.String.Regex */
.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */
.codehilite .ss { color: #19177C } /* Literal.String.Symbol */
.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */
.codehilite .fm { color: #0000FF } /* Name.Function.Magic */
.codehilite .vc { color: #19177C } /* Name.Variable.Class */
.codehilite .vg { color: #19177C } /* Name.Variable.Global */
.codehilite .vi { color: #19177C } /* Name.Variable.Instance */
.codehilite .vm { color: #19177C } /* Name.Variable.Magic */
.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */

View File

@ -56,7 +56,13 @@ nav a:hover, main a:hover, header p a:hover {
max-width: 960px;
margin: 50px auto;
}
code {
padding: 10px;
overflow: auto;
display: block;
}
</style>
<link rel="stylesheet" href="static/codehilite.css" type="text/css" />
</head>
<body>
<div id="main">
@ -68,6 +74,7 @@ nav a:hover, main a:hover, header p a:hover {
<nav class="flexbox">
<ul>
<li><a href="/">Home</a>
<li><a href="/installing.html">Installing</a>
<li><a href="https://sr.ht/~tsileo/microblog.pub/">Source code</a>
<li><a href="https://todo.sr.ht/~tsileo/microblog.pub">Bug tracker</a>
<li><a href="https://sr.ht/~tsileo/microblog.pub/lists">Mailing list</a>

View File

@ -5,13 +5,13 @@ socket=tcp://localhost:8000
command=%(ENV_VENV_DIR)s/bin/uvicorn app.main:app --no-server-header --fd 0
numprocs=2
process_name=uvicorn-%(process_num)d
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stdout
redirect_stderr=true
stdout_logfile=uvicorn.log
stdout_logfile_maxbytes=0
[program:worker]
command=%(ENV_VENV_DIR)s/bin/inv process-outgoing-activities
numproc=1
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stdout
redirect_stderr=true
stdout_logfile=worker.log
stdout_logfile_maxbytes=0

View File

@ -1,3 +1,4 @@
import shutil
from pathlib import Path
from jinja2 import Environment
@ -9,7 +10,7 @@ from app.config import VERSION
def markdownify(content: str) -> str:
return markdown(content, extensions=["mdx_linkify"])
return markdown(content, extensions=["mdx_linkify", "fenced_code", "codehilite"])
def main() -> None:
@ -18,7 +19,10 @@ def main() -> None:
env = Environment(loader=loader, autoescape=select_autoescape())
template = env.get_template("layout.html")
shutil.rmtree("docs/dist", ignore_errors=True)
Path("docs/dist").mkdir(exist_ok=True)
shutil.rmtree("docs/dist/static", ignore_errors=True)
shutil.copytree("docs/static", "docs/dist/static")
readme = Path("README.md")
template.stream(
@ -26,6 +30,12 @@ def main() -> None:
version=VERSION,
).dump("docs/dist/index.html")
install = Path("docs/install.md")
template.stream(
content=markdownify(install.read_text().removeprefix("# microblog.pub")),
version=VERSION,
).dump("docs/dist/installing.html")
if __name__ == "__main__":
main()

View File

@ -120,6 +120,6 @@ def download_twemoji(ctx):
@task(download_twemoji, compile_scss, migrate_db)
def setup_static_dir(ctx):
def configuration_wizard(ctx):
# type: (Context) -> None
pass
run("PYTHONPATH=. poetry run python scripts/config_wizard.py", pty=True, echo=True)