Skip to content

Commit 13f540d

Browse files
jbyrne6jbyrne
and
jbyrne
authored
feature/hitide-profile-local-dev-readme: add instructions for local development (#47)
Co-authored-by: jbyrne <[email protected]>
1 parent e1c14c3 commit 13f540d

File tree

1 file changed

+113
-1
lines changed

1 file changed

+113
-1
lines changed

README.md

+113-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,116 @@ Subset-Job related endpoints:
3030
## Connections to other systems
3131
* Earthdata Login system
3232
* MySQL/MariaDB database
33-
* PODAAC L2SS services
33+
* PODAAC L2SS services
34+
35+
## Local development
36+
37+
### 1. Setting Up MySQL with Docker
38+
39+
#### Step 1: Pull the MySQL Docker Image
40+
41+
Make sure you have Docker installed on your system. Then, pull the MySQL version 5 Docker image:
42+
43+
```bash
44+
docker pull --platform linux/x86_64 mysql
45+
docker pull mysql:5
46+
```
47+
48+
#### Step 2: Run the MySQL Docker Container
49+
50+
Run a MySQL container with the desired configuration:
51+
52+
```bash
53+
docker run --name hitide-mysql --platform linux/amd64 -e MYSQL_ROOT_PASSWORD=my-secret-pw -d -p 3306:3306 mysql:5
54+
```
55+
56+
You can customize:
57+
58+
- `--name hitide-mysql`: The name of the Docker container.
59+
- `-e MYSQL_ROOT_PASSWORD=my-secret-pw`: The root password for MySQL.
60+
- `-p 3306:3306`: The port mapping, which maps port 3306 on your host to port 3306 in the container.
61+
62+
#### Step 3: Verify the MySQL Container is Running
63+
64+
Check the status of the running container:
65+
66+
```bash
67+
docker ps
68+
```
69+
70+
You should see your MySQL container listed.
71+
72+
### 2. Creating the Database
73+
74+
#### Step 1: Connect to the MySQL Instance
75+
76+
Use your preferred MySQL client or the MySQL command-line tool to connect to the running MySQL instance:
77+
78+
```bash
79+
mysql -h 127.0.0.1 -P 3306 -u root -p
80+
```
81+
82+
You'll be prompted for the root password (my-secret-pw in this case).
83+
84+
#### Step 2: Create the Database
85+
86+
Once connected, create the database:
87+
88+
```sql
89+
CREATE DATABASE hitide_profile;
90+
```
91+
92+
### 3. Setting Up the Application
93+
94+
#### Step 1: Configure Environment Variables
95+
96+
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:
97+
98+
```bash
99+
export DATABASE_HOST=127.0.0.1
100+
export DATABASE_PORT=3306
101+
export DATABASE_NAME=hitide_profile
102+
export DATABASE_ADMIN=root
103+
export DATABASE_ADMIN_PASSWORD=my-secret-pw
104+
export DATABASE_USERNAME=hitide_user
105+
export DATABASE_PASSWORD=hitide_password
106+
```
107+
108+
#### Step 2: Run the Setup Script
109+
110+
Navigate to the hitide-profile root directory and run the setup script:
111+
112+
```bash
113+
cd path/to/hitide-profile
114+
node mysql/setup-db.js
115+
```
116+
117+
This script will:
118+
- Connect to the MySQL instance using the admin credentials.
119+
- Create a new user (specified by `DATABASE_USERNAME` and `DATABASE_PASSWORD`).
120+
- Set up the necessary tables in the `hitide_profile` database.
121+
122+
### 4. Verifying the Setup
123+
124+
#### Step 1: Check Database and Tables
125+
126+
Reconnect to the MySQL instance and check the database and tables:
127+
128+
```bash
129+
mysql -h 127.0.0.1 -P 3306 -u root -p
130+
```
131+
132+
Then run:
133+
134+
```sql
135+
USE hitide_profile;
136+
SHOW TABLES;
137+
```
138+
139+
You should see the tables created by the setup script.
140+
141+
### Note:
142+
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:
143+
```
144+
var hitideProfileOrigin = "http://localhost:8080/hitide/api";
145+
```

0 commit comments

Comments
 (0)