Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/hitide profile local dev readme #45

Closed
wants to merge 19 commits into from
Closed
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
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
### Changed
- issue-58: Changed harmony submit call from GET to POST.
### Removed
### Fixed
- issue-72: Fixed multipart form data for harmony submit.
Expand Down
114 changes: 113 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,116 @@ Subset-Job related endpoints:
## Connections to other systems
* Earthdata Login system
* MySQL/MariaDB database
* PODAAC L2SS services
* PODAAC L2SS services

## Local development

### 1. Setting Up MySQL with Docker

#### Step 1: Pull the MySQL Docker Image

Make sure you have Docker installed on your system. Then, pull the MySQL version 5 Docker image:

```bash
docker pull --platform linux/x86_64 mysql
docker pull mysql:5
```

#### Step 2: Run the MySQL Docker Container

Run a MySQL container with the desired configuration:

```bash
docker run --name hitide-mysql --platform linux/amd64 -e MYSQL_ROOT_PASSWORD=my-secret-pw -d -p 3306:3306 mysql:5
```

You can customize:

- `--name hitide-mysql`: The name of the Docker container.
- `-e MYSQL_ROOT_PASSWORD=my-secret-pw`: The root password for MySQL.
- `-p 3306:3306`: The port mapping, which maps port 3306 on your host to port 3306 in the container.

#### Step 3: Verify the MySQL Container is Running

Check the status of the running container:

```bash
docker ps
```

You should see your MySQL container listed.

### 2. Creating the Database

#### Step 1: Connect to the MySQL Instance

Use your preferred MySQL client or the MySQL command-line tool to connect to the running MySQL instance:

```bash
mysql -h 127.0.0.1 -P 3306 -u root -p
```

You'll be prompted for the root password (my-secret-pw in this case).

#### Step 2: Create the Database

Once connected, create the database:

```sql
CREATE DATABASE hitide_profile;
```

### 3. Setting Up the Application

#### Step 1: Configure Environment Variables

Before running the setup script, configure the necessary environment variables. You can set these variables in your shell session or use a `.env` file. Here’s an example of how to set them:

```bash
export DATABASE_HOST=127.0.0.1
export DATABASE_PORT=3306
export DATABASE_NAME=hitide_profile
export DATABASE_ADMIN=root
export DATABASE_ADMIN_PASSWORD=my-secret-pw
export DATABASE_USERNAME=hitide_user
export DATABASE_PASSWORD=hitide_password
```

#### Step 2: Run the Setup Script

Navigate to the hitide-profile root directory and run the setup script:

```bash
cd path/to/hitide-profile
node mysql/setup-db.js
```

This script will:
- Connect to the MySQL instance using the admin credentials.
- Create a new user (specified by `DATABASE_USERNAME` and `DATABASE_PASSWORD`).
- Set up the necessary tables in the `hitide_profile` database.

### 4. Verifying the Setup

#### Step 1: Check Database and Tables

Reconnect to the MySQL instance and check the database and tables:

```bash
mysql -h 127.0.0.1 -P 3306 -u root -p
```

Then run:

```sql
USE hitide_profile;
SHOW TABLES;
```

You should see the tables created by the setup script.

### Note:
In HiTIDE UI code in the **hitideConfig.js** file, make sure you set the **hitideProfileOrigin** variable to where your local hitide-profile instance is running so the frontend knows where to find hitide-profile. For example:
```
var hitideProfileOrigin = "http://localhost:8080/hitide/api";
```
164 changes: 161 additions & 3 deletions package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this updated?

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/client/harmony.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ async function subset(job, accessToken) {
datasetId,
bbox,
granuleIds = [],
granuleNames = [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

variables,
merge,
} = job.subjobs[0];
Expand Down
Loading