Skip to content

Commit

Permalink
feat(BUX-516): add possibility to run pulse in start.sh script.
Browse files Browse the repository at this point in the history
  • Loading branch information
dorzepowski committed Jan 30, 2024
1 parent 9e4d40b commit 9a2e6b7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Ports which are used:
- 3003 - Bux server
- 5432 - PostgreSQL db
- 6379 - Redis
- 8080 - Bux wallet backend
- 8080 - Pulse
- 8081 - Bux wallet backend
- 27017 - MongoDB

There are three ways of running this script:
Expand Down
18 changes: 15 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ services:
env_file:
- .env.config
ports:
- "8080:8080"
- "8081:8080"
links:
- bux-postgresql
depends_on:
bux-postgresql:
condition: service_healthy

pulse:
image: bsvb/pulse:latest
pull_policy: always
command:
- "--preloaded"
ports:
- "8080:8080"
volumes:
- pulse-data:/app/data

bux-server:
image: buxorg/bux-server:latest
pull_policy: always
Expand All @@ -37,7 +47,7 @@ services:
- .env.config
ports:
- "3003:3003"
restart: on-failure:5
restart: always

bux-redis:
image: redis
Expand Down Expand Up @@ -88,11 +98,13 @@ volumes:
driver: local
bux-mongodb-data:
driver: local
pulse-data:
driver: local

configs:
frontend-env-config:
content: |
{
"paymailDomain": "${RUN_PAYMAIL_DOMAIN}",
"apiUrl": "http://localhost:8080"
"apiUrl": "http://localhost:8081"
}
21 changes: 21 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ while [[ $# -gt 0 ]]; do
bux_server="$2"
shift
;;
-pl|--pulse)
pulse="$2"
shift
;;
-bwf|--bux-wallet-frontend)
bux_wallet_frontend="$2"
shift
Expand Down Expand Up @@ -304,6 +308,7 @@ if [ "$load_config" == "true" ]; then
load_from 'BUX_DB_DATASTORE_ENGINE' database
load_from 'BUX_CACHE_ENGINE' cache
load_from 'RUN_BUX_SERVER' bux_server
load_from 'RUN_PULSE' pulse
load_from 'RUN_BUX_WALLET_FRONTEND' bux_wallet_frontend
load_from 'RUN_BUX_WALLET_BACKEND' bux_wallet_backend
load_from 'RUN_PAYMAIL_DOMAIN' paymail_domain
Expand Down Expand Up @@ -353,6 +358,12 @@ if [ "$bux_server" == "" ]; then
print_debug "bux_server: $bux_server"
fi

if [ "$pulse" == "" ]; then
ask_for_yes_or_no "Do you want to run Pulse?"
pulse="$choice"
print_debug "pulse: $pulse"
fi

if [ "$bux_wallet_frontend" == "" ]; then
ask_for_yes_or_no "Do you want to run bux-wallet-frontend?"
bux_wallet_frontend="$choice"
Expand Down Expand Up @@ -405,6 +416,7 @@ echo "# Used by start.sh. All unknown variables will be removed after running th
save_to 'BUX_DB_DATASTORE_ENGINE' database
save_to 'BUX_CACHE_ENGINE' cache
save_to 'RUN_BUX_SERVER' bux_server
save_to 'RUN_PULSE' pulse
save_to 'RUN_PAYMAIL_DOMAIN' paymail_domain
save_to 'RUN_BUX_WALLET_FRONTEND' bux_wallet_frontend
save_to 'RUN_BUX_WALLET_BACKEND' bux_wallet_backend
Expand Down Expand Up @@ -438,6 +450,11 @@ if [ "$bux_wallet_backend" == "true" ]; then
save_value 'DB_HOST' "bux-postgresql"
fi

if [ "$pulse" == "true" ]; then
save_value 'BUX_PAYMAIL_BEEF_PULSE_URL' "http://pulse:8080/api/v1/chain/merkleroot/verify"
else
save_value 'BUX_PAYMAIL_BEEF_PULSE_URL' "http://host.docker.internal:8080/api/v1/chain/merkleroot/verify"
fi
print_debug "Exporting RUN_PAYMAIL_DOMAIN environment variable"
export RUN_PAYMAIL_DOMAIN="$paymail_domain"

Expand Down Expand Up @@ -469,6 +486,10 @@ if [ "$bux_server" == "true" ]; then
servicesToRun+=("bux-server")
fi

if [ "$pulse" == "true" ]; then
servicesToRun+=("pulse")
fi

if [ "$bux_wallet_backend" == "true" ]; then
servicesToRun+=("bux-wallet-backend")
servicesToRun+=("bux-postgresql")
Expand Down

0 comments on commit 9a2e6b7

Please sign in to comment.