Skip to content
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ __pycache__
.vscode
# The build folder for sam
.aws-sam
.venv
.venv
env.json
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,39 @@ npm install react react-dom react-router-dom
npm install bootstrap
npm install -D @vitejs/plugin-react
```
4. Launch the API, navigate to the API repo and run the following commands
4. Add a env.json to add all credentials necessary
```
sam build
sam local start-api
{
"ApiFunction": {
"ENVIRONMENT": "local", #specify local if working in local
"OPENSEARCH_HOST": "opensearch-node1",
"OPENSEARCH_PORT": "9200",
"OPENSEARCH_INITIAL_ADMIN_PASSWORD": "<password>",
"POSTGRES_HOST": "db",
"POSTGRES_PORT": "5432",
"POSTGRES_DB": "postgres",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "password",
"DB_SECRET_NAME": "mirrulationsdb/postgres/master",
"OS_SECRET_NAME": "mirrulationsdb/opensearch/master"
}
}
```
5. Install the [Data-Product-Kit Repo](https://github.com/mirrulations/Data-Product-Kit) to set up the docker. Follow the `ReadMe.md` up to setting up the installations necessary.`LocalTesting.md` instructions. Start with section **"Clean Reset"** and then move on to the top of the document.


6. Launch the API, navigate to the API repo and run the following commands
```
sam build && sam local start-api --env-vars env.json --docker-network shared_network
```
**Note:** Make sure that you have the env.json in the root directory as sam would need to pick up the environment variables!

If you make changes to template.yaml, run sam validate to check for errors and sam build to implement the changes.

Take note of your api gateway link for later, you can see it in the output under “Mounting ApiFunction at {GATEWAY_URL_HERE} [GET, OPTIONS]”


5. Launch the Website
7. Launch the Website
- Create a file named “.env”
- Type “VITE_GATEWAY_API_URL={GATEWAY_URL}”
- Your Gateway URL is the output from the last step, it might look something like “http://127.0.0.1:3000/dummy”
Expand Down
1 change: 0 additions & 1 deletion samconfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ region = "us-east-1"
confirm_changeset = true # Example: Ensure manual review of changesets in prod
capabilities = "CAPABILITY_IAM"
disable_rollback = false # Example: Automatically rollback on failure to ensure stability

13 changes: 11 additions & 2 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ Resources:
Resource: "arn:aws:secretsmanager:us-east-1:936771282063:secret:mirrulationsdb/opensearch/master-7xJt7C"
Environment:
Variables:
DB_SECRET_NAME: "mirrulationsdb/postgres/master"
OS_SECRET_NAME: "mirrulationsdb/opensearch/master"
ENVIRONMENT: ""
DB_SECRET_NAME: ""
OS_SECRET_NAME: ""
OPENSEARCH_HOST: ""
OPENSEARCH_PORT: ""
OPENSEARCH_INITIAL_ADMIN_PASSWORD: ""
POSTGRES_HOST: ""
POSTGRES_PORT: ""
POSTGRES_DB: ""
POSTGRES_USER: ""
POSTGRES_PASSWORD: ""
Timeout: 15
Role: arn:aws:iam::936771282063:role/334s25_lambda_execution_opensearch
Loading