Update self-hosting instructions

This commit is contained in:
Nikita Karamov 2023-03-16 15:21:16 +01:00
parent 434bb203cb
commit 068e8d09a3
No known key found for this signature in database
GPG key ID: 41D6F71EE78E77CD

View file

@ -25,67 +25,73 @@ To deploy it yourself (it's free!), you can use the following button:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fkytta%2Fshare2fedi) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fkytta%2Fshare2fedi)
<!-- TODO: update the selfhosting instructions -->
<!--
### Host it yourself ### Host it yourself
Self-hosting **Share₂Fedi** outside of Vercel requires some extra setup: Self-hosting **Share₂Fedi** outside of Vercel requires some extra setup:
1. Make sure you have got Node.js v12 or later as well as pnpm installed **Prerequisites:** modern Node.js (v16 or later), `pnpm`.
2. Build the static part of toot: 1. Install the dependencies:
```sh ```sh
pnpm install # to install dependencies pnpm install
pnpm run build # to build the website ```
2. Build the static files:
```sh
pnpm build
``` ```
3. Run the backend server for the form: 3. Run the backend server for the form:
```sh ```sh
node api/toot.js node api/share.js
``` ```
or if you want to run the process in the background: alternatively, if you want to run the process in the background:
```sh ```sh
pm2 start api/toot.js --watch --ignore-watch="node_modules" pm2 start api/share.js --watch --ignore-watch="node_modules"
``` ```
> You can find a summary for pm2 at: https://pm2.keymetrics.io/docs/usage/quick-start/ > You can find a summary for pm2 at: https://pm2.keymetrics.io/docs/usage/quick-start/
4. Set up webserver 4. Set up a web server
Basically, you need to run a server that would proxy the requests to `/api/share`.
to the Node.js server you started. Here's how to achieve this in various HTTP
servers:
1. Apache 1. Apache
```apacheconf ```apacheconf
DocumentRoot "path_to_toot/public" DocumentRoot "<PATH_TO_SHARE2FEDI>/dist"
ProxyPass "/api/toot" "http://localhost:8000/" ProxyPass "/api/share" "http://localhost:8080/"
``` ```
2. Nginx 2. Nginx
```nginxconf ```nginxconf
root path_to_toot/public; root <PATH_TO_SHARE2FEDI>/dist;
index.html; index.html;
location /api/toot { location /api/share {
proxy_pass http://localhost:8000/; proxy_pass http://localhost:8080/;
} }
``` ```
3. Caddy 3. Caddy
```caddy ```caddy
root * path_to_toot/public; root * <PATH_TO_SHARE2FEDI>/dist;
try_files index.html try_files index.html
handle_path /api/toot { handle_path /api/share {
reverse_proxy localhost:8000 reverse_proxy localhost:8080
} }
``` ```
-->
## See also ## See also