Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Located in the `/docs/how-tos` directory. All important information on local run

### How to run project locally

> ⚠️ For simple local run (no breaking changes) you can connect to the remote (DEV) database.

To do that, you have to authenticate with AWS CLI first (ref. `/docs/how-tos/local_run_and_configs.md`)

🚨 For proper development it is **strongly recommended** to use local database. Here's how to do that:

1. Follow `/docs/how-tos/setup_local_postgresql`, step "Setting up Local PostgreSQL instance"
2. Use `.env.local` file for environment variables (default `.env` is picked up by Docker so to avoid confusion we use explicit local file for local development). Update your `.env.local` accordingly. Here is sample structure or reach out for up-to-date .env to fellow devs:
```
Expand All @@ -20,12 +26,20 @@ Located in the `/docs/how-tos` directory. All important information on local run
DB_NAME=mydatabase
DB_PASS=password
DB_PORT=5432
ENVIRONMENT=local
ENVIRONMENT=local # the IMPORTANT part!!! this tells the service to use local resources.
```

Note: ENVIRONMENT should be set to local for running the project locally, otherwise you have to authenticate with AWS CLI first (ref. `/docs/how-tos/local_run_and_configs.md`)
✅ Once you are authenticated with AWS CLI or you have the local PostgreSQL setup, you can successfully run

```bash
npm start
```
or
```bash
nodemon server.js
```

Once you are authenticated with AWS CLI or you have the local PostgreSQL setup, you can successfully run `npm start` (or use `nodemon`) to start the server.
to start the server.

### Useful commands: Makefile

Expand Down
11 changes: 7 additions & 4 deletions docs/how-tos/local_run_and_configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,28 @@ For other OS see documentation: https://docs.aws.amazon.com/cli/latest/userguide

### Configure AWS credentials

Run in command line:
1. Contact one of the backend devs to get your AWS access keys.

2. Run in command line:
```bash
aws configure
```

You will be prompted to insert following parameters:
3. You will be prompted to insert following parameters:

* **AWS Access Key ID:** Access key ID provided to you in .csv file
* **AWS Secret Access Key:** Access key provided in .csv file
* **Default region:** us-east-1
* **Default output format:** json

After this the service will be able to load secrets from AWS SSM and access database.
4. After this the service will be able to load secrets from AWS SSM and access database.

### Connecting to the database via psql

If you need to connect directly to the database, use the following command. For RDS this will only work from within the EC2.

```bash
psql -h catbytes-web-platform-db.ct2ag4a86wsn.eu-west-2.rds.amazonaws.com -U <username> -d postgres -p 5432
```

Change `<username>` to the database admin username provided and insert the password.

Loading