Update install instructions

This commit is contained in:
Thomas Sileo 2022-07-30 09:31:04 +02:00
parent b8aeb5a199
commit 712607f808

View file

@ -6,15 +6,18 @@
Assuming Docker and [Docker Compose](https://docs.docker.com/compose/install/) are already installed. Assuming Docker and [Docker Compose](https://docs.docker.com/compose/install/) are already installed.
For now, there's no image published on Docker Hub. For now, there's no image published on Docker Hub, this means you will have to build the image locally.
Clone the repository. Clone the repository, replace `you-domain.tld` by your own domain.
Note that if you want to serve static assets via your reverse proxy (like nginx), clone it in a place
where accessible by your reverse proxy user.
```bash ```bash
git clone https://git.sr.ht/~tsileo/microblog.pub your-domain.tld git clone https://git.sr.ht/~tsileo/microblog.pub your-domain.tld
``` ```
Build the Docker image. Build the Docker image locally.
```bash ```bash
make build make build
@ -26,13 +29,14 @@ Run the configuration wizard.
make config make config
``` ```
Update `data/profile.toml` and add this line: Update `data/profile.toml` and add this line in order to process headers from the reverse proxy:
```toml ```toml
trusted_hosts = ["*"] trusted_hosts = ["*"]
``` ```
Start the app with Docker Compose, it will listen on port 8000 by default. Start the app with Docker Compose, it will listen on port 8000 by default.
The port can be tweaked in the `docker-compose.yml` file.
```bash ```bash
docker compose up -d docker compose up -d
@ -40,6 +44,17 @@ docker compose up -d
Setup a reverse proxy (see the [Reverse Proxy section](/installing.html#reverse-proxy)). Setup a reverse proxy (see the [Reverse Proxy section](/installing.html#reverse-proxy)).
### Updating
To update microblogpub, pull the latest changes, rebuild the Docker image and restart the process with `docker compose`.
```bash
git pull
make build
docker compose stop
docker compose up -d
```
## Python developer edition ## Python developer edition
Assuming you have a working **Python 3.10+** environment. Assuming you have a working **Python 3.10+** environment.
@ -82,9 +97,20 @@ VENV_DIR=/home/ubuntu/.cache/pypoetry/virtualenvs/microblogpub-chx-y1oE-py3.10 p
Setup a reverse proxy (see the next section). Setup a reverse proxy (see the next section).
### Updating
To update microblogpub locally, pull the remote changes and run the `update` task to regeneratee the CSS and run any DB migrations.
```bash
git pull
poetry run inv update
```
## Reverse proxy ## Reverse proxy
You will also want to setup a reverse proxy like Nginx, see [uvicorn documentation](https://www.uvicorn.org/deployment/#running-behind-nginx): You will also want to setup a reverse proxy like NGINX, see [uvicorn documentation](https://www.uvicorn.org/deployment/#running-behind-nginx):
If you don't have a reverse proxy setup yet, [NGINX + certbot](https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/) is recommended.
```nginx ```nginx
server { server {
@ -105,3 +131,24 @@ server {
} }
``` ```
Optionally, you can serve static files using NGINX directly, with an additional `location` block.
This will require the NGINX user to have access to the `static/` directory.
```nginx
server {
# [...]
location / {
# [...]
}
location /static {
# path for static files
rewrite ^/static/(.*) /$1 break;
root /path/to/your-domain.tld/app/static/;
}
# [...]
}
```