diff --git a/README.md b/README.md index cee1ac4..2eb340e 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,15 @@ Open the `tyk_analytics.env` file in the `confs/` folder and add your license st Run docker compose: +With a `Mongo` database: ``` -$ docker-compose -f ./docker-compose.yml -f ./docker-compose.`database_type`.yml up +$ docker-compose up ``` -`database_type`: can be `mongo` or `postgres` +With a `PostgreSQL` database: +``` +$ docker-compose -f ./docker-compose.yml -f ./docker-compose.postgres.yml up +``` Please note that this command may take a while to complete, as Docker needs to download and provision all of the containers. @@ -28,9 +32,16 @@ Bootstrap the instance: Open your browser to http://localhost:3000. You will be presented with the Bootstrap UI to create your first organisation and admin user. -## Bringing down +## Tear down To delete all containers as well as remove all volumes from your host: + +Mongo: +``` +$ docker-compose down -v +``` + +PostgreSQL: ``` -$ docker-compose -f ./docker-compose.yml -f ./docker-compose.`database_type`.yml down -v +$ docker-compose -f ./docker-compose.yml -f ./docker-compose.postgres.yml down -v ``` \ No newline at end of file diff --git a/confs/pump.mongo.env b/confs/pump.mongo.env index 680b3fe..b423a13 100644 --- a/confs/pump.mongo.env +++ b/confs/pump.mongo.env @@ -1,12 +1,12 @@ -TYK_PMP_PUMPS_MONGO_TYPE=mongo -TYK_PMP_PUMPS_MONGO_META_COLLECTIONNAME=tyk_analytics -TYK_PMP_PUMPS_MONGO_META_MONGOURL=mongodb://tyk-mongo:27017/tyk_analytics -TYK_PMP_PUMPS_MONGO_META_MAXINSERTBATCHSIZEBYTES=80000 -TYK_PMP_PUMPS_MONGO_META_MAXDOCUMENTSIZEBYTES=20112 +TYK_PMP_PUMPS_MAIN_TYPE=mongo +TYK_PMP_PUMPS_MAIN_META_COLLECTIONNAME=tyk_analytics +TYK_PMP_PUMPS_MAIN_META_MONGOURL=mongodb://tyk-mongo:27017/tyk_analytics +TYK_PMP_PUMPS_MAIN_META_MAXINSERTBATCHSIZEBYTES=80000 +TYK_PMP_PUMPS_MAIN_META_MAXDOCUMENTSIZEBYTES=20112 -TYK_PMP_PUMPS_MONGOAGG_TYPE=mongo-pump-aggregate -TYK_PMP_PUMPS_MONGOAGG_META_MONGOURL=mongodb://tyk-mongo:27017/tyk_analytics -TYK_PMP_PUMPS_MONGOAGG_META_USEMIXEDCOLLECTION=true +TYK_PMP_PUMPS_MAINAGG_TYPE=mongo-pump-aggregate +TYK_PMP_PUMPS_MAINAGG_META_MONGOURL=mongodb://tyk-mongo:27017/tyk_analytics +TYK_PMP_PUMPS_MAINAGG_META_USEMIXEDCOLLECTION=true TYK_PMP_UPTIMEPUMPCONFIG_COLLECTIONNAME=tyk_uptime_analytics TYK_PMP_UPTIMEPUMPCONFIG_MONGOURL=mongodb://tyk-mongo:27017/tyk_analytics diff --git a/confs/pump.postgres.env b/confs/pump.postgres.env index 617291b..6b5c63b 100644 --- a/confs/pump.postgres.env +++ b/confs/pump.postgres.env @@ -1,11 +1,11 @@ -TYK_PMP_UPTIMEPUMPCONFIG_UPTIMETYPE=sql -TYK_PMP_UPTIMEPUMPCONFIG_TYPE=postgres -TYK_PMP_UPTIMEPUMPCONFIG_CONNECTIONSTRING=user=default password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics +TYK_PMP_PUMPS_MAIN_TYPE=SQL +TYK_PMP_PUMPS_MAIN_META_TYPE=postgres +TYK_PMP_PUMPS_MAIN_META_CONNECTIONSTRING=user=default password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics -TYK_PMP_PUMPS_SQL_TYPE=SQL -TYK_PMP_PUMPS_SQL_META_TYPE=postgres -TYK_PMP_PUMPS_SQL_META_CONNECTIONSTRING=user=default password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics +TYK_PMP_PUMPS_MAINAGG_TYPE=SQL +TYK_PMP_PUMPS_MAINAGG_META_TYPE=postgres +TYK_PMP_PUMPS_MAINAGG_META_CONNECTIONSTRING=user=default password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics -TYK_PMP_PUMPS_SQLAGGREGATE_TYPE=SQL -TYK_PMP_PUMPS_SQLAGGREGATE_META_TYPE=postgres -TYK_PMP_PUMPS_SQLAGGREGATE_META_CONNECTIONSTRING=user=default password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics +TYK_PMP_UPTIMEPUMPCONFIG_UPTIMETYPE=sql +TYK_PMP_UPTIMEPUMPCONFIG_TYPE=postgres +TYK_PMP_UPTIMEPUMPCONFIG_CONNECTIONSTRING=user=default password=topsecretpassword host=tyk-postgres port=5432 database=tyk_analytics \ No newline at end of file diff --git a/docker-compose.mongo.yml b/docker-compose.mongo.yml deleted file mode 100644 index 7cfa735..0000000 --- a/docker-compose.mongo.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3.9' -services: - tyk-dashboard: - environment: - - TYK_DB_STORAGE_MAIN_TYPE=mongo - - TYK_DB_STORAGE_MAIN_CONNECTIONSTRING=mongodb://tyk-mongo:27017/tyk_analytics - - tyk-pump: - env_file: - - ./confs/pump.mongo.env - - tyk-mongo: - image: mongo:4.0 - container_name: tyk-mongo - - command: ["mongod", "--smallfiles"] - ports: - - "27017:27017" - - volumes: - - mongo-data:/data/db - - networks: - - tyk - -volumes: - mongo-data: diff --git a/docker-compose.postgres.yml b/docker-compose.postgres.yml index 920cbf8..d2273ac 100644 --- a/docker-compose.postgres.yml +++ b/docker-compose.postgres.yml @@ -22,10 +22,11 @@ services: - "5432:5432" volumes: - - postgres-data:/data/db + - db-data:/data/db networks: - tyk - -volumes: - postgres-data: + + tyk-mongo: + entrypoint: ["echo", "Docker Mongo service disabled. Using Postgres service instead.", ""] + command: [] diff --git a/docker-compose.yml b/docker-compose.yml index bbffd7f..ce80052 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,9 @@ services: tyk-dashboard: image: tykio/tyk-dashboard:v4.0.0 container_name: tyk-dashboard + environment: + - TYK_DB_STORAGE_MAIN_TYPE=mongo + - TYK_DB_STORAGE_MAIN_CONNECTIONSTRING=mongodb://tyk-mongo:27017/tyk_analytics ports: - "3000:3000" env_file: @@ -25,6 +28,7 @@ services: container_name: tyk-pump env_file: - ./confs/pump.env + - ./confs/pump.mongo.env networks: - tyk @@ -37,9 +41,24 @@ services: - redis-data:/data networks: - tyk + + tyk-mongo: + image: mongo:4.0 + container_name: tyk-mongo + + command: ["mongod", "--smallfiles"] + ports: + - "27017:27017" + + volumes: + - db-data:/data/db + + networks: + - tyk volumes: redis-data: + db-data: networks: tyk: \ No newline at end of file