docs/run-an-instance: update tutorial for running the api locally

This commit is contained in:
wukko 2024-09-13 12:35:58 +06:00 committed by GitHub
parent a2414682c7
commit f830a1219d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,13 +32,19 @@ cobalt package will update automatically thanks to watchtower.
it's highly recommended to use a reverse proxy (such as nginx) if you want your instance to face the public internet. look up tutorials online.
## using regular node.js (useful for local development)
setup script installs all needed `npm` dependencies, but you have to install `node.js` *(version 18 or above)* and `git` yourself.
## run cobalt api outside of docker (useful for local development)
requirements:
- node.js >= 18
- git
- pnpm
1. clone the repo: `git clone https://github.com/imputnet/cobalt`.
2. run setup script and follow instructions: `npm run setup`. you need to host api and web instances separately, so pick whichever applies.
3. run cobalt via `npm start`.
4. done.
2. go to api/src directory: `cd cobalt/api/src`.
4. install dependencies: `pnpm install`.
5. create `.env` file in the same directory.
6. add needed environment variables to `.env` file. only `API_URL` is required to run cobalt.
- if you don't know what api url to use for local development, use `http://localhost:9000/`.
8. run cobalt: `pnpm start`.
### ubuntu 22.04 workaround
`nscd` needs to be installed and running so that the `ffmpeg-static` binary can resolve DNS ([#101](https://github.com/imputnet/cobalt/issues/101#issuecomment-1494822258)):
@ -72,4 +78,4 @@ sudo service nscd start
setting a `FREEBIND_CIDR` allows cobalt to pick a random IP for every download and use it for all
requests it makes for that particular download. to use freebind in cobalt, you need to follow its [setup instructions](https://github.com/imputnet/freebind.js?tab=readme-ov-file#setup) first. if you configure this option while running cobalt
in a docker container, you also need to set the `API_LISTEN_ADDRESS` env to `127.0.0.1`, and set
`network_mode` for the container to `host`.
`network_mode` for the container to `host`.