Merge pull request #933 from stackernews/sndev-profiles

sndev profiles
This commit is contained in:
Keyan 2024-03-18 12:39:13 -05:00 committed by GitHub
commit 9a1de666fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 43 additions and 19 deletions

View File

@ -17,7 +17,7 @@
Launch a fully featured SN development environment in a single command.
```txt
```sh
$ ./sndev start
```
@ -38,13 +38,32 @@ Go to [localhost:3000](http://localhost:3000).
Start the development environment
```txt
```sh
$ ./sndev start
```
By default all services will be run. If you want to exclude specific services from running, set `COMPOSE_PROFILES` to use one or more of `minimal|images|search|payments`. To only run mininal services without images, search, or payments:
```sh
$ COMPOSE_PROFILES=minimal ./sndev start
```
Or, as I would recommend:
```sh
$ export COMPOSE_PROFILES=minimal
$ ./sndev start
```
To run with images and payments services:
```sh
$ COMPOSE_PROFILES=images,payments ./sndev start
```
View all available commands
```txt
```sh
$ ./sndev help
888

View File

@ -39,15 +39,6 @@ services:
db:
condition: service_healthy
restart: true
opensearch:
condition: service_healthy
restart: true
sn_lnd:
condition: service_healthy
restart: true
# s3:
# condition: service_healthy
# restart: true
env_file:
- .env.development
expose:
@ -73,12 +64,6 @@ services:
app:
condition: service_healthy
restart: true
opensearch:
condition: service_healthy
restart: true
sn_lnd:
condition: service_healthy
restart: true
env_file:
- .env.development
volumes:
@ -89,6 +74,8 @@ services:
imgproxy:
container_name: imgproxy
image: darthsim/imgproxy:v3.23.0
profiles:
- images
healthcheck:
test: [ "CMD", "imgproxy", "health" ]
interval: 10s
@ -114,6 +101,8 @@ services:
# retries: 10
# start_period: 1m
restart: unless-stopped
profiles:
- images
env_file:
- .env.development
environment:
@ -131,6 +120,8 @@ services:
opensearch:
image: opensearchproject/opensearch:2.12.0
container_name: opensearch
profiles:
- search
healthcheck:
test: ["CMD-SHELL", "curl -ku admin:${OPENSEARCH_INITIAL_ADMIN_PASSWORD} --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 10s
@ -171,6 +162,8 @@ services:
image: opensearchproject/opensearch-dashboards:2.12.0
container_name: os-dashboard
restart: unless-stopped
profiles:
- search
depends_on:
opensearch:
condition: service_healthy
@ -191,6 +184,8 @@ services:
image: polarlightning/bitcoind:26.0
container_name: bitcoin
restart: unless-stopped
profiles:
- payments
healthcheck:
test: ["CMD-SHELL", "bitcoin-cli -chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS} getblockchaininfo"]
interval: 10s
@ -248,6 +243,8 @@ services:
- LN_NODE_FOR=sn
container_name: sn_lnd
restart: unless-stopped
profiles:
- payments
healthcheck:
test: ["CMD-SHELL", "lncli", "getinfo"]
interval: 10s
@ -310,6 +307,8 @@ services:
- LN_NODE_FOR=stacker
container_name: stacker_lnd
restart: unless-stopped
profiles:
- payments
healthcheck:
test: ["CMD-SHELL", "lncli", "getinfo"]
interval: 10s
@ -368,6 +367,8 @@ services:
channdler:
image: mcuadros/ofelia:latest
container_name: channdler
profiles:
- payments
depends_on:
- bitcoin
- sn_lnd

6
sndev
View File

@ -9,7 +9,11 @@ docker__compose() {
exit 0
fi
CURRENT_UID=$(id -u) CURRENT_GID=$(id -g) command docker compose --env-file .env.development "$@"
if [ -z "$COMPOSE_PROFILES" ]; then
COMPOSE_PROFILES="images,search,payments"
fi
CURRENT_UID=$(id -u) CURRENT_GID=$(id -g) COMPOSE_PROFILES=$COMPOSE_PROFILES command docker compose --env-file .env.development "$@"
}
docker__exec() {