Skip to content

Commit

Permalink
Merge pull request #437 from BuxOrg/feat/bux-516-change-starting-script
Browse files Browse the repository at this point in the history
feat(BUX-516): add possibility to run Pulse; use the same script as in bux-wallet-frontend.
  • Loading branch information
dorzepowski authored Feb 1, 2024
2 parents 9838f7a + 5b9d236 commit b3848f8
Show file tree
Hide file tree
Showing 4 changed files with 580 additions and 319 deletions.
29 changes: 4 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ make bench

### Docker Compose Quickstart

To get started with development, `bux-server` provides a `start-bux-server.sh` script
To get started with development, `bux-server` provides a `start.sh` script
which is using `docker-compose.yml` file to starts up Bux Server with selected database
and cache storage. To start, we need to fill the config json which we want to use,
for example: `config/envs/development.json`.
Expand All @@ -291,38 +291,17 @@ There are two way of running this script:
1. with manual configuration - Every option is displayed in terminal and user can choose
which database/cache storage use and configure how to run bux-server.
```bash
./start-bux-server.sh
./start.sh
```
2. with flags which define how to set up docker services. Ever option is displayed when
you ran the script with flag `-h` or `--help`. Possible options:

```bash
./start-bux-server.sh --help

Welcome in Bux Server!
Usage: ./start-bux-server.sh [OPTIONS]

This script helps you to run Bux server with your preferred database and cache storage.

Options:

-db, --database Define database - postgresql, mongodb, sqlite
-c, --cache Define cache storage - freecache(in-memory), redis
-bs, --bux-server Whether the bux-server should be run - true/false
-env, --environment Define bux-server environment - development/staging/production
-b, --background Whether the bux-server should be run in background - true/false
-x, --xpub Define admin xPub
-l, --load Load .env.config file and run bux-server with its settings
-rb --rebuild Rebuild docker images before running
```

```bash
./start-bux-server.sh -db postgresql -c redis -bs true -env development -b false
./start.sh -db postgresql -c redis -bs true -env development -b false
```

`-l/--load` option add possibility to use previously created `.env.config` file and run bux-server with simple command:
```bash
./start-bux-server.sh -l
./start.sh -l
```
<br/>

Expand Down
86 changes: 64 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
# !NOTE: This file should be used only by start-bux-server.sh
version: "3.9"

##########################################################
### !NOTE: This file is meant to be used by start.sh! ###
########################################################
services:
bux-wallet-frontend:
image: bsvb/bux-wallet-frontend:latest
pull_policy: always
ports:
- "3002:80"
configs:
- source: frontend-env-config
target: /usr/share/nginx/html/env-config.json

bux-wallet-backend:
image: bsvb/bux-wallet-backend:latest
pull_policy: always
environment:
BUX_PAYMAIL_DOMAIN: '${RUN_PAYMAIL_DOMAIN}'
HTTP_SERVER_CORS_ALLOWEDDOMAINS: 'http://localhost:3002'
env_file:
- .env.config
ports:
- "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:
build: .
environment:
BUX_PAYMAIL_DOMAINS: '${RUN_PAYMAIL_DOMAIN}'
env_file:
- .env.config
ports:
- "3003:3003"
restart: unless-stopped

bux-redis:
image: redis
container_name: bux-redis
hostname: redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
- bux-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]

bux-postgresql:
image: postgres
container_name: bux-postgresql
volumes:
- db-data:/var/lib/postgresql/data:Z
- bux-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_NAME=postgres
- POSTGRES_USER=postgres
Expand All @@ -31,36 +74,35 @@ services:

bux-mongodb:
image: mongo
container_name: bux-mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: mongo
MONGO_INITDB_ROOT_PASSWORD: mongo
MONGO_INITDB_DATABASE: xapi
ports:
- '27017:27017'
volumes:
- db-data:/data/db
- bux-mongodb-data:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh mongodb:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
start_period: 40s

bux-server:
build: .
container_name: bux-server
env_file:
- .env.config
ports:
- "3003:3003"
volumes:
- ./config:/config:Z

volumes:
app-data:
bux-postgresql-data:
driver: local
bux-redis-data:
driver: local
db-data:
bux-mongodb-data:
driver: local
redis-data:
pulse-data:
driver: local

configs:
frontend-env-config:
content: |
{
"paymailDomain": "${RUN_PAYMAIL_DOMAIN}",
"apiUrl": "http://localhost:8081"
}
Loading

0 comments on commit b3848f8

Please sign in to comment.