Skip to content

Commit

Permalink
Add missing documentation to README
Browse files Browse the repository at this point in the history
  • Loading branch information
amarouane-ABDELHAK committed Aug 29, 2024
1 parent 8000675 commit 50b8600
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


.PHONY:
clean
all
Expand All @@ -8,29 +6,25 @@

list:
$(MAKE) -C sm2a list


all:
$(MAKE) -C sm2a all


sm2a-local-run:
$(MAKE) -C sm2a sm2a-local-run

sm2a-local-init:
$(MAKE) -C sm2a sm2a-local-init


sm2a-local-stop:
$(MAKE) -C sm2a sm2a-local-stop



sm2a-deploy:
$(MAKE) -C sm2a sm2a-deploy

sm2a-local-build:
$(MAKE) -C sm2a sm2a-local-build

clean:
$(MAKE) -C sm2a clean

Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ See [getting-started-install](https://docs.aws.amazon.com/cli/latest/userguide/g


### Setup a local SM2A development environment
1. Build services
```shell
make sm2a-local-build
```

1. Initialize the metadata db
2. Initialize the metadata db

```shell
make sm2a-local-init
Expand All @@ -50,14 +54,14 @@ which will require you to reinitialize SM2A with `make sm2a-local-init`

This will create an airflow username: `airflow` with password `airflow`

2. Start all services
3. Start all services

```shell
make sm2a-local-run
```
This will start SM2A services and will be running on http://localhost:8080

3. Stop all services
4. Stop all services

```shell
make sm2a-local-stop
Expand Down
11 changes: 3 additions & 8 deletions sm2a/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
SECRET_NAME=""
ENV_FILE=".env"


important_message = \
@echo "\033[0;31m$(1) \033[0m"

info_message = \
@echo "\033[0;32m$(1) \033[0m"


count_down = \
@echo "Spinning up the system please wait..."; \
secs=40 ;\
Expand All @@ -18,17 +16,13 @@ count_down = \
: $$((secs--)); \
done;


.PHONY:
clean
all
list



all: sm2a-local-init sm2a-local-run


sm2a-local-run: sm2a-local-stop
@echo "Running SM2A"
docker compose up -d
Expand All @@ -40,13 +34,14 @@ sm2a-local-run: sm2a-local-stop

sm2a-local-init:
cp sm2a-local-config/env_example sm2a-local-config/.env
cp -r ../dags .
docker compose run --rm airflow-cli db init
docker compose run --rm airflow-cli users create --email airflow@example.com --firstname airflow --lastname airflow --password airflow --username airflow --role Admin
rm -rf dags

sm2a-local-stop:
docker compose down


sm2a-local-build:
cp -r ../dags .
docker compose build
Expand All @@ -68,4 +63,4 @@ clean: sm2a-local-stop
docker volume prune -f

list:
@grep '^[^#[:space:]].*:' Makefile
@grep '^[^#[:space:]].*:' Makefile
33 changes: 25 additions & 8 deletions sm2a/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,34 @@ This project uses Terraform modules to deploy Apache Airflow and related AWS res
- [gitflow.yml](./.github/workflows/gitflow.yml) provides a structured way to manage the development, testing, and deployment of terraform modules. For more info refer to [gitflow](https://github.com/NASA-IMPACT/csda-data-pipelines/blob/dev/GITFLOW.md)


### Setup a local SM2A development environment
1. Build services
```shell
make sm2a-local-build
```

### Deployment via local machine
You can deploy SM2A from your local machine by running:
```bash
$python scripts/generate_env_file.py --secret-id $AWS_SECRET_NAME --env-file .env
2. Initialize the metadata db

```shell
make sm2a-local-init
```
Assuming you have access to [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) where the deployment variables are stored.
🚨 NOTE: This command is typically required only once at the beginning.
After running it, you generally do not need to run it again unless you run `make clean`,
which will require you to reinitialize SM2A with `make sm2a-local-init`

```bash
./scripts/deploy.sh .env <<< init
./scripts/deploy.sh .env <<< deploy
This will create an airflow username: `airflow` with password `airflow`

3. Start all services

```shell
make sm2a-local-run
```
This will start SM2A services and will be running on http://localhost:8080

4. Stop all services

```shell
make sm2a-local-stop
```

### Login to UI
Expand Down

0 comments on commit 50b8600

Please sign in to comment.