From f830a1219d2d96b18350fa50c0c54fd67a77a8dd Mon Sep 17 00:00:00 2001 From: wukko Date: Fri, 13 Sep 2024 12:35:58 +0600 Subject: [PATCH] docs/run-an-instance: update tutorial for running the api locally --- docs/run-an-instance.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/run-an-instance.md b/docs/run-an-instance.md index 8e3afd48..fb339c4c 100644 --- a/docs/run-an-instance.md +++ b/docs/run-an-instance.md @@ -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`. \ No newline at end of file +`network_mode` for the container to `host`.