{"id":25215523,"url":"https://github.com/bitcoin-balancer/cli","last_synced_at":"2026-04-28T20:01:49.787Z","repository":{"id":245584976,"uuid":"818720051","full_name":"bitcoin-balancer/cli","owner":"bitcoin-balancer","description":"The cli is a robust command-line interface designed to streamline the development and management of Balancer’s infrastructure and internal operations.","archived":false,"fork":false,"pushed_at":"2025-07-28T20:01:50.000Z","size":652,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-28T22:06:15.459Z","etag":null,"topics":["bitcoin","dca","dollar-cost-averaging","investment","open-source","profit","strategy","trading","trading-strategy","value-averaging"],"latest_commit_sha":null,"homepage":"https://balancer.jesusgraterol.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitcoin-balancer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-22T16:57:19.000Z","updated_at":"2025-07-28T20:01:55.000Z","dependencies_parsed_at":"2024-06-28T20:28:31.689Z","dependency_job_id":null,"html_url":"https://github.com/bitcoin-balancer/cli","commit_stats":null,"previous_names":["bitcoin-balancer/cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bitcoin-balancer/cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin-balancer%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin-balancer%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin-balancer%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin-balancer%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitcoin-balancer","download_url":"https://codeload.github.com/bitcoin-balancer/cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin-balancer%2Fcli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32396781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","dca","dollar-cost-averaging","investment","open-source","profit","strategy","trading","trading-strategy","value-averaging"],"created_at":"2025-02-10T18:14:46.528Z","updated_at":"2026-04-28T20:01:49.781Z","avatar_url":"https://github.com/bitcoin-balancer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cli`\n\nThe `cli` is a robust command-line interface designed to streamline the development and management of Balancer’s infrastructure and internal operations. It enables you to:\n\n* **Automate infrastructure tasks** – Effortlessly handle provisioning, scaling, and monitoring\n* **Execute development actions** – Run tests, deploy updates, and manage code dependencies with ease\n* **Administer databases** – Back up, restore, and maintain your database efficiently\n* **Secure remote access** – Interact with production servers via secure SSH connections\n* **And more!**\n\nWith its intuitive syntax and comprehensive functionality, the `cli` simplifies complex workflows, enhances efficiency, and ensures consistent project management.\n\n**Note:** If you’re not actively developing Balancer or only need basic infrastructure management, consider using [`cli-lite`](https://github.com/bitcoin-balancer/cli-lite) for a more streamlined experience.\n\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## Requirements\n\n### Software\n\n- UNIX-like OS\n- git `^v2.43.0`\n- Node.js `^v22.11.0`\n- npm `^v10.9.0`\n- Docker Engine `^v27.3.1`\n- Docker Compose `^v2.29.7`\n\n### Hardware (Remote Host)\n\n- 1 Shared CPU\n- 1 GB Memory\n- 25 GB Storage (Regular SSD)\n\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## Getting Started\n\n1. [Set up your remote host](./docs/remote-host/index.md)\n2. [Set up your environment variables](./docs/environment-variables/index.md)\n3. [Download and build the CLI](./docs/download-build-cli/index.md)\n4. [Deploy the CLI to the Remote Host](./docs/deploy-cli/index.md)\n5. [Build and run Balancer](./docs/build-run-balancer/index.md)\n\n\n\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## Guides\n\n- [Remote Host Configuration](./docs/remote-host/index.md)\n- [Environment Variables](./docs/environment-variables/index.md)\n- [Cloudflare Tunnel Integration (Production)](./docs/cloudflare-tunnel/index.md)\n- [Telegram Integration (Optional)](./docs/telegram/index.md)\n\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## CLI Actions\n\n### Host\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003econnect\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n  \n  Establishes a SSH Connection with the remote host.\n\n  ```bash\n  ssh root@ip\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003elandscape-sysinfo\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n  Executes the landscape-sysinfo binary and prints its results.\n\n  ```bash\n  ssh root@ip landscape-sysinfo\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ereboot\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Reboots the remote host after stopping containers and removing containers, networks, volumes, and images created by \u003ccode\u003eup\u003c/code\u003e.\n\n  ```bash\n  ssh root@ip reboot\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eshutdown\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Shuts down the remote host after stopping containers and removing containers, networks, volumes, and images created by \u003ccode\u003eup\u003c/code\u003e.\n\n  ```bash\n  ssh root@ip poweroff\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003essh-copy-id\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Copies the SSH Public Key specified in the config file into the remote server.\n\n  ```bash\n  ssh-copy-id root@ip\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\n\u003cbr/\u003e\n\n### Docker Compose\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eup\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Builds, (re)creates, starts, and attaches to containers for a service. An optional variation can be provided in order to generate the custom \u003ccode\u003ecompose.yaml\u003c/code\u003e file and start the containers in the chosen mode.\n\n  \u003cbr/\u003e\n\n  When executed on the local host, it runs:\n  ```bash\n  docker compose up --detach\n  ```\n\n  \u003cbr/\u003e\n\n  In contrast, when executed on the remote host, it always pulls the latest images from the registry (Docker Hub):\n  ```bash\n  docker compose up --pull always --no-build --detach\n  ```\n\n  \u003cbr/\u003e\n  The following variations are supported:\n\n  - \u003ccode\u003eup:restore-mode\u003c/code\u003e used to restore a database backup that was generated in the past\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ebuild-up\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Builds all the images and starts the containers. An optional variation can be provided in order to generate the custom \u003ccode\u003ecompose.yaml\u003c/code\u003e file and start the containers in the chosen mode.\n\n  \u003cbr/\u003e\n\n  When executed on the local host, it runs:\n  ```bash\n  docker compose up --build --detach\n  ```\n\n  \u003cbr/\u003e\n\n  When executed on the remote host, it firstly removes all unused containers, networks and images (both dangling and unused).\n\n  ```bash\n  docker system prune --all --force\n  ```\n  \u003cbr/\u003e\n\n  Then, it restarts the Docker Service:\n\n  ```bash\n  systemctl restart docker\n  ```\n  \u003cbr/\u003e\n\n  Finally, it pulls the latest images from the registry (Docker Hub):\n  ```bash\n  docker compose up --pull always --no-build --detach\n  ```\n\n  \u003cbr/\u003e\n  The following variations are supported:\n\n  - \u003ccode\u003ebuild-up:restore-mode\u003c/code\u003e used to restore a database backup that was generated in the past\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eprune-build-push\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Removes all unused containers, networks and images (both dangling and unused).\n\n  ```bash\n  docker system prune --all --force\n  ```\n  \u003cbr/\u003e\n\n  Then, it builds all the images and pushes them to the registry (Docker Hub).\n\n  ```bash\n  docker compose build --push\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003edown\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Stops containers and removes containers, networks, volumes, and images created by \u003ccode\u003eup\u003c/code\u003e.\n\n  ```bash\n  docker compose down\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003edown-build-up\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Stops containers and removes containers, networks, volumes, and images created by \u003ccode\u003eup\u003c/code\u003e.\n\n  ```bash\n  docker compose down\n  ```\n\n  \u003cbr/\u003e\n\n  Afterwards, it builds, (re)creates, starts, and attaches to containers for a service. An optional variation can be provided in order to generate the custom \u003ccode\u003ecompose.yaml\u003c/code\u003e file and start the containers in the chosen mode.\n\n  When executed on the local host, it runs:\n  ```bash\n  docker compose up --detach\n  ```\n\n  In contrast, when executed on the remote host, it always pulls the latest images from the registry (Docker Hub):\n  ```bash\n  docker compose up --pull always --no-build --detach\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003erestart\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Restarts all stopped and running services.\n\n  ```bash\n  docker compose restart\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003elogs\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Displays log output from all services. If a variation is provided, it narrows down the logs to a specific service.\n\n  ```bash\n  docker compose logs -f\n\n  # if a variation is provided\n  docker compose logs \u003cvariation\u003e -f\n  ```\n\n  \u003cbr/\u003e\n\n  The following variations are supported:\n\n  - \u003ccode\u003elogs:postgres\u003c/code\u003e displays log output from the postgres service\n\n  - \u003ccode\u003elogs:api\u003c/code\u003e displays log output from the api service\n\n  - \u003ccode\u003elogs:gui\u003c/code\u003e displays log output from the gui service\n\n  - \u003ccode\u003elogs:ct\u003c/code\u003e displays log output from the cloudflared service\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eprune\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Removes all unused containers, networks and images (both dangling and unused).\n\n  ```bash\n  docker system prune --all --force\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\n\n\u003cbr/\u003e\n\n### Docker Compose Tests\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eup:test-mode\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Builds, (re)creates, starts, and attaches to containers for a service with \u003ccode\u003eTEST_MODE\u003c/code\u003e enabled (used to run unit, integration or benchmark tests locally):\n  \n  ```bash\n  docker compose up --detach\n  ```\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ebuild-up:test-mode\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Builds all the images and starts the containers with \u003ccode\u003eTEST_MODE\u003c/code\u003e enabled (used to run unit, integration or benchmark tests locally):\n\n  ```bash\n  docker compose up --build --detach\n  ```\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003edown\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Stops containers and removes containers, networks, volumes, and images created by \u003ccode\u003eup\u003c/code\u003e.\n\n  ```bash\n  docker compose down\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003edown-build-up:test-mode\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Stops containers and removes containers, networks, volumes, and images created by \u003ccode\u003eup\u003c/code\u003e.\n\n  ```bash\n  docker compose down\n  ```\n\n  \u003cbr/\u003e\n\n  Afterwards, it builds all the images and starts the containers with \u003ccode\u003eTEST_MODE\u003c/code\u003e enabled (used to run unit, integration or benchmark tests locally):\n\n  ```bash\n  docker compose up --build --detach\n  ```\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eapi-test:$type\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Runs the automated tests on the api service for the chosen variation.\n\n  ```bash\n  npm run test:\u003cvariation\u003e\n  ```\n\n  \u003cbr/\u003e\n  The following variations are supported:\n\n  - \u003ccode\u003eapi-test:integration\u003c/code\u003e runs the integration tests in the api service\n\n  - \u003ccode\u003eapi-test:unit\u003c/code\u003e runs the unit tests in the api service\n\n  - \u003ccode\u003eapi-test:bench\u003c/code\u003e runs the benchmarks in the api service\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\u003cbr/\u003e\n\n### CLI Management\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ebuild-cli\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Executes the script to generate a build of the CLI straight from the source code.\n\n  ```bash\n  npm run build\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ebuild-deploy-cli\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Deploys the CLI from its source in the local host to the remote host.\n\n  Firstly, it creates the root directory (if it doesn't already exist):\n\n  ```bash\n  ssh root@ip mkdir -p cli\n  ```\n\n  \u003cbr/\u003e\n\n  Then, it deploys the source code files and lastly, it installs the dependencies:\n\n  ```bash\n  ssh root@ip cd cli \u0026\u0026 npm ci --omit=dev\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\n\u003cbr/\u003e\n\n### Database Management\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003epsql\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Start the terminal-based front-end to PostgreSQL\n\n  ```bash\n  docker compose exec -it postgres psql -U postgres\n  ```\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ebackup-db\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n\n  Generates a database backup file, pulls it to the local host and performs a clean up once complete.\n\n  \u003cbr/\u003e\n\n  Firstly, it generates a backup file (\u003ccode\u003e$TIMESTAMP.dump\u003c/code\u003e) and places it in the \u003ccode\u003ebalancer_pgdata-management\u003c/code\u003e volume.\n\n  ```bash\n  docker compose exec postgres pg_dump -U postgres -f /var/lib/pgdata-management/$TIMESTAMP.dump -Fc\n  ```\n\n  \u003cbr/\u003e\n\n  Next, it pulls the backup file from the remote host to a specified destination directory in the localhost:\n\n  ```bash\n  scp root@ip:/var/lib/docker/volumes/balancer_pgdata-management/_data/$TIMESTAMP.dump /localhost/dest/dir\n  ```\n\n  \u003cbr/\u003e\n  \n  Finally, it cleans up the \u003ccode\u003ebalancer_pgdata-management\u003c/code\u003e volume:\n\n  ```bash\n  ssh root@ip rm -f /var/lib/docker/volumes/balancer_pgdata-management/_data/$TIMESTAMP.dump\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003erestore-db\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n  \n  Restores a chosen backup file after cleaning the current state of the database and performs a clean up once complete.\n\n  \u003cbr/\u003e\n\n  Firstly, it pushes the chosen backup file (\u003ccode\u003e$TIMESTAMP.dump\u003c/code\u003e) into the \u003ccode\u003ebalancer_pgdata-management\u003c/code\u003e volume.\n\n  ```bash\n  scp /localhost/src/$TIMESTAMP.dump root@ip:/var/lib/docker/volumes/balancer_pgdata-management/_data/$TIMESTAMP.dump\n  ```\n\n  \u003cbr/\u003e\n\n  Next, it restores the database by making use of the backup file:\n\n  ```bash\n  docker compose exec postgres pg_restore --clean --if-exists -U postgres -d postgres /var/lib/pgdata-management/$TIMESTAMP.dump\n  ```\n\n  \u003cbr/\u003e\n  \n  Finally, it cleans up the \u003ccode\u003ebalancer_pgdata-management\u003c/code\u003e volume:\n\n  ```bash\n  ssh root@ip rm -f /var/lib/docker/volumes/balancer_pgdata-management/_data/$TIMESTAMP.dump\n  ```\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\u003cbr/\u003e\n\n### Environment Variable Assets\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003egenerate-envvar-assets\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n  \n  Generates the environment variable assets based on a source file and places the results in a custom path.\n\n  \u003cbr/\u003e\n\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003edeploy-envvar-assets\u003c/code\u003e\u003c/summary\u003e\n  \u003cbr/\u003e\n  \n  Deploys the environment variable assets to the remote host from a custom source path.\n\n  **Note:** assets are generated by the \u003ccode\u003egenerate-envvar-assets\u003c/code\u003e action.\n\n  ```bash\n  scp -r ./assets/secrets root@ip:cli/secrets\n  scp ./assets/.env root@ip:cli/.env\n  # assets/\n  #     │\n  #     secrets/\n  #     │     └───...\n  #     .env\n  ```\n\n  \u003cbr/\u003e\n\u003c/details\u003e\n\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## Docker Images\n\n- [postgres](https://hub.docker.com/_/postgres)\n- [jesusgraterol/balancer-api](https://hub.docker.com/r/jesusgraterol/balancer-api)\n- [jesusgraterol/balancer-gui](https://hub.docker.com/r/jesusgraterol/balancer-gui)\n- [jesusgraterol/balancer-ct](https://hub.docker.com/r/jesusgraterol/balancer-ct)\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## Tests\n\n```bash\n# run the integration tests\nnpm run test:integration\n\n# run the unit tests\nnpm run test:unit\n\n# run the benchmarks\nnpm run test:bench\n```\n\n\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\n## License\n\n[Apache v2.0](https://www.apache.org/licenses/LICENSE-2.0)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoin-balancer%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoin-balancer%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoin-balancer%2Fcli/lists"}