From 17894418d8d289f957d5eca716fd2189853876d5 Mon Sep 17 00:00:00 2001 From: galt-tr Date: Tue, 22 Mar 2022 23:12:07 -0400 Subject: [PATCH] Add docker compose file and instructions --- .gitignore | 3 ++ README.md | 16 ++++++ config/envs/docker-compose.json | 90 +++++++++++++++++++++++++++++++++ docker-compose.yml | 24 +++++++++ 4 files changed, 133 insertions(+) create mode 100644 config/envs/docker-compose.json create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 4165044d..6e39f221 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ dist # Code coverage coverage.txt + +# Development data dir +data/ diff --git a/README.md b/README.md index def40b7f..2cf65a15 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,22 @@ Checkout all the [examples](examples)!
+## Docker Compose Quickstart +To get started with development, `bux-server` provides a `docker-compose.yml` +file which starts up Bux Server with Redis and PostgreSQL. To start, we need to +tweak the `config/envs/development.json` file with the proper configuration. +First: +``` +$ cp config/envs/docker-compose.json config/envs/development.json +``` + +Then, we need to update the `admin_key` with your xpub. Modify +`config/envs/development.json` with your admin key. Now we can start the +containers: +``` +$ docker-compose up +``` + ## Contributing View the [contributing guidelines](.github/CONTRIBUTING.md) and follow the [code of conduct](.github/CODE_OF_CONDUCT.md). diff --git a/config/envs/docker-compose.json b/config/envs/docker-compose.json new file mode 100644 index 00000000..025ec7c6 --- /dev/null +++ b/config/envs/docker-compose.json @@ -0,0 +1,90 @@ +{ + "debug": true, + "debug_profiling": false, + "disable_itc": false, + "environment": "development", + "gdpr_compliance": false, + "authentication": { + "admin_key": "1234567", + "require_signing": false, + "scheme": "xpub", + "signing_disabled": false + }, + "cache": { + "engine": "redis" + }, + "datastore": { + "auto_migrate": true, + "engine": "postgresql", + "debug": true, + "table_prefix": "bux" + }, + "graphql": { + "debug": true, + "enabled": true, + "server_path": "/graphql", + "playground_path": "/graphiql", + "require_signing": false + }, + "mongodb": { + "database_name": "bux", + "transactions": false, + "uri": "mongodb://localhost:27017/bux" + }, + "new_relic": { + "domain_name": "domain.com", + "enabled": false, + "license_key": "BOGUS-LICENSE-KEY-1234567890987654321234" + }, + "paymail": { + "enabled": true, + "default_from_paymail": "from@domain.com", + "default_note": "bux Address Resolution", + "domains": [ + "localhost" + ], + "sender_validation_enabled": false + }, + "redis": { + "dependency_mode": true, + "max_active_connections": 0, + "max_connection_lifetime": "60s", + "max_idle_connections": 10, + "max_idle_timeout": "10s", + "url": "redis://redis:6379", + "use_tls": false + }, + "ristretto": { + "buffer_items": 64, + "ignore_internal_cost": false, + "max_cost": 1073741824, + "metrics": false, + "num_counters": 1e7 + }, + "server": { + "idle_timeout": "60s", + "port": "3003", + "read_timeout": "15s", + "write_timeout": "15s" + }, + "sql": { + "host": "db", + "name": "bux", + "password": "postgres", + "port": "5432", + "replica": false, + "skip_initialize_with_version": true, + "time_zone": "UTC", + "tx_timeout": "10s", + "user": "bux" + }, + "sqlite": { + "database_path": "", + "shared": true + }, + "task_manager": { + "engine": "taskq", + "factory": "memory", + "queue_name": "development_queue" + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..4a463641 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3.9" +services: + server: + build: . + environment: + - BUX_ENVIRONMENT=development + ports: + - "3003:30003" + volumes: + - ./config:/config:Z + links: + - redis + - db + redis: + image: redis + db: + image: postgres + volumes: + - ./data/db:/var/lib/postgresql/data:Z + environment: + - POSTGRES_NAME=bux + - POSTGRES_USER=bux + - POSTGRES_PASSWORD=postgres +