Multiple deployments on one server
BitcartCC supports multiple deployments on one server.
Note that it is an advanced topic, and use it only if you know what you are doing.
When setting up multiple deployments on the same server, the services that export their ports to outside can't be run twice.
It means that you will need to set up nginx reverse proxy manually, and disable nginx in each of the deployments.
When disabling nginx, all the services will expose ports to outside, to be able to use them from nginx installed globally on the server.
To run multiple deployments, pass the deployment name via --name argument. The default deployment name is compose.
1
./setup.sh --name demo
2
./setup.sh --name test
3
./setup.sh --name production
Copied!
Note that you should use different clones of the bitcart-docker for each deployment, as the setup script creates .env file with all your settings, and .deploy file with configuration name, and if you run different deployments in the same directory the configuration files will be overwritten.
Do it like so:
1
git clone https://github.com/bitcartcc/bitcart-docker
2
cd bitcart-docker
3
# export settings
4
./setup.sh
5
cd ..
6
git clone https://github.com/bitcartcc/bitcart-docker bitcart-demo
7
cd bitcart-demo
8
# export settings
9
./setup.sh --name demo
10
cd ..
11
# do the same process for each deployment
Copied!
To disable reverse proxy, run:
1
export BITCART_REVERSEPROXY=none
Copied!
Note that when running multiple deployments, the Merchants API, the admin and the store will have the same ports. You need to change that.
To change ports, run export BITCART_SERVICE_PORT=port
Where SERVICE is the component name, and port is the port, for example:
1
export BITCART_BACKEND_PORT=8001 # set merchants API port to 8001
2
export BITCART_ADMIN_PORT=4001 # admin panel at port 4001
3
export BITCART_STORE_PORT=3001 # store at port 3001
Copied!
You should configure nginx yourself. The only recommendation is: it is easy to configure nginx via certbot.
Instead of disabling nginx, you may also leave it running at different ports, see this guide.
Run:
1
sudo certbot --nginx -d your.domain.tld
Copied!
And it will create nginx config records for you, and then edit the location / config, by using proxy_pass http://localhost:port
Note: when using multiple deployments on one server, environment variables may be loaded incorrectly on login (due to same environment variable names).
To ensure that you have loaded the correct environment for your deployment, in your deployment directory, run:
1
./load_env.sh
Copied!
It will load the correct settings.
Last modified 8mo ago
Copy link