From c75251fc26b63194fed85476869cc0428ca873b7 Mon Sep 17 00:00:00 2001 From: Carl Sinclair Date: Sat, 24 Aug 2024 12:31:21 -0300 Subject: [PATCH 1/2] One-domain-mode instructions for manual deployment --- deployment/manual.md | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/deployment/manual.md b/deployment/manual.md index 57499e8..425428c 100644 --- a/deployment/manual.md +++ b/deployment/manual.md @@ -30,6 +30,8 @@ sudo apt install libsecp256k1-dev > Or the equivalent for your os package manager +Some systems may require creating a symlink between your libsecp256k1 installation path and the location that Bitcart looks for it in. You can discover that location from the failure logs. + More info on libsecp256k1 in [electrum docs](https://github.com/spesmilo/electrum-docs/blob/master/libsecp256k1-linux.rst) or [bitcoin core docs](https://github.com/bitcoin-core/secp256k1#build-steps) ### 2) Install Python 3 @@ -114,6 +116,10 @@ BITCART_CRYPTOS=btc,ltc EOF ``` +Other coins may require additional environmental variables in `conf/.env`, like `XMR_NETWORK` and `XMR_SERVER`. + +Note that if you're running redis on a custom port, you need to set that custom port in the configuration file as well, like this: `REDIS_HOST=redis://localhost:1234` + Apply database migrations: ```bash @@ -288,6 +294,64 @@ Continue with: [Your first invoice](../your-first-invoice/) If you want the procaesses: bitcart api, daemons, worker and frontend (bitcart admin and bitcart store) to be managed with automatic startup, error reporting etc then consider using [supervisord](http://supervisord.org/) or [systemd](https://systemd.io/) to manage the processes. +Here's an example of a systemd service: + +``` +[Unit] +Description=Bitcart Core and Services +After=network.target +After=redis.service + +[Service] +Type=simple +User=bitcart +WorkingDirectory=/path/to/bitcart +EnvironmentFile=/path/to/bitcart/conf/.env +Environment=XDG_CACHE_HOME=/home/bitcart/.cache +Environment=NPM_CONFIG_CACHE=/home/bitcart/.npm +ExecStart=/bin/bash -c 'python3 daemons/btc.py >> /var/log/bitcart/bitcart.log 2>&1 & \ + python3 daemons/xmr.py >> /var/log/bitcart/bitcart.log 2>&1 & \ + gunicorn -c gunicorn.conf.py main:app >> /var/log/bitcart/bitcart.log 2>&1 & \ + python3 worker.py >> /var/log/bitcart/bitcart.log 2>&1 & \ + cd bitcart-admin && yarn start >> /var/log/bitcart/bitcart.log 2>&1 & \ + cd bitcart-store && NUXT_PORT=4141 yarn start >> /var/log/bitcart/bitcart.log 2>&1' +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +Make sure to also create a user called bitcart (or update the `User` attribute to whatever user you're having bitcart run as). Then run `chown bitcart:bitcart /path/to/bitcart -R` to ensure the user owns all the files it needs to have permission over. + +## (Optional) One-domain-mode + +Note that the [one-domain-mode](one-domain-mode.md) instructions only work with a Docker installation. In order to achieve the same effect on a manual deployment, you need to add the following environmental variables to your `conf/.env` file: + +``` +BITCART_HOST=sub.domain.com +BITCART_ADMIN_HOST=sub.domain.com/admin +BITCART_ADMIN_ROOTPATH=/admin +BITCART_BACKEND_ROOTPATH=/api +BITCART_ADMIN_API_URL=https://sub.domain.com/api +BITCART_ADMIN_URL=https://sub.doain.com/admin +BITCART_STORE_HOST=sub.domain.com +BITCART_STORE_URL=https://sub.domain.com +``` + +And update your web server to handle the routes correctly, like this: + +``` + location /admin { + proxy_pass http://localhost:4000; + } + location /api { + proxy_pass http://localhost:8000; + } + location / { + proxy_pass http://localhost:3000; + } +``` + ## Upgrading manual deployment Note: it is recommended to use docker deployment for easy upgrades. From f954c8ad08c343be780426a6d9a2e17ec203a069 Mon Sep 17 00:00:00 2001 From: Carl Sinclair Date: Sat, 24 Aug 2024 12:34:30 -0300 Subject: [PATCH 2/2] One-domain-mode for manual deployment --- guides/one-domain-mode.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/guides/one-domain-mode.md b/guides/one-domain-mode.md index 9dae8d4..679ef10 100644 --- a/guides/one-domain-mode.md +++ b/guides/one-domain-mode.md @@ -1,5 +1,8 @@ # One domain mode +### Note that the following instructions only work with a Docker installation. In order to achieve the same effect on a [manual deployment](manual.md#optional-one-domain-mode), click the link and follow the instructions. +--- + One domain mode is an opt-out feature, enabled by default, which simplifies the configuration of domains.One domain mode allows running all Bitcart services under one domain. If you are deploying a new instance from the Bitcart Configurator, it is the default mode enabled.