From 5c04b735cef89da1024810ecfdf77a0f5d0a554e Mon Sep 17 00:00:00 2001 From: William Calderipe Date: Fri, 5 Jan 2024 11:36:00 +0100 Subject: [PATCH] Add setup make target The goal is to have one command to get everything ready to run. --- Makefile | 16 ++++++++++++++++ README.md | 10 ++++++++++ apps/authz-node/Makefile | 3 +++ apps/orchestration/Makefile | 5 +++++ 4 files changed, 34 insertions(+) diff --git a/Makefile b/Makefile index e7bf3d6bd..50071413a 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,25 @@ include ./apps/orchestration/Makefile include ./apps/authz-node/Makefile +# For more terminal color codes, head over to https://opensource.com/article/19/9/linux-terminal-colors +TERM_NO_COLOR := \033[0m +TERM_GREEN := \033[0;32m + +install: + npm install + install/ci: npm ci +setup: + make install + make docker/up + make orchestration/setup + make authz/setup + @echo "" + @echo "${TERM_GREEN}Orchestration & AuthZ applications are ready 🐋${TERM_NO_COLOR}" + @echo "${TERM_GREEN}Run 'make orchestration/start/dev' or/and 'make authz/start/dev' to get them running.${TERM_NO_COLOR}" + docker/stop: docker-compose stop diff --git a/README.md b/README.md index 3041e0296..eb304ab45 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,16 @@ TBD +## Getting started + +To setup the project, run the following command: + +```bash +make setup +``` + +At the end, you must have a working environment ready to run any application. + ## Application - [AuthZ](./apps/authz-node/README.md) diff --git a/apps/authz-node/Makefile b/apps/authz-node/Makefile index 390169572..f36f9fe7d 100644 --- a/apps/authz-node/Makefile +++ b/apps/authz-node/Makefile @@ -1,6 +1,9 @@ AUTHZ_PROJECT_NAME := apps/authz-node AUTHZ_PROJECT_DIR := ./apps/authz-node +authz/setup: + make authz/copy-default-env + authz/start/dev: npx nx serve ${AUTHZ_PROJECT_NAME} diff --git a/apps/orchestration/Makefile b/apps/orchestration/Makefile index e7ea89898..4ace449fe 100644 --- a/apps/orchestration/Makefile +++ b/apps/orchestration/Makefile @@ -5,6 +5,11 @@ ORCHESTRATION_DATABASE_SCHEMA := ${ORCHESTRATION_PROJECT_DIR}/src/persistence/sc orchestration/start/dev: npx nx serve ${ORCHESTRATION_PROJECT_NAME} +orchestration/setup: + make orchestration/copy-default-env + make orchestration/db/migrate + make orchestration/test/db/setup + orchestration/copy-default-env: cp ${ORCHESTRATION_PROJECT_DIR}/.env.default ${ORCHESTRATION_PROJECT_DIR}/.env cp ${ORCHESTRATION_PROJECT_DIR}/.env.test.default ${ORCHESTRATION_PROJECT_DIR}/.env.test